diff --git a/README.md b/README.md index 5e98ac5..11cc535 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,9 @@ ├── p2pix.sol └── Reputation.sol ``` + ## Callgraph + ![Callgraph](docs/callgraph.svg) ## Usage @@ -76,16 +78,15 @@ $ yarn clean To import artifacts on the project use the following: ```ts -import P2PIXArtifact from 'p2pix-smart-contracts/artifacts/contracts/p2pix.sol/P2PIX.json' +import P2PIXArtifact from "p2pix-smart-contracts/artifacts/contracts/p2pix.sol/P2PIX.json"; ``` To grab deployment addresses you can just grab from deploys folder: ```ts -import localhostDeploys from 'p2pix-smart-contracts/deploys/localhost.json' +import localhostDeploys from "p2pix-smart-contracts/deploys/localhost.json"; ``` - ## Deploying to local environment On the first teminal, use the following command and import some wallets to your Metamask, then connect to the network pointed: diff --git a/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json b/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json index 4141d4c..490b60b 100644 --- a/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json +++ b/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../build-info/727fbe6b5a53dc5c0af688ab7bc65edd.json" } diff --git a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json index 4141d4c..490b60b 100644 --- a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json +++ b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../build-info/727fbe6b5a53dc5c0af688ab7bc65edd.json" } diff --git a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json index 56c328c..6f9ef56 100644 --- a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json +++ b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json @@ -63,6 +63,11 @@ "name": "OnlySeller", "type": "error" }, + { + "inputs": [], + "name": "StaticCallFailed", + "type": "error" + }, { "inputs": [], "name": "TokenDenied", diff --git a/artifacts/contracts/Reputation.sol/Reputation.dbg.json b/artifacts/contracts/Reputation.sol/Reputation.dbg.json index 4141d4c..490b60b 100644 --- a/artifacts/contracts/Reputation.sol/Reputation.dbg.json +++ b/artifacts/contracts/Reputation.sol/Reputation.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../build-info/727fbe6b5a53dc5c0af688ab7bc65edd.json" } diff --git a/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json b/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json index 82748a5..ab09155 100644 --- a/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json +++ b/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/da574cda4da83daffd2579005f189352.json" } diff --git a/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json b/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json index 82748a5..9a2dc31 100644 --- a/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json +++ b/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/727fbe6b5a53dc5c0af688ab7bc65edd.json" } diff --git a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json index 82748a5..ab09155 100644 --- a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json +++ b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/da574cda4da83daffd2579005f189352.json" } diff --git a/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json b/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json index 82748a5..ab09155 100644 --- a/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json +++ b/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/da574cda4da83daffd2579005f189352.json" } diff --git a/artifacts/contracts/lib/utils/Counters.sol/Counters.dbg.json b/artifacts/contracts/lib/utils/Counters.sol/Counters.dbg.json index 82748a5..ab09155 100644 --- a/artifacts/contracts/lib/utils/Counters.sol/Counters.dbg.json +++ b/artifacts/contracts/lib/utils/Counters.sol/Counters.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/da574cda4da83daffd2579005f189352.json" } diff --git a/artifacts/contracts/lib/utils/FixedPointMathLib.sol/FixedPointMathLib.dbg.json b/artifacts/contracts/lib/utils/FixedPointMathLib.sol/FixedPointMathLib.dbg.json index 82748a5..9a2dc31 100644 --- a/artifacts/contracts/lib/utils/FixedPointMathLib.sol/FixedPointMathLib.dbg.json +++ b/artifacts/contracts/lib/utils/FixedPointMathLib.sol/FixedPointMathLib.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/727fbe6b5a53dc5c0af688ab7bc65edd.json" } diff --git a/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json b/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json index 82748a5..9a2dc31 100644 --- a/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json +++ b/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/727fbe6b5a53dc5c0af688ab7bc65edd.json" } diff --git a/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json b/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json index 82748a5..9a2dc31 100644 --- a/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +++ b/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/727fbe6b5a53dc5c0af688ab7bc65edd.json" } diff --git a/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json b/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json index 82748a5..ab09155 100644 --- a/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json +++ b/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../../../build-info/da574cda4da83daffd2579005f189352.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.dbg.json b/artifacts/contracts/p2pix.sol/P2PIX.dbg.json index 4141d4c..490b60b 100644 --- a/artifacts/contracts/p2pix.sol/P2PIX.dbg.json +++ b/artifacts/contracts/p2pix.sol/P2PIX.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/eddb8a89a5d02f0c81c1106939df9c5f.json" + "buildInfo": "../../build-info/727fbe6b5a53dc5c0af688ab7bc65edd.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.json b/artifacts/contracts/p2pix.sol/P2PIX.json index f4e1429..8ceeacf 100644 --- a/artifacts/contracts/p2pix.sol/P2PIX.json +++ b/artifacts/contracts/p2pix.sol/P2PIX.json @@ -99,6 +99,11 @@ "name": "Reentrancy", "type": "error" }, + { + "inputs": [], + "name": "StaticCallFailed", + "type": "error" + }, { "inputs": [], "name": "TokenDenied", @@ -849,8 +854,8 @@ "type": "receive" } ], - "bytecode": "0x608060405260018055604051620027f9380380620027f98339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600660205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083016020830282015b8083146200037f578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b6121c980620006306000396000f3fe60806040526004361061018f5760003560e01c806377cd38a4116100d65780638e2a3d361161007f578063c52164c611610059578063c52164c614610539578063d6e8b97314610559578063f7d0e04b1461057957600080fd5b80638e2a3d36146104c25780639872dbfe146104f357806398a268711461050957600080fd5b80638652b37e116100b05780638652b37e1461044a5780638da5cb5b1461046a5780638e2749d6146104a257600080fd5b806377cd38a4146103dd5780637f94f65d1461040a5780638642b5c31461042a57600080fd5b806336317972116101385780635fd8c710116101125780635fd8c7101461036857806369cc6af41461037d57806372fada5c146103bd57600080fd5b806336317972146102fd5780634b2ae9801461031d578063574983c81461034857600080fd5b806316d722401161016957806316d722401461021d57806329cc7d10146102c65780632dfdf0b5146102e657600080fd5b8063049373201461019b5780630d2a2d44146101db57806313af4035146101fd57600080fd5b3661019657005b600080fd5b3480156101a757600080fd5b506101c86101b6366004611ac5565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101e757600080fd5b506101fb6101f6366004611bd2565b610599565b005b34801561020957600080fd5b506101fb610218366004611c0f565b61068a565b34801561022957600080fd5b50610282610238366004611ac5565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101d2565b3480156102d257600080fd5b506101c86102e1366004611c2c565b61071e565b3480156102f257600080fd5b506003546101c89081565b34801561030957600080fd5b506101fb610318366004611d09565b6108fc565b34801561032957600080fd5b506101c8610338366004611c0f565b600c1b611000600160ac1b031690565b34801561035457600080fd5b506101fb610363366004611ac5565b6109bc565b34801561037457600080fd5b506101fb610a3a565b34801561038957600080fd5b506103ad610398366004611c0f565b600b6020526000908152604090205460ff1681565b60405190151581526020016101d2565b3480156103c957600080fd5b506101fb6103d8366004611ac5565b610ac4565b3480156103e957600080fd5b506101c86103f8366004611ac5565b600a6020526000908152604090205481565b34801561041657600080fd5b506101fb610425366004611d55565b610b4c565b34801561043657600080fd5b506101fb610445366004611d81565b610b97565b34801561045657600080fd5b506101c8610465366004611de5565b610f65565b34801561047657600080fd5b5060005461048a906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b3480156104ae57600080fd5b506101fb6104bd366004611e99565b6112a7565b3480156104ce57600080fd5b506104e26104dd366004611ac5565b6113ff565b6040516101d2959493929190611edb565b3480156104ff57600080fd5b506101c860045481565b34801561051557600080fd5b506103ad610524366004611ac5565b60066020526000908152604090205460ff1681565b34801561054557600080fd5b5060025461048a906001600160a01b031681565b34801561056557600080fd5b506101fb610574366004611f68565b6114c9565b34801561058557600080fd5b506101fb610594366004611c0f565b6115a1565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b8082101561064e57600061062784848151811061060c5761060c612032565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff191660019081179091559290920191506105ed565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d78160405161067f9190612048565b60405180910390a150565b6000546001600160a01b031633146106d35760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff1661075957604051630abc194760e11b815260040160405180910390fd5b610761611628565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506107d6611678565b83156107e6576107e63385610b4c565b6000838152600760209081526040909120825181558183015180518493610814926001850192910190611a2c565b5060408201516002820180546001600160a01b039283166001600160a01b03199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff0000000000000000000000000000000000000000009095169190921617929092179091556108919080546001019055565b61089d8233308a6116a3565b6108a660018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b610904611678565b61090d8361173a565b61091782826112a7565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109475761094784610ac4565b600381015481546000835560028301546001600160a01b03928316926109709184911683611777565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a25050506109b760018055565b505050565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161067f91815260200190565b6000546001600160a01b03163314610a835760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b47610a8e3382611803565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d910161067f565b610acd8161173a565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b6001600160a01b038216331415610b7e57600c9190911b611000600160ac1b03166000908152600a6020526040902055565b6040516342e8fb9360e11b815260040160405180910390fd5b610b9f611678565b6000868152600860205260409020600381015443101580610bc257506002810154155b15610be0576040516331da482760e11b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c1092600186019290918b91016120d0565b604051602081830303815290604052805190602001209050600081604051602001610c6791907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cb557604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d299060019060a0016020604051602081039080840390855afa158015610d0d573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610d5b57604051632057875960e21b815260040160405180910390fd5b6003840154600186015460028701546001600160a01b0390921691600091610d829161218d565b60006002890181905560038901819055868152600960205260409020805460ff191660011790556006880154909150336001600160a01b0390911614610e3d576001870154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610df39084906121a4565b909155505060028701546006880154600590600090600c1b611000600160ac1b031681526020019081526020016000206000828254610e3291906121a4565b90915550610e839050565b86600201548760010154610e5191906121a4565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e7d9084906121a4565b90915550505b6004870154610e9d9083906001600160a01b031683611777565b600187015415610f095760058701546001600160a01b038d8116911614610efa576005870154600180890154610ee29285926001600160a01b0390911691901c611777565b610ef5828d60018a60010154901c611777565b610f09565b610f09828d8960010154611777565b60048701546040518e81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a250505050505050610f5d60018055565b505050505050565b6000610f6f611678565b610f7983836112a7565b60008a81526007602052604090206003810154600160a01b900460ff16610fb357604051635972996f60e11b815260040160405180910390fd5b8054871115610fd5576040516308aeed0f60e21b815260040160405180910390fd5b610fe08b888c61185e565b915060006040518060e001604052808d81526020018a81526020018981526020016004544361100f91906121a4565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611150576002820154600c1b611000600160ac1b03166000908152600a60205260409020546110669088908890336118e2565b60008381526008602090815260408083208451815591840151600183015583015160028201556060830151600382015560808301516004820180546001600160a01b039283166001600160a01b03199182161790915560a085015160058401805491841691831691909117905560c0850151600690930180549390921692169190911790558254899184916110fc90849061218d565b9091555050805160408051918252602082018a905284916001600160a01b038e16917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a35050611291565b611000600160ac1b0333600c1b166000908152600560205260408120549061117782611914565b9050808360400151111561119e57604051630e0c7c2360e11b815260040160405180910390fd5b60008581526008602090815260408083208651815591860151600183015585015160028201556060850151600382015560808501516004820180546001600160a01b039283166001600160a01b03199182161790915560a087015160058401805491841691831691909117905560c08701516006909301805493909216921691909117905584548b91869161123490849061218d565b92505081905550848d6001600160a01b03167f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea85600001518d604051611284929190918252602082015260400190565b60405180910390a3505050505b61129a60018055565b9998505050505050505050565b6000815b808210156113e3576000600860008686868181106112cb576112cb612032565b90506020020135815260200190815260200160002090506112eb816119b5565b60028101548154600090815260076020526040812080549091906113109084906121a4565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c6064811161136457600082815260056020526040902060649055611376565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff8888888181106113b7576113b7612032565b905060200201356040516113cd91815260200190565b60405180910390a28460010194505050506112ab565b808210156113f95763dfb035c96000526004601cfd5b50505050565b6007602052600090815260409020805460018201805491929161142190612095565b80601f016020809104026020016040519081016040528092919081815260200182805461144d90612095565b801561149a5780601f1061146f5761010080835404028352916020019161149a565b820191906000526020600020905b81548152906001019060200180831161147d57829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b031633146115125760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b8151806115275763df9578836000526004601cfd5b8151811461153d5763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f5d578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915061154c565b6000546001600160a01b031633146115ea5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200161067f565b600061163360035490565b600081815260076020526040902060030154909150600160a01b900460ff161515600114156116755760405163c44bd76560e01b815260040160405180910390fd5b90565b6001546002141561169c5760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806117335760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016105de565b5050505050565b6000818152600760205260409020600201546001600160a01b03163314611774576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113f95760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016105de565b600080600080600085875af19050806109b75760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016105de565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118db5760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118f78484846001600160a01b0385166119e8565b6113f957604051631dc23a5f60e11b815260040160405180910390fd5b600080634d2b179160e01b8360405160240161193291815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa505060005195945050505050565b4381600301541015806119ca57506002810154155b156117745760405163d0404f8560e01b815260040160405180910390fd5b60008315611a24578360051b8501855b803580851160051b94855260209485185260406000209301818110611a1c57611a21565b6119f8565b50505b501492915050565b828054611a3890612095565b90600052602060002090601f016020900481019282611a5a5760008555611aa0565b82601f10611a7357805160ff1916838001178555611aa0565b82800160010185558215611aa0579182015b82811115611aa0578251825591602001919060010190611a85565b50611aac929150611ab0565b5090565b5b80821115611aac5760008155600101611ab1565b600060208284031215611ad757600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1d57611b1d611ade565b604052919050565b600067ffffffffffffffff821115611b3f57611b3f611ade565b5060051b60200190565b6001600160a01b038116811461177457600080fd5b600082601f830112611b6f57600080fd5b81356020611b84611b7f83611b25565b611af4565b82815260059290921b84018101918181019086841115611ba357600080fd5b8286015b84811015611bc7578035611bba81611b49565b8352918301918301611ba7565b509695505050505050565b600060208284031215611be457600080fd5b813567ffffffffffffffff811115611bfb57600080fd5b611c0784828501611b5e565b949350505050565b600060208284031215611c2157600080fd5b81356118db81611b49565b600080600080600060808688031215611c4457600080fd5b8535611c4f81611b49565b945060208601359350604086013567ffffffffffffffff80821115611c7357600080fd5b818801915088601f830112611c8757600080fd5b813581811115611c9657600080fd5b896020828501011115611ca857600080fd5b96999598505060200195606001359392505050565b60008083601f840112611ccf57600080fd5b50813567ffffffffffffffff811115611ce757600080fd5b6020830191508360208260051b8501011115611d0257600080fd5b9250929050565b600080600060408486031215611d1e57600080fd5b83359250602084013567ffffffffffffffff811115611d3c57600080fd5b611d4886828701611cbd565b9497909650939450505050565b60008060408385031215611d6857600080fd5b8235611d7381611b49565b946020939093013593505050565b60008060008060008060c08789031215611d9a57600080fd5b863595506020870135611dac81611b49565b945060408701359350606087013592506080870135915060a087013560ff81168114611dd757600080fd5b809150509295509295509295565b600080600080600080600080600060e08a8c031215611e0357600080fd5b8935985060208a0135611e1581611b49565b975060408a0135611e2581611b49565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611e5057600080fd5b611e5c8d838e01611cbd565b909650945060c08c0135915080821115611e7557600080fd5b50611e828c828d01611cbd565b915080935050809150509295985092959850929598565b60008060208385031215611eac57600080fd5b823567ffffffffffffffff811115611ec357600080fd5b611ecf85828601611cbd565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f0f5788810183015185820160c001528201611ef3565b81811115611f2157600060c083870101525b50601f01601f1916830160c0019150611f47905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611f7b57600080fd5b823567ffffffffffffffff80821115611f9357600080fd5b611f9f86838701611b5e565b9350602091508185013581811115611fb657600080fd5b85019050601f81018613611fc957600080fd5b8035611fd7611b7f82611b25565b81815260059190911b82018301908381019088831115611ff657600080fd5b928401925b8284101561202357833580151581146120145760008081fd5b82529284019290840190611ffb565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120895783516001600160a01b031683529284019291840191600101612064565b50909695505050505050565b600181811c908216806120a957607f821691505b602082108114156120ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c9150808316806120ec57607f831692505b602080841082141561210c57634e487b7160e01b86526022600452602486fd5b81801561212057600181146121315761215e565b60ff1986168952848901965061215e565b60008c81526020902060005b868110156121565781548b82015290850190830161213d565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561219f5761219f612177565b500390565b600082198211156121b7576121b7612177565b50019056fea164736f6c6343000809000a", - "deployedBytecode": "0x60806040526004361061018f5760003560e01c806377cd38a4116100d65780638e2a3d361161007f578063c52164c611610059578063c52164c614610539578063d6e8b97314610559578063f7d0e04b1461057957600080fd5b80638e2a3d36146104c25780639872dbfe146104f357806398a268711461050957600080fd5b80638652b37e116100b05780638652b37e1461044a5780638da5cb5b1461046a5780638e2749d6146104a257600080fd5b806377cd38a4146103dd5780637f94f65d1461040a5780638642b5c31461042a57600080fd5b806336317972116101385780635fd8c710116101125780635fd8c7101461036857806369cc6af41461037d57806372fada5c146103bd57600080fd5b806336317972146102fd5780634b2ae9801461031d578063574983c81461034857600080fd5b806316d722401161016957806316d722401461021d57806329cc7d10146102c65780632dfdf0b5146102e657600080fd5b8063049373201461019b5780630d2a2d44146101db57806313af4035146101fd57600080fd5b3661019657005b600080fd5b3480156101a757600080fd5b506101c86101b6366004611ac5565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101e757600080fd5b506101fb6101f6366004611bd2565b610599565b005b34801561020957600080fd5b506101fb610218366004611c0f565b61068a565b34801561022957600080fd5b50610282610238366004611ac5565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101d2565b3480156102d257600080fd5b506101c86102e1366004611c2c565b61071e565b3480156102f257600080fd5b506003546101c89081565b34801561030957600080fd5b506101fb610318366004611d09565b6108fc565b34801561032957600080fd5b506101c8610338366004611c0f565b600c1b611000600160ac1b031690565b34801561035457600080fd5b506101fb610363366004611ac5565b6109bc565b34801561037457600080fd5b506101fb610a3a565b34801561038957600080fd5b506103ad610398366004611c0f565b600b6020526000908152604090205460ff1681565b60405190151581526020016101d2565b3480156103c957600080fd5b506101fb6103d8366004611ac5565b610ac4565b3480156103e957600080fd5b506101c86103f8366004611ac5565b600a6020526000908152604090205481565b34801561041657600080fd5b506101fb610425366004611d55565b610b4c565b34801561043657600080fd5b506101fb610445366004611d81565b610b97565b34801561045657600080fd5b506101c8610465366004611de5565b610f65565b34801561047657600080fd5b5060005461048a906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b3480156104ae57600080fd5b506101fb6104bd366004611e99565b6112a7565b3480156104ce57600080fd5b506104e26104dd366004611ac5565b6113ff565b6040516101d2959493929190611edb565b3480156104ff57600080fd5b506101c860045481565b34801561051557600080fd5b506103ad610524366004611ac5565b60066020526000908152604090205460ff1681565b34801561054557600080fd5b5060025461048a906001600160a01b031681565b34801561056557600080fd5b506101fb610574366004611f68565b6114c9565b34801561058557600080fd5b506101fb610594366004611c0f565b6115a1565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b8082101561064e57600061062784848151811061060c5761060c612032565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff191660019081179091559290920191506105ed565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d78160405161067f9190612048565b60405180910390a150565b6000546001600160a01b031633146106d35760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff1661075957604051630abc194760e11b815260040160405180910390fd5b610761611628565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506107d6611678565b83156107e6576107e63385610b4c565b6000838152600760209081526040909120825181558183015180518493610814926001850192910190611a2c565b5060408201516002820180546001600160a01b039283166001600160a01b03199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff0000000000000000000000000000000000000000009095169190921617929092179091556108919080546001019055565b61089d8233308a6116a3565b6108a660018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b610904611678565b61090d8361173a565b61091782826112a7565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109475761094784610ac4565b600381015481546000835560028301546001600160a01b03928316926109709184911683611777565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a25050506109b760018055565b505050565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161067f91815260200190565b6000546001600160a01b03163314610a835760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b47610a8e3382611803565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d910161067f565b610acd8161173a565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b6001600160a01b038216331415610b7e57600c9190911b611000600160ac1b03166000908152600a6020526040902055565b6040516342e8fb9360e11b815260040160405180910390fd5b610b9f611678565b6000868152600860205260409020600381015443101580610bc257506002810154155b15610be0576040516331da482760e11b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c1092600186019290918b91016120d0565b604051602081830303815290604052805190602001209050600081604051602001610c6791907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cb557604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d299060019060a0016020604051602081039080840390855afa158015610d0d573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610d5b57604051632057875960e21b815260040160405180910390fd5b6003840154600186015460028701546001600160a01b0390921691600091610d829161218d565b60006002890181905560038901819055868152600960205260409020805460ff191660011790556006880154909150336001600160a01b0390911614610e3d576001870154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610df39084906121a4565b909155505060028701546006880154600590600090600c1b611000600160ac1b031681526020019081526020016000206000828254610e3291906121a4565b90915550610e839050565b86600201548760010154610e5191906121a4565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e7d9084906121a4565b90915550505b6004870154610e9d9083906001600160a01b031683611777565b600187015415610f095760058701546001600160a01b038d8116911614610efa576005870154600180890154610ee29285926001600160a01b0390911691901c611777565b610ef5828d60018a60010154901c611777565b610f09565b610f09828d8960010154611777565b60048701546040518e81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a250505050505050610f5d60018055565b505050505050565b6000610f6f611678565b610f7983836112a7565b60008a81526007602052604090206003810154600160a01b900460ff16610fb357604051635972996f60e11b815260040160405180910390fd5b8054871115610fd5576040516308aeed0f60e21b815260040160405180910390fd5b610fe08b888c61185e565b915060006040518060e001604052808d81526020018a81526020018981526020016004544361100f91906121a4565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611150576002820154600c1b611000600160ac1b03166000908152600a60205260409020546110669088908890336118e2565b60008381526008602090815260408083208451815591840151600183015583015160028201556060830151600382015560808301516004820180546001600160a01b039283166001600160a01b03199182161790915560a085015160058401805491841691831691909117905560c0850151600690930180549390921692169190911790558254899184916110fc90849061218d565b9091555050805160408051918252602082018a905284916001600160a01b038e16917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a35050611291565b611000600160ac1b0333600c1b166000908152600560205260408120549061117782611914565b9050808360400151111561119e57604051630e0c7c2360e11b815260040160405180910390fd5b60008581526008602090815260408083208651815591860151600183015585015160028201556060850151600382015560808501516004820180546001600160a01b039283166001600160a01b03199182161790915560a087015160058401805491841691831691909117905560c08701516006909301805493909216921691909117905584548b91869161123490849061218d565b92505081905550848d6001600160a01b03167f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea85600001518d604051611284929190918252602082015260400190565b60405180910390a3505050505b61129a60018055565b9998505050505050505050565b6000815b808210156113e3576000600860008686868181106112cb576112cb612032565b90506020020135815260200190815260200160002090506112eb816119b5565b60028101548154600090815260076020526040812080549091906113109084906121a4565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c6064811161136457600082815260056020526040902060649055611376565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff8888888181106113b7576113b7612032565b905060200201356040516113cd91815260200190565b60405180910390a28460010194505050506112ab565b808210156113f95763dfb035c96000526004601cfd5b50505050565b6007602052600090815260409020805460018201805491929161142190612095565b80601f016020809104026020016040519081016040528092919081815260200182805461144d90612095565b801561149a5780601f1061146f5761010080835404028352916020019161149a565b820191906000526020600020905b81548152906001019060200180831161147d57829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b031633146115125760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b8151806115275763df9578836000526004601cfd5b8151811461153d5763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f5d578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915061154c565b6000546001600160a01b031633146115ea5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200161067f565b600061163360035490565b600081815260076020526040902060030154909150600160a01b900460ff161515600114156116755760405163c44bd76560e01b815260040160405180910390fd5b90565b6001546002141561169c5760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806117335760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016105de565b5050505050565b6000818152600760205260409020600201546001600160a01b03163314611774576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113f95760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016105de565b600080600080600085875af19050806109b75760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016105de565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118db5760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118f78484846001600160a01b0385166119e8565b6113f957604051631dc23a5f60e11b815260040160405180910390fd5b600080634d2b179160e01b8360405160240161193291815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa505060005195945050505050565b4381600301541015806119ca57506002810154155b156117745760405163d0404f8560e01b815260040160405180910390fd5b60008315611a24578360051b8501855b803580851160051b94855260209485185260406000209301818110611a1c57611a21565b6119f8565b50505b501492915050565b828054611a3890612095565b90600052602060002090601f016020900481019282611a5a5760008555611aa0565b82601f10611a7357805160ff1916838001178555611aa0565b82800160010185558215611aa0579182015b82811115611aa0578251825591602001919060010190611a85565b50611aac929150611ab0565b5090565b5b80821115611aac5760008155600101611ab1565b600060208284031215611ad757600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1d57611b1d611ade565b604052919050565b600067ffffffffffffffff821115611b3f57611b3f611ade565b5060051b60200190565b6001600160a01b038116811461177457600080fd5b600082601f830112611b6f57600080fd5b81356020611b84611b7f83611b25565b611af4565b82815260059290921b84018101918181019086841115611ba357600080fd5b8286015b84811015611bc7578035611bba81611b49565b8352918301918301611ba7565b509695505050505050565b600060208284031215611be457600080fd5b813567ffffffffffffffff811115611bfb57600080fd5b611c0784828501611b5e565b949350505050565b600060208284031215611c2157600080fd5b81356118db81611b49565b600080600080600060808688031215611c4457600080fd5b8535611c4f81611b49565b945060208601359350604086013567ffffffffffffffff80821115611c7357600080fd5b818801915088601f830112611c8757600080fd5b813581811115611c9657600080fd5b896020828501011115611ca857600080fd5b96999598505060200195606001359392505050565b60008083601f840112611ccf57600080fd5b50813567ffffffffffffffff811115611ce757600080fd5b6020830191508360208260051b8501011115611d0257600080fd5b9250929050565b600080600060408486031215611d1e57600080fd5b83359250602084013567ffffffffffffffff811115611d3c57600080fd5b611d4886828701611cbd565b9497909650939450505050565b60008060408385031215611d6857600080fd5b8235611d7381611b49565b946020939093013593505050565b60008060008060008060c08789031215611d9a57600080fd5b863595506020870135611dac81611b49565b945060408701359350606087013592506080870135915060a087013560ff81168114611dd757600080fd5b809150509295509295509295565b600080600080600080600080600060e08a8c031215611e0357600080fd5b8935985060208a0135611e1581611b49565b975060408a0135611e2581611b49565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611e5057600080fd5b611e5c8d838e01611cbd565b909650945060c08c0135915080821115611e7557600080fd5b50611e828c828d01611cbd565b915080935050809150509295985092959850929598565b60008060208385031215611eac57600080fd5b823567ffffffffffffffff811115611ec357600080fd5b611ecf85828601611cbd565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f0f5788810183015185820160c001528201611ef3565b81811115611f2157600060c083870101525b50601f01601f1916830160c0019150611f47905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611f7b57600080fd5b823567ffffffffffffffff80821115611f9357600080fd5b611f9f86838701611b5e565b9350602091508185013581811115611fb657600080fd5b85019050601f81018613611fc957600080fd5b8035611fd7611b7f82611b25565b81815260059190911b82018301908381019088831115611ff657600080fd5b928401925b8284101561202357833580151581146120145760008081fd5b82529284019290840190611ffb565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120895783516001600160a01b031683529284019291840191600101612064565b50909695505050505050565b600181811c908216806120a957607f821691505b602082108114156120ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c9150808316806120ec57607f831692505b602080841082141561210c57634e487b7160e01b86526022600452602486fd5b81801561212057600181146121315761215e565b60ff1986168952848901965061215e565b60008c81526020902060005b868110156121565781548b82015290850190830161213d565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561219f5761219f612177565b500390565b600082198211156121b7576121b7612177565b50019056fea164736f6c6343000809000a", + "bytecode": "0x60806040526001805560405162002814380380620028148339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600660205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083016020830282015b8083146200037f578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b6121e480620006306000396000f3fe60806040526004361061018f5760003560e01c806377cd38a4116100d65780638e2a3d361161007f578063c52164c611610059578063c52164c614610539578063d6e8b97314610559578063f7d0e04b1461057957600080fd5b80638e2a3d36146104c25780639872dbfe146104f357806398a268711461050957600080fd5b80638652b37e116100b05780638652b37e1461044a5780638da5cb5b1461046a5780638e2749d6146104a257600080fd5b806377cd38a4146103dd5780637f94f65d1461040a5780638642b5c31461042a57600080fd5b806336317972116101385780635fd8c710116101125780635fd8c7101461036857806369cc6af41461037d57806372fada5c146103bd57600080fd5b806336317972146102fd5780634b2ae9801461031d578063574983c81461034857600080fd5b806316d722401161016957806316d722401461021d57806329cc7d10146102c65780632dfdf0b5146102e657600080fd5b8063049373201461019b5780630d2a2d44146101db57806313af4035146101fd57600080fd5b3661019657005b600080fd5b3480156101a757600080fd5b506101c86101b6366004611ae0565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101e757600080fd5b506101fb6101f6366004611bed565b610599565b005b34801561020957600080fd5b506101fb610218366004611c2a565b61068a565b34801561022957600080fd5b50610282610238366004611ae0565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101d2565b3480156102d257600080fd5b506101c86102e1366004611c47565b61071e565b3480156102f257600080fd5b506003546101c89081565b34801561030957600080fd5b506101fb610318366004611d24565b6108fc565b34801561032957600080fd5b506101c8610338366004611c2a565b600c1b611000600160ac1b031690565b34801561035457600080fd5b506101fb610363366004611ae0565b6109bc565b34801561037457600080fd5b506101fb610a3a565b34801561038957600080fd5b506103ad610398366004611c2a565b600b6020526000908152604090205460ff1681565b60405190151581526020016101d2565b3480156103c957600080fd5b506101fb6103d8366004611ae0565b610ac4565b3480156103e957600080fd5b506101c86103f8366004611ae0565b600a6020526000908152604090205481565b34801561041657600080fd5b506101fb610425366004611d70565b610b4c565b34801561043657600080fd5b506101fb610445366004611d9c565b610b97565b34801561045657600080fd5b506101c8610465366004611e00565b610f65565b34801561047657600080fd5b5060005461048a906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b3480156104ae57600080fd5b506101fb6104bd366004611eb4565b6112a7565b3480156104ce57600080fd5b506104e26104dd366004611ae0565b6113ff565b6040516101d2959493929190611ef6565b3480156104ff57600080fd5b506101c860045481565b34801561051557600080fd5b506103ad610524366004611ae0565b60066020526000908152604090205460ff1681565b34801561054557600080fd5b5060025461048a906001600160a01b031681565b34801561056557600080fd5b506101fb610574366004611f83565b6114c9565b34801561058557600080fd5b506101fb610594366004611c2a565b6115a1565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b8082101561064e57600061062784848151811061060c5761060c61204d565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff191660019081179091559290920191506105ed565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d78160405161067f9190612063565b60405180910390a150565b6000546001600160a01b031633146106d35760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff1661075957604051630abc194760e11b815260040160405180910390fd5b610761611628565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506107d6611678565b83156107e6576107e63385610b4c565b6000838152600760209081526040909120825181558183015180518493610814926001850192910190611a47565b5060408201516002820180546001600160a01b039283166001600160a01b03199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff0000000000000000000000000000000000000000009095169190921617929092179091556108919080546001019055565b61089d8233308a6116a3565b6108a660018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b610904611678565b61090d8361173a565b61091782826112a7565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109475761094784610ac4565b600381015481546000835560028301546001600160a01b03928316926109709184911683611777565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a25050506109b760018055565b505050565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161067f91815260200190565b6000546001600160a01b03163314610a835760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b47610a8e3382611803565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d910161067f565b610acd8161173a565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b6001600160a01b038216331415610b7e57600c9190911b611000600160ac1b03166000908152600a6020526040902055565b6040516342e8fb9360e11b815260040160405180910390fd5b610b9f611678565b6000868152600860205260409020600381015443101580610bc257506002810154155b15610be0576040516331da482760e11b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c1092600186019290918b91016120eb565b604051602081830303815290604052805190602001209050600081604051602001610c6791907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cb557604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d299060019060a0016020604051602081039080840390855afa158015610d0d573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610d5b57604051632057875960e21b815260040160405180910390fd5b6003840154600186015460028701546001600160a01b0390921691600091610d82916121a8565b60006002890181905560038901819055868152600960205260409020805460ff191660011790556006880154909150336001600160a01b0390911614610e3d576001870154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610df39084906121bf565b909155505060028701546006880154600590600090600c1b611000600160ac1b031681526020019081526020016000206000828254610e3291906121bf565b90915550610e839050565b86600201548760010154610e5191906121bf565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e7d9084906121bf565b90915550505b6004870154610e9d9083906001600160a01b031683611777565b600187015415610f095760058701546001600160a01b038d8116911614610efa576005870154600180890154610ee29285926001600160a01b0390911691901c611777565b610ef5828d60018a60010154901c611777565b610f09565b610f09828d8960010154611777565b60048701546040518e81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a250505050505050610f5d60018055565b505050505050565b6000610f6f611678565b610f7983836112a7565b60008a81526007602052604090206003810154600160a01b900460ff16610fb357604051635972996f60e11b815260040160405180910390fd5b8054871115610fd5576040516308aeed0f60e21b815260040160405180910390fd5b610fe08b888c61185e565b915060006040518060e001604052808d81526020018a81526020018981526020016004544361100f91906121bf565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611150576002820154600c1b611000600160ac1b03166000908152600a60205260409020546110669088908890336118e2565b60008381526008602090815260408083208451815591840151600183015583015160028201556060830151600382015560808301516004820180546001600160a01b039283166001600160a01b03199182161790915560a085015160058401805491841691831691909117905560c0850151600690930180549390921692169190911790558254899184916110fc9084906121a8565b9091555050805160408051918252602082018a905284916001600160a01b038e16917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a35050611291565b611000600160ac1b0333600c1b166000908152600560205260408120549061117782611914565b9050808360400151111561119e57604051630e0c7c2360e11b815260040160405180910390fd5b60008581526008602090815260408083208651815591860151600183015585015160028201556060850151600382015560808501516004820180546001600160a01b039283166001600160a01b03199182161790915560a087015160058401805491841691831691909117905560c08701516006909301805493909216921691909117905584548b9186916112349084906121a8565b92505081905550848d6001600160a01b03167f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea85600001518d604051611284929190918252602082015260400190565b60405180910390a3505050505b61129a60018055565b9998505050505050505050565b6000815b808210156113e3576000600860008686868181106112cb576112cb61204d565b90506020020135815260200190815260200160002090506112eb816119d0565b60028101548154600090815260076020526040812080549091906113109084906121bf565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c6064811161136457600082815260056020526040902060649055611376565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff8888888181106113b7576113b761204d565b905060200201356040516113cd91815260200190565b60405180910390a28460010194505050506112ab565b808210156113f95763dfb035c96000526004601cfd5b50505050565b60076020526000908152604090208054600182018054919291611421906120b0565b80601f016020809104026020016040519081016040528092919081815260200182805461144d906120b0565b801561149a5780601f1061146f5761010080835404028352916020019161149a565b820191906000526020600020905b81548152906001019060200180831161147d57829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b031633146115125760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b8151806115275763df9578836000526004601cfd5b8151811461153d5763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f5d578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915061154c565b6000546001600160a01b031633146115ea5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200161067f565b600061163360035490565b600081815260076020526040902060030154909150600160a01b900460ff161515600114156116755760405163c44bd76560e01b815260040160405180910390fd5b90565b6001546002141561169c5760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806117335760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016105de565b5050505050565b6000818152600760205260409020600201546001600160a01b03163314611774576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113f95760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016105de565b600080600080600085875af19050806109b75760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016105de565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118db5760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118f78484846001600160a01b038516611a03565b6113f957604051631dc23a5f60e11b815260040160405180910390fd5b600080634d2b179160e01b8360405160240161193291815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826119c75763e10bf1cc6000526004601cfd5b50505050919050565b4381600301541015806119e557506002810154155b156117745760405163d0404f8560e01b815260040160405180910390fd5b60008315611a3f578360051b8501855b803580851160051b94855260209485185260406000209301818110611a3757611a3c565b611a13565b50505b501492915050565b828054611a53906120b0565b90600052602060002090601f016020900481019282611a755760008555611abb565b82601f10611a8e57805160ff1916838001178555611abb565b82800160010185558215611abb579182015b82811115611abb578251825591602001919060010190611aa0565b50611ac7929150611acb565b5090565b5b80821115611ac75760008155600101611acc565b600060208284031215611af257600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b3857611b38611af9565b604052919050565b600067ffffffffffffffff821115611b5a57611b5a611af9565b5060051b60200190565b6001600160a01b038116811461177457600080fd5b600082601f830112611b8a57600080fd5b81356020611b9f611b9a83611b40565b611b0f565b82815260059290921b84018101918181019086841115611bbe57600080fd5b8286015b84811015611be2578035611bd581611b64565b8352918301918301611bc2565b509695505050505050565b600060208284031215611bff57600080fd5b813567ffffffffffffffff811115611c1657600080fd5b611c2284828501611b79565b949350505050565b600060208284031215611c3c57600080fd5b81356118db81611b64565b600080600080600060808688031215611c5f57600080fd5b8535611c6a81611b64565b945060208601359350604086013567ffffffffffffffff80821115611c8e57600080fd5b818801915088601f830112611ca257600080fd5b813581811115611cb157600080fd5b896020828501011115611cc357600080fd5b96999598505060200195606001359392505050565b60008083601f840112611cea57600080fd5b50813567ffffffffffffffff811115611d0257600080fd5b6020830191508360208260051b8501011115611d1d57600080fd5b9250929050565b600080600060408486031215611d3957600080fd5b83359250602084013567ffffffffffffffff811115611d5757600080fd5b611d6386828701611cd8565b9497909650939450505050565b60008060408385031215611d8357600080fd5b8235611d8e81611b64565b946020939093013593505050565b60008060008060008060c08789031215611db557600080fd5b863595506020870135611dc781611b64565b945060408701359350606087013592506080870135915060a087013560ff81168114611df257600080fd5b809150509295509295509295565b600080600080600080600080600060e08a8c031215611e1e57600080fd5b8935985060208a0135611e3081611b64565b975060408a0135611e4081611b64565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611e6b57600080fd5b611e778d838e01611cd8565b909650945060c08c0135915080821115611e9057600080fd5b50611e9d8c828d01611cd8565b915080935050809150509295985092959850929598565b60008060208385031215611ec757600080fd5b823567ffffffffffffffff811115611ede57600080fd5b611eea85828601611cd8565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f2a5788810183015185820160c001528201611f0e565b81811115611f3c57600060c083870101525b50601f01601f1916830160c0019150611f62905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611f9657600080fd5b823567ffffffffffffffff80821115611fae57600080fd5b611fba86838701611b79565b9350602091508185013581811115611fd157600080fd5b85019050601f81018613611fe457600080fd5b8035611ff2611b9a82611b40565b81815260059190911b8201830190838101908883111561201157600080fd5b928401925b8284101561203e578335801515811461202f5760008081fd5b82529284019290840190612016565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120a45783516001600160a01b03168352928401929184019160010161207f565b50909695505050505050565b600181811c908216806120c457607f821691505b602082108114156120e557634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c91508083168061210757607f831692505b602080841082141561212757634e487b7160e01b86526022600452602486fd5b81801561213b576001811461214c57612179565b60ff19861689528489019650612179565b60008c81526020902060005b868110156121715781548b820152908501908301612158565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156121ba576121ba612192565b500390565b600082198211156121d2576121d2612192565b50019056fea164736f6c6343000809000a", + "deployedBytecode": "0x60806040526004361061018f5760003560e01c806377cd38a4116100d65780638e2a3d361161007f578063c52164c611610059578063c52164c614610539578063d6e8b97314610559578063f7d0e04b1461057957600080fd5b80638e2a3d36146104c25780639872dbfe146104f357806398a268711461050957600080fd5b80638652b37e116100b05780638652b37e1461044a5780638da5cb5b1461046a5780638e2749d6146104a257600080fd5b806377cd38a4146103dd5780637f94f65d1461040a5780638642b5c31461042a57600080fd5b806336317972116101385780635fd8c710116101125780635fd8c7101461036857806369cc6af41461037d57806372fada5c146103bd57600080fd5b806336317972146102fd5780634b2ae9801461031d578063574983c81461034857600080fd5b806316d722401161016957806316d722401461021d57806329cc7d10146102c65780632dfdf0b5146102e657600080fd5b8063049373201461019b5780630d2a2d44146101db57806313af4035146101fd57600080fd5b3661019657005b600080fd5b3480156101a757600080fd5b506101c86101b6366004611ae0565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101e757600080fd5b506101fb6101f6366004611bed565b610599565b005b34801561020957600080fd5b506101fb610218366004611c2a565b61068a565b34801561022957600080fd5b50610282610238366004611ae0565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101d2565b3480156102d257600080fd5b506101c86102e1366004611c47565b61071e565b3480156102f257600080fd5b506003546101c89081565b34801561030957600080fd5b506101fb610318366004611d24565b6108fc565b34801561032957600080fd5b506101c8610338366004611c2a565b600c1b611000600160ac1b031690565b34801561035457600080fd5b506101fb610363366004611ae0565b6109bc565b34801561037457600080fd5b506101fb610a3a565b34801561038957600080fd5b506103ad610398366004611c2a565b600b6020526000908152604090205460ff1681565b60405190151581526020016101d2565b3480156103c957600080fd5b506101fb6103d8366004611ae0565b610ac4565b3480156103e957600080fd5b506101c86103f8366004611ae0565b600a6020526000908152604090205481565b34801561041657600080fd5b506101fb610425366004611d70565b610b4c565b34801561043657600080fd5b506101fb610445366004611d9c565b610b97565b34801561045657600080fd5b506101c8610465366004611e00565b610f65565b34801561047657600080fd5b5060005461048a906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b3480156104ae57600080fd5b506101fb6104bd366004611eb4565b6112a7565b3480156104ce57600080fd5b506104e26104dd366004611ae0565b6113ff565b6040516101d2959493929190611ef6565b3480156104ff57600080fd5b506101c860045481565b34801561051557600080fd5b506103ad610524366004611ae0565b60066020526000908152604090205460ff1681565b34801561054557600080fd5b5060025461048a906001600160a01b031681565b34801561056557600080fd5b506101fb610574366004611f83565b6114c9565b34801561058557600080fd5b506101fb610594366004611c2a565b6115a1565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b8082101561064e57600061062784848151811061060c5761060c61204d565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff191660019081179091559290920191506105ed565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d78160405161067f9190612063565b60405180910390a150565b6000546001600160a01b031633146106d35760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff1661075957604051630abc194760e11b815260040160405180910390fd5b610761611628565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506107d6611678565b83156107e6576107e63385610b4c565b6000838152600760209081526040909120825181558183015180518493610814926001850192910190611a47565b5060408201516002820180546001600160a01b039283166001600160a01b03199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff0000000000000000000000000000000000000000009095169190921617929092179091556108919080546001019055565b61089d8233308a6116a3565b6108a660018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b610904611678565b61090d8361173a565b61091782826112a7565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109475761094784610ac4565b600381015481546000835560028301546001600160a01b03928316926109709184911683611777565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a25050506109b760018055565b505050565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161067f91815260200190565b6000546001600160a01b03163314610a835760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b47610a8e3382611803565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d910161067f565b610acd8161173a565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b6001600160a01b038216331415610b7e57600c9190911b611000600160ac1b03166000908152600a6020526040902055565b6040516342e8fb9360e11b815260040160405180910390fd5b610b9f611678565b6000868152600860205260409020600381015443101580610bc257506002810154155b15610be0576040516331da482760e11b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c1092600186019290918b91016120eb565b604051602081830303815290604052805190602001209050600081604051602001610c6791907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cb557604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d299060019060a0016020604051602081039080840390855afa158015610d0d573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610d5b57604051632057875960e21b815260040160405180910390fd5b6003840154600186015460028701546001600160a01b0390921691600091610d82916121a8565b60006002890181905560038901819055868152600960205260409020805460ff191660011790556006880154909150336001600160a01b0390911614610e3d576001870154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610df39084906121bf565b909155505060028701546006880154600590600090600c1b611000600160ac1b031681526020019081526020016000206000828254610e3291906121bf565b90915550610e839050565b86600201548760010154610e5191906121bf565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e7d9084906121bf565b90915550505b6004870154610e9d9083906001600160a01b031683611777565b600187015415610f095760058701546001600160a01b038d8116911614610efa576005870154600180890154610ee29285926001600160a01b0390911691901c611777565b610ef5828d60018a60010154901c611777565b610f09565b610f09828d8960010154611777565b60048701546040518e81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a250505050505050610f5d60018055565b505050505050565b6000610f6f611678565b610f7983836112a7565b60008a81526007602052604090206003810154600160a01b900460ff16610fb357604051635972996f60e11b815260040160405180910390fd5b8054871115610fd5576040516308aeed0f60e21b815260040160405180910390fd5b610fe08b888c61185e565b915060006040518060e001604052808d81526020018a81526020018981526020016004544361100f91906121bf565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611150576002820154600c1b611000600160ac1b03166000908152600a60205260409020546110669088908890336118e2565b60008381526008602090815260408083208451815591840151600183015583015160028201556060830151600382015560808301516004820180546001600160a01b039283166001600160a01b03199182161790915560a085015160058401805491841691831691909117905560c0850151600690930180549390921692169190911790558254899184916110fc9084906121a8565b9091555050805160408051918252602082018a905284916001600160a01b038e16917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a35050611291565b611000600160ac1b0333600c1b166000908152600560205260408120549061117782611914565b9050808360400151111561119e57604051630e0c7c2360e11b815260040160405180910390fd5b60008581526008602090815260408083208651815591860151600183015585015160028201556060850151600382015560808501516004820180546001600160a01b039283166001600160a01b03199182161790915560a087015160058401805491841691831691909117905560c08701516006909301805493909216921691909117905584548b9186916112349084906121a8565b92505081905550848d6001600160a01b03167f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea85600001518d604051611284929190918252602082015260400190565b60405180910390a3505050505b61129a60018055565b9998505050505050505050565b6000815b808210156113e3576000600860008686868181106112cb576112cb61204d565b90506020020135815260200190815260200160002090506112eb816119d0565b60028101548154600090815260076020526040812080549091906113109084906121bf565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c6064811161136457600082815260056020526040902060649055611376565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff8888888181106113b7576113b761204d565b905060200201356040516113cd91815260200190565b60405180910390a28460010194505050506112ab565b808210156113f95763dfb035c96000526004601cfd5b50505050565b60076020526000908152604090208054600182018054919291611421906120b0565b80601f016020809104026020016040519081016040528092919081815260200182805461144d906120b0565b801561149a5780601f1061146f5761010080835404028352916020019161149a565b820191906000526020600020905b81548152906001019060200180831161147d57829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b031633146115125760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b8151806115275763df9578836000526004601cfd5b8151811461153d5763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f5d578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915061154c565b6000546001600160a01b031633146115ea5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200161067f565b600061163360035490565b600081815260076020526040902060030154909150600160a01b900460ff161515600114156116755760405163c44bd76560e01b815260040160405180910390fd5b90565b6001546002141561169c5760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806117335760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016105de565b5050505050565b6000818152600760205260409020600201546001600160a01b03163314611774576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113f95760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016105de565b600080600080600085875af19050806109b75760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016105de565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118db5760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118f78484846001600160a01b038516611a03565b6113f957604051631dc23a5f60e11b815260040160405180910390fd5b600080634d2b179160e01b8360405160240161193291815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826119c75763e10bf1cc6000526004601cfd5b50505050919050565b4381600301541015806119e557506002810154155b156117745760405163d0404f8560e01b815260040160405180910390fd5b60008315611a3f578360051b8501855b803580851160051b94855260209485185260406000209301818110611a3757611a3c565b611a13565b50505b501492915050565b828054611a53906120b0565b90600052602060002090601f016020900481019282611a755760008555611abb565b82601f10611a8e57805160ff1916838001178555611abb565b82800160010185558215611abb579182015b82811115611abb578251825591602001919060010190611aa0565b50611ac7929150611acb565b5090565b5b80821115611ac75760008155600101611acc565b600060208284031215611af257600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b3857611b38611af9565b604052919050565b600067ffffffffffffffff821115611b5a57611b5a611af9565b5060051b60200190565b6001600160a01b038116811461177457600080fd5b600082601f830112611b8a57600080fd5b81356020611b9f611b9a83611b40565b611b0f565b82815260059290921b84018101918181019086841115611bbe57600080fd5b8286015b84811015611be2578035611bd581611b64565b8352918301918301611bc2565b509695505050505050565b600060208284031215611bff57600080fd5b813567ffffffffffffffff811115611c1657600080fd5b611c2284828501611b79565b949350505050565b600060208284031215611c3c57600080fd5b81356118db81611b64565b600080600080600060808688031215611c5f57600080fd5b8535611c6a81611b64565b945060208601359350604086013567ffffffffffffffff80821115611c8e57600080fd5b818801915088601f830112611ca257600080fd5b813581811115611cb157600080fd5b896020828501011115611cc357600080fd5b96999598505060200195606001359392505050565b60008083601f840112611cea57600080fd5b50813567ffffffffffffffff811115611d0257600080fd5b6020830191508360208260051b8501011115611d1d57600080fd5b9250929050565b600080600060408486031215611d3957600080fd5b83359250602084013567ffffffffffffffff811115611d5757600080fd5b611d6386828701611cd8565b9497909650939450505050565b60008060408385031215611d8357600080fd5b8235611d8e81611b64565b946020939093013593505050565b60008060008060008060c08789031215611db557600080fd5b863595506020870135611dc781611b64565b945060408701359350606087013592506080870135915060a087013560ff81168114611df257600080fd5b809150509295509295509295565b600080600080600080600080600060e08a8c031215611e1e57600080fd5b8935985060208a0135611e3081611b64565b975060408a0135611e4081611b64565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611e6b57600080fd5b611e778d838e01611cd8565b909650945060c08c0135915080821115611e9057600080fd5b50611e9d8c828d01611cd8565b915080935050809150509295985092959850929598565b60008060208385031215611ec757600080fd5b823567ffffffffffffffff811115611ede57600080fd5b611eea85828601611cd8565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f2a5788810183015185820160c001528201611f0e565b81811115611f3c57600060c083870101525b50601f01601f1916830160c0019150611f62905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611f9657600080fd5b823567ffffffffffffffff80821115611fae57600080fd5b611fba86838701611b79565b9350602091508185013581811115611fd157600080fd5b85019050601f81018613611fe457600080fd5b8035611ff2611b9a82611b40565b81815260059190911b8201830190838101908883111561201157600080fd5b928401925b8284101561203e578335801515811461202f5760008081fd5b82529284019290840190612016565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120a45783516001600160a01b03168352928401929184019160010161207f565b50909695505050505050565b600181811c908216806120c457607f821691505b602082108114156120e557634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c91508083168061210757607f831692505b602080841082141561212757634e487b7160e01b86526022600452602486fd5b81801561213b576001811461214c57612179565b60ff19861689528489019650612179565b60008c81526020902060005b868110156121715781548b820152908501908301612158565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156121ba576121ba612192565b500390565b600082198211156121d2576121d2612192565b50019056fea164736f6c6343000809000a", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/contracts/DataTypes.sol b/contracts/DataTypes.sol index bee6deb..345301f 100644 --- a/contracts/DataTypes.sol +++ b/contracts/DataTypes.sol @@ -17,11 +17,11 @@ library DataTypes { struct Lock { uint256 depositID; /// @dev Amount to be paid for relayer. - uint256 relayerPremium; + uint256 relayerPremium; /// @dev Amount to be tranfered via PIX. - uint256 amount; + uint256 amount; /// @dev If not paid at this block will be expired. - uint256 expirationBlock; + uint256 expirationBlock; /// @dev Where the tokens are sent the when order gets validated. address buyerAddress; /// @dev Relayer's target address that receives `relayerPremium` funds. diff --git a/contracts/EventAndErrors.sol b/contracts/EventAndErrors.sol index b78a3fc..a9ee1f6 100644 --- a/contracts/EventAndErrors.sol +++ b/contracts/EventAndErrors.sol @@ -2,7 +2,6 @@ pragma solidity 0.8.9; interface EventAndErrors { - /// ███ Events ████████████████████████████████████████████████████████████ event DepositAdded( diff --git a/contracts/Reputation.sol b/contracts/Reputation.sol index d909c30..4f15579 100644 --- a/contracts/Reputation.sol +++ b/contracts/Reputation.sol @@ -5,41 +5,43 @@ import { IReputation } from "./lib/interfaces/IReputation.sol"; import { Owned } from "./lib/auth/Owned.sol"; import { FixedPointMathLib as WADMath } from "./lib/utils/FixedPointMathLib.sol"; +contract Reputation is IReputation, Owned(msg.sender) { + using WADMath for uint256; -contract Reputation is - IReputation, - Owned(msg.sender) -{ + /// @dev Asymptote numerator constant value for the `limiter` fx. + uint256 public constant maxLimit = 1e6; + /// @dev Denominator's constant operand for the `limiter` fx. + uint256 public constant magicValue = 2.5e11; - using WADMath for uint256; - - /// @dev Asymptote numerator constant value for the `limiter` fx. - uint256 constant public maxLimit = 1e6; - /// @dev Denominator's constant operand for the `limiter` fx. - uint256 constant public magicValue = 2.5e11; - - constructor(/* */) {/* */} - - function limiter(uint256 _userCredit) - external - pure - override(IReputation) - returns(uint256 _spendLimit) - { - // _spendLimit = 1 + ( ( maxLimit * _userCredit ) / sqrt( magicValue * ( _userCredit * _userCredit ) ) ); - // return _spendLimit; - - - unchecked { - uint256 numeratorWad = - maxLimit.mulWadDown(_userCredit); - uint256 userCreditSquaredWad = - _userCredit.mulWadDown(_userCredit); - uint256 denominatorSqrtWad = - (userCreditSquaredWad.mulWadDown(magicValue)).sqrt(); - - _spendLimit = (1 + (numeratorWad).divWadDown(denominatorSqrtWad)); + constructor() /* */ { + /* */ } - } + function limiter( + uint256 _userCredit + ) + external + pure + override(IReputation) + returns (uint256 _spendLimit) + { + // _spendLimit = 1 + ( ( maxLimit * _userCredit ) / sqrt( magicValue * ( _userCredit * _userCredit ) ) ); + // return _spendLimit; + + unchecked { + uint256 numeratorWad = maxLimit.mulWadDown( + _userCredit + ); + uint256 userCreditSquaredWad = _userCredit + .mulWadDown(_userCredit); + uint256 denominatorSqrtWad = ( + userCreditSquaredWad.mulWadDown(magicValue) + ).sqrt(); + + _spendLimit = (1 + + (numeratorWad).divWadDown( + denominatorSqrtWad + )); + } + } } diff --git a/contracts/lib/interfaces/IReputation.sol b/contracts/lib/interfaces/IReputation.sol index c68e320..8d2488f 100644 --- a/contracts/lib/interfaces/IReputation.sol +++ b/contracts/lib/interfaces/IReputation.sol @@ -1,12 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.4; - interface IReputation { - - function limiter(uint256 _userCredit) - external - pure - returns(uint256 _spendLimit); - + function limiter( + uint256 _userCredit + ) external pure returns (uint256 _spendLimit); } diff --git a/contracts/lib/utils/FixedPointMathLib.sol b/contracts/lib/utils/FixedPointMathLib.sol index aadbbe2..64b50c9 100644 --- a/contracts/lib/utils/FixedPointMathLib.sol +++ b/contracts/lib/utils/FixedPointMathLib.sol @@ -4,22 +4,27 @@ pragma solidity >=0.8.4; /// @notice Arithmetic library with operations for fixed-point numbers. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol) library FixedPointMathLib { - /*////////////////////////////////////////////////////////////// SIMPLIFIED FIXED POINT OPERATIONS //////////////////////////////////////////////////////////////*/ /// @dev The scalar of ETH and most ERC20s. - uint256 internal constant WAD = 1e18; + uint256 internal constant WAD = 1e18; - function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) { + function mulWadDown( + uint256 x, + uint256 y + ) internal pure returns (uint256) { // Equivalent to (x * y) / WAD rounded down. - return mulDivDown(x, y, WAD); + return mulDivDown(x, y, WAD); } - function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) { + function divWadDown( + uint256 x, + uint256 y + ) internal pure returns (uint256) { // Equivalent to (x * WAD) / y rounded down. - return mulDivDown(x, WAD, y); + return mulDivDown(x, WAD, y); } /*////////////////////////////////////////////////////////////// @@ -36,7 +41,12 @@ library FixedPointMathLib { z := mul(x, y) // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y)) - if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { + if iszero( + and( + iszero(iszero(denominator)), + or(iszero(x), eq(div(z, x), y)) + ) + ) { revert(0, 0) } @@ -49,7 +59,9 @@ library FixedPointMathLib { GENERAL NUMBER UTILITIES //////////////////////////////////////////////////////////////*/ - function sqrt(uint256 x) internal pure returns (uint256 z) { + function sqrt( + uint256 x + ) internal pure returns (uint256 z) { assembly { let y := x // We start y at x, which will help us make our initial estimate. @@ -60,7 +72,9 @@ library FixedPointMathLib { // We check y >= 2^(k + 8) but shift right by k bits // each branch to ensure that if x >= 256, then y >= 256. - if iszero(lt(y, 0x10000000000000000000000000000000000)) { + if iszero( + lt(y, 0x10000000000000000000000000000000000) + ) { y := shr(128, y) z := shl(64, z) } @@ -112,4 +126,4 @@ library FixedPointMathLib { z := sub(z, lt(div(x, z), z)) } } -} \ No newline at end of file +} diff --git a/contracts/lib/utils/MerkleProofLib.sol b/contracts/lib/utils/MerkleProofLib.sol index a91fdb9..2041b0e 100644 --- a/contracts/lib/utils/MerkleProofLib.sol +++ b/contracts/lib/utils/MerkleProofLib.sol @@ -2,42 +2,57 @@ pragma solidity >=0.8.4; /// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree. -/// @author Solady +/// @author Solady /// (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol) -/// @author Modified from Solmate +/// @author Modified from Solmate /// (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol) -/// @author Modified from OpenZeppelin +/// @author Modified from OpenZeppelin /// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol) library MerkleProofLib { /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`. - function verify(bytes32[] calldata proof, bytes32 root, bytes32 leaf) - internal - pure - returns (bool isValid) - { + function verify( + bytes32[] calldata proof, + bytes32 root, + bytes32 leaf + ) internal pure returns (bool isValid) { /// @solidity memory-safe-assembly assembly { if proof.length { // Left shift by 5 is equivalent to multiplying by 0x20. - let end := add(proof.offset, shl(5, proof.length)) + let end := add( + proof.offset, + shl(5, proof.length) + ) // Initialize `offset` to the offset of `proof` in the calldata. let offset := proof.offset // Iterate over proof elements to compute root hash. - for {} 1 {} { + for { + + } 1 { + + } { // Slot of `leaf` in scratch space. // If the condition is true: 0x20, otherwise: 0x00. - let scratch := shl(5, gt(leaf, calldataload(offset))) + let scratch := shl( + 5, + gt(leaf, calldataload(offset)) + ) // Store elements to hash contiguously in scratch space. // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes. mstore(scratch, leaf) - mstore(xor(scratch, 0x20), calldataload(offset)) + mstore( + xor(scratch, 0x20), + calldataload(offset) + ) // Reuse `leaf` to store the hash to reduce stack operations. leaf := keccak256(0x00, 0x40) offset := add(offset, 0x20) - if iszero(lt(offset, end)) { break } + if iszero(lt(offset, end)) { + break + } } } isValid := eq(leaf, root) } } -} \ No newline at end of file +} diff --git a/contracts/lib/utils/ReentrancyGuard.sol b/contracts/lib/utils/ReentrancyGuard.sol index 0e14c7b..24607ad 100644 --- a/contracts/lib/utils/ReentrancyGuard.sol +++ b/contracts/lib/utils/ReentrancyGuard.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity >=0.8.4; +pragma solidity >=0.8.4; /// @notice Reentrancy protection for smart contracts. /// @author z0r0z.eth @@ -31,4 +31,4 @@ abstract contract ReentrancyGuard { function clearReentrancyGuard() internal virtual { guard = 1; } -} \ No newline at end of file +} diff --git a/contracts/p2pix.sol b/contracts/p2pix.sol index d3255c6..03c35f2 100644 --- a/contracts/p2pix.sol +++ b/contracts/p2pix.sol @@ -82,12 +82,7 @@ contract P2PIX is uint256 _amount, string calldata _pixTarget, bytes32 allowlistRoot - ) - public - returns ( - uint256 depositID - ) - { + ) public returns (uint256 depositID) { ERC20 t = ERC20(_token); if (!allowedERC20s[t]) revert TokenDenied(); @@ -143,9 +138,9 @@ contract P2PIX is /// @notice Public method designed to lock an remaining amount of /// the deposit order of a seller. - /// @dev This method can be performed either by: + /// @dev This method can be performed either by: /// - An user allowed via the seller's allowlist; - /// - An user with enough userRecord to lock the wished amount; + /// - An user with enough userRecord to lock the wished amount; /// @dev There can only exist a lock per each `_amount` partitioned /// from the total `remaining` value. /// @dev Locks can only be performed in valid orders. @@ -153,7 +148,7 @@ contract P2PIX is /// @param _relayerTarget Target address entitled to the `relayerPremium`. /// @param _relayerPremium The refund/premium owed to a relayer. /// @param _amount The deposit's remaining amount wished to be locked. - /// @param merkleProof This value should be: + /// @param merkleProof This value should be: /// - Provided as a pass if the `msg.sender` is in the seller's allowlist; /// - Left empty otherwise; /// @param expiredLocks An array of `bytes32` identifiers to be @@ -211,8 +206,7 @@ contract P2PIX is // Halt execution and output `lockID`. return lockID; - } - else { + } else { uint256 userCredit = userRecord[ _castAddrToKey(msg.sender) ]; @@ -239,15 +233,15 @@ contract P2PIX is /// @notice Lock release method that liquidate lock /// orders and distributes relayer fees. - /// @dev This method can be called by any public actor + /// @dev This method can be called by any public actor /// as long the signature provided is valid. - /// @dev `relayerPremium` gets splitted equaly + /// @dev `relayerPremium` gets splitted equaly /// if `relayerTarget` addresses differ. /// @dev If the `msg.sender` of this method and `l.relayerAddress` are the same, /// `msg.sender` accrues both l.amount and l.relayerPremium as userRecord credit. /// In case of they differing: /// - `lock` caller gets accrued with `l.amount` as userRecord credit; - /// - `release` caller gets accrued with `l.relayerPremium` as userRecord credit; + /// - `release` caller gets accrued with `l.relayerPremium` as userRecord credit; /// @param _relayerTarget Target address entitled to the `relayerPremim`. /// @dev Function sighash: 0x4e1389ed. function release( @@ -342,12 +336,12 @@ contract P2PIX is /// @notice Unlocks expired locks. /// @dev Triggered in the callgraph by both `lock` and `withdraw` functions. /// @dev This method can also have any public actor as its `tx.origin`. - /// @dev For each successfull unexpired lock recovered, + /// @dev For each successfull unexpired lock recovered, /// `userRecord[_castAddrToKey(l.relayerAddress)]` is decreased by half of its value. /// @dev Function sighash: 0x8e2749d6. - function unlockExpired(bytes32[] calldata lockIDs) - public - { + function unlockExpired( + bytes32[] calldata lockIDs + ) public { uint256 i; uint256 locksSize = lockIDs.length; @@ -359,13 +353,14 @@ contract P2PIX is mapDeposits[l.depositID].remaining += l.amount; l.amount = 0; - uint256 userKey = - _castAddrToKey(l.relayerAddress); - uint256 _newUserRecord = - (userRecord[userKey] >> 1); + uint256 userKey = _castAddrToKey( + l.relayerAddress + ); + uint256 _newUserRecord = (userRecord[userKey] >> + 1); if (_newUserRecord <= 100) { - userRecord[userKey] = 100; + userRecord[userKey] = 100; } else { userRecord[userKey] = _newUserRecord; } @@ -414,9 +409,10 @@ contract P2PIX is emit DepositWithdrawn(msg.sender, depositID, amount); } - function setRoot(address addr, bytes32 merkleroot) - public - { + function setRoot( + address addr, + bytes32 merkleroot + ) public { if (addr == msg.sender) { sellerAllowList[ _castAddrToKey(addr) @@ -434,30 +430,27 @@ contract P2PIX is emit FundsWithdrawn(msg.sender, balance); } - function setReputation(IReputation _reputation) - public - onlyOwner - { + function setReputation( + IReputation _reputation + ) public onlyOwner { assembly { sstore(reputation.slot, _reputation) } emit ReputationUpdated(address(_reputation)); } - function setDefaultLockBlocks(uint256 _blocks) - public - onlyOwner - { + function setDefaultLockBlocks( + uint256 _blocks + ) public onlyOwner { assembly { sstore(defaultLockBlocks.slot, _blocks) } emit LockBlocksUpdated(_blocks); } - function setValidSigners(address[] memory _validSigners) - public - onlyOwner - { + function setValidSigners( + address[] memory _validSigners + ) public onlyOwner { unchecked { uint256 i; uint256 len = _validSigners.length; @@ -626,11 +619,9 @@ contract P2PIX is ) revert AddressDenied(); } - function _limiter(uint256 _userCredit) - internal - view - returns (uint256 _spendLimit) - { + function _limiter( + uint256 _userCredit + ) internal view returns (uint256 _spendLimit) { // enconde the fx sighash and args bytes memory encodedParams = abi.encodeWithSelector( IReputation.limiter.selector, @@ -670,11 +661,9 @@ contract P2PIX is /// @notice Public method that handles `address` /// to `uint256` safe type casting. /// @dev Function sighash: 0x4b2ae980. - function _castAddrToKey(address _addr) - public - pure - returns (uint256 _key) - { + function _castAddrToKey( + address _addr + ) public pure returns (uint256 _key) { _key = uint256(uint160(address(_addr))) << 12; } } diff --git a/deploys/localhost.json b/deploys/localhost.json index c4b2abc..fed3bbb 100644 --- a/deploys/localhost.json +++ b/deploys/localhost.json @@ -5,4 +5,4 @@ ], "p2pix": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee", "token": "0x5BdEa33E2D14E3D4C66f9A7bbbc38Cd785D0C592" -} \ No newline at end of file +} diff --git a/docs/DataTypes.md b/docs/DataTypes.md index 59667df..9c5f8d4 100644 --- a/docs/DataTypes.md +++ b/docs/DataTypes.md @@ -1,12 +1 @@ # DataTypes - - - - - - - - - - - diff --git a/docs/EventAndErrors.md b/docs/EventAndErrors.md index bda463d..ff543b2 100644 --- a/docs/EventAndErrors.md +++ b/docs/EventAndErrors.md @@ -1,14 +1,5 @@ # EventAndErrors - - - - - - - - - ## Events ### AllowedERC20Updated @@ -17,16 +8,12 @@ event AllowedERC20Updated(address indexed token, bool indexed state) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| token `indexed` | address | undefined | -| state `indexed` | bool | undefined | +| Name | Type | Description | +| --------------- | ------- | ----------- | +| token `indexed` | address | undefined | +| state `indexed` | bool | undefined | ### DepositAdded @@ -36,16 +23,14 @@ event DepositAdded(address indexed seller, uint256 depositID, address token, uin ███ Events ████████████████████████████████████████████████████████████ - - #### Parameters -| Name | Type | Description | -|---|---|---| -| seller `indexed` | address | undefined | -| depositID | uint256 | undefined | -| token | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ---------------- | ------- | ----------- | +| seller `indexed` | address | undefined | +| depositID | uint256 | undefined | +| token | address | undefined | +| amount | uint256 | undefined | ### DepositClosed @@ -53,16 +38,12 @@ event DepositAdded(address indexed seller, uint256 depositID, address token, uin event DepositClosed(address indexed seller, uint256 depositID) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| seller `indexed` | address | undefined | -| depositID | uint256 | undefined | +| Name | Type | Description | +| ---------------- | ------- | ----------- | +| seller `indexed` | address | undefined | +| depositID | uint256 | undefined | ### DepositWithdrawn @@ -70,17 +51,13 @@ event DepositClosed(address indexed seller, uint256 depositID) event DepositWithdrawn(address indexed seller, uint256 depositID, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| seller `indexed` | address | undefined | -| depositID | uint256 | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ---------------- | ------- | ----------- | +| seller `indexed` | address | undefined | +| depositID | uint256 | undefined | +| amount | uint256 | undefined | ### FundsWithdrawn @@ -88,16 +65,12 @@ event DepositWithdrawn(address indexed seller, uint256 depositID, uint256 amount event FundsWithdrawn(address owner, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| owner | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| owner | address | undefined | +| amount | uint256 | undefined | ### LockAdded @@ -105,18 +78,14 @@ event FundsWithdrawn(address owner, uint256 amount) event LockAdded(address indexed buyer, bytes32 indexed lockID, uint256 depositID, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| buyer `indexed` | address | undefined | -| lockID `indexed` | bytes32 | undefined | -| depositID | uint256 | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ---------------- | ------- | ----------- | +| buyer `indexed` | address | undefined | +| lockID `indexed` | bytes32 | undefined | +| depositID | uint256 | undefined | +| amount | uint256 | undefined | ### LockBlocksUpdated @@ -124,15 +93,11 @@ event LockAdded(address indexed buyer, bytes32 indexed lockID, uint256 depositID event LockBlocksUpdated(uint256 blocks) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| blocks | uint256 | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| blocks | uint256 | undefined | ### LockReleased @@ -140,16 +105,12 @@ event LockBlocksUpdated(uint256 blocks) event LockReleased(address indexed buyer, bytes32 lockId) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| buyer `indexed` | address | undefined | -| lockId | bytes32 | undefined | +| Name | Type | Description | +| --------------- | ------- | ----------- | +| buyer `indexed` | address | undefined | +| lockId | bytes32 | undefined | ### LockReturned @@ -157,16 +118,12 @@ event LockReleased(address indexed buyer, bytes32 lockId) event LockReturned(address indexed buyer, bytes32 lockId) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| buyer `indexed` | address | undefined | -| lockId | bytes32 | undefined | +| Name | Type | Description | +| --------------- | ------- | ----------- | +| buyer `indexed` | address | undefined | +| lockId | bytes32 | undefined | ### ReputationUpdated @@ -174,15 +131,11 @@ event LockReturned(address indexed buyer, bytes32 lockId) event ReputationUpdated(address reputation) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| reputation | address | undefined | +| Name | Type | Description | +| ---------- | ------- | ----------- | +| reputation | address | undefined | ### ValidSignersUpdated @@ -190,17 +143,11 @@ event ReputationUpdated(address reputation) event ValidSignersUpdated(address[] signers) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| signers | address[] | undefined | - - +| Name | Type | Description | +| ------- | --------- | ----------- | +| signers | address[] | undefined | ## Errors @@ -210,10 +157,7 @@ event ValidSignersUpdated(address[] signers) error AddressDenied() ``` - - -*Address doesn't exist in a MerkleTree.Address not allowed as relayer.0x3b8474be* - +_Address doesn't exist in a MerkleTree.Address not allowed as relayer.0x3b8474be_ ### AlreadyReleased @@ -221,10 +165,7 @@ error AddressDenied() error AlreadyReleased() ``` - - -*Lock already released or returned.0x63b4904e* - +_Lock already released or returned.0x63b4904e_ ### AmountNotAllowed @@ -232,10 +173,7 @@ error AlreadyReleased() error AmountNotAllowed() ``` - - -*Wished amount to be locked exceeds the limit allowed.0x1c18f846* - +_Wished amount to be locked exceeds the limit allowed.0x1c18f846_ ### DepositAlreadyExists @@ -243,10 +181,7 @@ error AmountNotAllowed() error DepositAlreadyExists() ``` - - -*Deposit already exist and it is still valid.0xc44bd765* - +_Deposit already exist and it is still valid.0xc44bd765_ ### InvalidDeposit @@ -254,10 +189,7 @@ error DepositAlreadyExists() error InvalidDeposit() ``` - - -*Deposit not valid anymore.0xb2e532de* - +_Deposit not valid anymore.0xb2e532de_ ### InvalidSigner @@ -265,10 +197,7 @@ error InvalidDeposit() error InvalidSigner() ``` - - -*Signer is not a valid signer.0x815e1d64* - +_Signer is not a valid signer.0x815e1d64_ ### LengthMismatch @@ -276,10 +205,7 @@ error InvalidSigner() error LengthMismatch() ``` - - -*Arrays' length don't match.0xff633a38* - +_Arrays' length don't match.0xff633a38_ ### LoopOverflow @@ -287,10 +213,7 @@ error LengthMismatch() error LoopOverflow() ``` - - -*Loop bounds have overflowed.0xdfb035c9* - +_Loop bounds have overflowed.0xdfb035c9_ ### NoTokens @@ -298,10 +221,7 @@ error LoopOverflow() error NoTokens() ``` - - -*No tokens array provided as argument.0xdf957883* - +_No tokens array provided as argument.0xdf957883_ ### NotEnoughTokens @@ -309,10 +229,7 @@ error NoTokens() error NotEnoughTokens() ``` - - -*Not enough token remaining on deposit.0x22bbb43c* - +_Not enough token remaining on deposit.0x22bbb43c_ ### NotExpired @@ -320,10 +237,7 @@ error NotEnoughTokens() error NotExpired() ``` - - -*Lock not expired or already released.Another lock with same ID is not expired yet.0xd0404f85* - +_Lock not expired or already released.Another lock with same ID is not expired yet.0xd0404f85_ ### OnlySeller @@ -331,10 +245,7 @@ error NotExpired() error OnlySeller() ``` - - -*Only seller could call this function.`msg.sender` and the seller differ.0x85d1f726* - +_Only seller could call this function.`msg.sender` and the seller differ.0x85d1f726_ ### TokenDenied @@ -342,10 +253,7 @@ error OnlySeller() error TokenDenied() ``` - - -*Token address not allowed to be deposited.0x1578328e* - +_Token address not allowed to be deposited.0x1578328e_ ### TxAlreadyUsed @@ -353,9 +261,4 @@ error TokenDenied() error TxAlreadyUsed() ``` - - -*Transaction already used to unlock payment.0xf490a6ea* - - - +_Transaction already used to unlock payment.0xf490a6ea_ diff --git a/docs/P2PIX.md b/docs/P2PIX.md index 519b7ee..0561a82 100644 --- a/docs/P2PIX.md +++ b/docs/P2PIX.md @@ -1,16 +1,8 @@ # P2PIX - - - - - - - - ## Methods -### _castAddrToKey +### \_castAddrToKey ```solidity function _castAddrToKey(address _addr) external pure returns (uint256 _key) @@ -18,19 +10,19 @@ function _castAddrToKey(address _addr) external pure returns (uint256 _key) Public method that handles `address` to `uint256` safe type casting. -*Function sighash: 0x4b2ae980.* +_Function sighash: 0x4b2ae980._ #### Parameters -| Name | Type | Description | -|---|---|---| -| _addr | address | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| \_addr | address | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _key | uint256 | undefined | +| Name | Type | Description | +| ----- | ------- | ----------- | +| \_key | uint256 | undefined | ### allowedERC20s @@ -38,21 +30,19 @@ Public method that handles `address` to `uint256` safe type casting. function allowedERC20s(contract ERC20) external view returns (bool) ``` - - -*Tokens allowed to serve as the underlying amount of a deposit.* +_Tokens allowed to serve as the underlying amount of a deposit._ #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | contract ERC20 | undefined | +| Name | Type | Description | +| ---- | -------------- | ----------- | +| \_0 | contract ERC20 | undefined | #### Returns | Name | Type | Description | -|---|---|---| -| _0 | bool | undefined | +| ---- | ---- | ----------- | +| \_0 | bool | undefined | ### cancelDeposit @@ -62,13 +52,13 @@ function cancelDeposit(uint256 depositID) external nonpayable Enables seller to invalidate future locks made to his/her token offering order. -*This function does not affect any ongoing active locks.Function sighash: 0x72fada5c.* +_This function does not affect any ongoing active locks.Function sighash: 0x72fada5c._ #### Parameters -| Name | Type | Description | -|---|---|---| -| depositID | uint256 | undefined | +| Name | Type | Description | +| --------- | ------- | ----------- | +| depositID | uint256 | undefined | ### defaultLockBlocks @@ -76,16 +66,13 @@ Enables seller to invalidate future locks made to his/her token offering order. function defaultLockBlocks() external view returns (uint256) ``` - - -*Default blocks that lock will hold tokens.* - +_Default blocks that lock will hold tokens._ #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### deposit @@ -95,21 +82,21 @@ function deposit(address _token, uint256 _amount, string _pixTarget, bytes32 all Creates a deposit order based on a seller's offer of an amount of ERC20 tokens. -*Seller needs to send his tokens to the P2PIX smart contract.Function sighash: 0xbfe07da6.* +_Seller needs to send his tokens to the P2PIX smart contract.Function sighash: 0xbfe07da6._ #### Parameters -| Name | Type | Description | -|---|---|---| -| _token | address | undefined | -| _amount | uint256 | undefined | -| _pixTarget | string | Pix key destination provided by the offer's seller. | -| allowlistRoot | bytes32 | Optional allow list merkleRoot update `bytes32` value. | +| Name | Type | Description | +| ------------- | ------- | ------------------------------------------------------- | +| \_token | address | undefined | +| \_amount | uint256 | undefined | +| \_pixTarget | string | Pix key destination provided by the offer's seller. | +| allowlistRoot | bytes32 | Optional allow list merkleRoot update `bytes32` value. | #### Returns -| Name | Type | Description | -|---|---|---| +| Name | Type | Description | +| --------- | ------- | -------------------------------------------------------------- | | depositID | uint256 | The `uint256` return value provided as the deposit identifier. | ### depositCount @@ -118,16 +105,11 @@ Creates a deposit order based on a seller's offer of an amount of ERC20 toke function depositCount() external view returns (uint256 _val) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _val | uint256 | undefined | +| Name | Type | Description | +| ----- | ------- | ----------- | +| \_val | uint256 | undefined | ### lock @@ -137,24 +119,24 @@ function lock(uint256 _depositID, address _buyerAddress, address _relayerTarget, Public method designed to lock an remaining amount of the deposit order of a seller. -*This method can be performed either by: - An user allowed via the seller's allowlist; - An user with enough userRecord to lock the wished amount; There can only exist a lock per each `_amount` partitioned from the total `remaining` value.Locks can only be performed in valid orders.Function sighash: 0x03aaf306.* +_This method can be performed either by: - An user allowed via the seller's allowlist; - An user with enough userRecord to lock the wished amount; There can only exist a lock per each `_amount` partitioned from the total `remaining` value.Locks can only be performed in valid orders.Function sighash: 0x03aaf306._ #### Parameters -| Name | Type | Description | -|---|---|---| -| _depositID | uint256 | undefined | -| _buyerAddress | address | The address of the buyer of a `_depositID`. | -| _relayerTarget | address | Target address entitled to the `relayerPremim`. | -| _relayerPremium | uint256 | The refund/premium owed to a relayer. | -| _amount | uint256 | The deposit's remaining amount wished to be locked. | -| merkleProof | bytes32[] | This value should be: - Provided as a pass if the `msg.sender` is in the seller's allowlist; - Left empty otherwise; | -| expiredLocks | bytes32[] | An array of `bytes32` identifiers to be provided so to unexpire locks using this transaction gas push. | +| Name | Type | Description | +| ---------------- | --------- | ------------------------------------------------------------------------------------------------------------------------ | +| \_depositID | uint256 | undefined | +| \_buyerAddress | address | The address of the buyer of a `_depositID`. | +| \_relayerTarget | address | Target address entitled to the `relayerPremim`. | +| \_relayerPremium | uint256 | The refund/premium owed to a relayer. | +| \_amount | uint256 | The deposit's remaining amount wished to be locked. | +| merkleProof | bytes32[] | This value should be: - Provided as a pass if the `msg.sender` is in the seller's allowlist; - Left empty otherwise; | +| expiredLocks | bytes32[] | An array of `bytes32` identifiers to be provided so to unexpire locks using this transaction gas push. | #### Returns -| Name | Type | Description | -|---|---|---| +| Name | Type | Description | +| ------ | ------- | ---------------------------------------------------- | | lockID | bytes32 | The `bytes32` value returned as the lock identifier. | ### mapDeposits @@ -163,25 +145,23 @@ Public method designed to lock an remaining amount of the deposit order of a sel function mapDeposits(uint256) external view returns (uint256 remaining, string pixTarget, address seller, address token, bool valid) ``` - - -*Seller list of deposits* +_Seller list of deposits_ #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| remaining | uint256 | undefined | -| pixTarget | string | undefined | -| seller | address | undefined | -| token | address | undefined | -| valid | bool | undefined | +| Name | Type | Description | +| --------- | ------- | ----------- | +| remaining | uint256 | undefined | +| pixTarget | string | undefined | +| seller | address | undefined | +| token | address | undefined | +| valid | bool | undefined | ### mapLocks @@ -189,27 +169,25 @@ function mapDeposits(uint256) external view returns (uint256 remaining, string p function mapLocks(bytes32) external view returns (uint256 depositID, uint256 relayerPremium, uint256 amount, uint256 expirationBlock, address buyerAddress, address relayerTarget, address relayerAddress) ``` - - -*List of Locks.* +_List of Locks._ #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | bytes32 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | bytes32 | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| depositID | uint256 | undefined | -| relayerPremium | uint256 | undefined | -| amount | uint256 | undefined | -| expirationBlock | uint256 | undefined | -| buyerAddress | address | undefined | -| relayerTarget | address | undefined | -| relayerAddress | address | undefined | +| Name | Type | Description | +| --------------- | ------- | ----------- | +| depositID | uint256 | undefined | +| relayerPremium | uint256 | undefined | +| amount | uint256 | undefined | +| expirationBlock | uint256 | undefined | +| buyerAddress | address | undefined | +| relayerTarget | address | undefined | +| relayerAddress | address | undefined | ### owner @@ -217,16 +195,11 @@ function mapLocks(bytes32) external view returns (uint256 depositID, uint256 rel function owner() external view returns (address) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | ### release @@ -236,18 +209,18 @@ function release(bytes32 lockID, address _relayerTarget, uint256 pixTimestamp, b Lock release method that liquidate lock orders and distributes relayer fees. -*This method can be called by any public actor as long the signature provided is valid.`relayerPremium` gets splitted equaly if `relayerTarget` addresses differ.If the `msg.sender` of this method and `l.relayerAddress` are the same, `msg.sender` accrues both l.amount and l.relayerPremium as userRecord credit. In case of they differing: - `lock` caller gets accrued with `l.amount` as userRecord credit; - `release` caller gets accrued with `l.relayerPremium` as userRecord credit; Function sighash: 0x4e1389ed.* +_This method can be called by any public actor as long the signature provided is valid.`relayerPremium` gets splitted equaly if `relayerTarget` addresses differ.If the `msg.sender` of this method and `l.relayerAddress` are the same, `msg.sender` accrues both l.amount and l.relayerPremium as userRecord credit. In case of they differing: - `lock` caller gets accrued with `l.amount` as userRecord credit; - `release` caller gets accrued with `l.relayerPremium` as userRecord credit; Function sighash: 0x4e1389ed._ #### Parameters -| Name | Type | Description | -|---|---|---| -| lockID | bytes32 | undefined | -| _relayerTarget | address | Target address entitled to the `relayerPremim`. | -| pixTimestamp | uint256 | undefined | -| r | bytes32 | undefined | -| s | bytes32 | undefined | -| v | uint8 | undefined | +| Name | Type | Description | +| --------------- | ------- | ----------------------------------------------- | +| lockID | bytes32 | undefined | +| \_relayerTarget | address | Target address entitled to the `relayerPremim`. | +| pixTimestamp | uint256 | undefined | +| r | bytes32 | undefined | +| s | bytes32 | undefined | +| v | uint8 | undefined | ### reputation @@ -257,14 +230,11 @@ function reputation() external view returns (contract IReputation) ███ Storage ████████████████████████████████████████████████████████████ - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | contract IReputation | undefined | +| Name | Type | Description | +| ---- | -------------------- | ----------- | +| \_0 | contract IReputation | undefined | ### sellerAllowList @@ -272,21 +242,19 @@ function reputation() external view returns (contract IReputation) function sellerAllowList(uint256) external view returns (bytes32) ``` - - -*Seller casted to key => Seller's allowlist merkleroot.* +_Seller casted to key => Seller's allowlist merkleroot._ #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | bytes32 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | bytes32 | undefined | ### setDefaultLockBlocks @@ -294,15 +262,11 @@ function sellerAllowList(uint256) external view returns (bytes32) function setDefaultLockBlocks(uint256 _blocks) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _blocks | uint256 | undefined | +| Name | Type | Description | +| -------- | ------- | ----------- | +| \_blocks | uint256 | undefined | ### setOwner @@ -310,15 +274,11 @@ function setDefaultLockBlocks(uint256 _blocks) external nonpayable function setOwner(address newOwner) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| newOwner | address | undefined | +| Name | Type | Description | +| -------- | ------- | ----------- | +| newOwner | address | undefined | ### setReputation @@ -326,15 +286,11 @@ function setOwner(address newOwner) external nonpayable function setReputation(contract IReputation _reputation) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _reputation | contract IReputation | undefined | +| Name | Type | Description | +| ------------ | -------------------- | ----------- | +| \_reputation | contract IReputation | undefined | ### setRoot @@ -342,16 +298,12 @@ function setReputation(contract IReputation _reputation) external nonpayable function setRoot(address addr, bytes32 merkleroot) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| addr | address | undefined | -| merkleroot | bytes32 | undefined | +| Name | Type | Description | +| ---------- | ------- | ----------- | +| addr | address | undefined | +| merkleroot | bytes32 | undefined | ### setValidSigners @@ -359,15 +311,11 @@ function setRoot(address addr, bytes32 merkleroot) external nonpayable function setValidSigners(address[] _validSigners) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _validSigners | address[] | undefined | +| Name | Type | Description | +| -------------- | --------- | ----------- | +| \_validSigners | address[] | undefined | ### tokenSettings @@ -375,16 +323,12 @@ function setValidSigners(address[] _validSigners) external nonpayable function tokenSettings(address[] _tokens, bool[] _states) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _tokens | address[] | undefined | -| _states | bool[] | undefined | +| Name | Type | Description | +| -------- | --------- | ----------- | +| \_tokens | address[] | undefined | +| \_states | bool[] | undefined | ### unlockExpired @@ -394,13 +338,13 @@ function unlockExpired(bytes32[] lockIDs) external nonpayable Unlocks expired locks. -*Triggered in the callgraph by both `lock` and `withdraw` functions.This method can also have any public actor as its `tx.origin`.For each successfull unexpired lock recovered, `userRecord[_castAddrToKey(l.relayerAddress)]` is decreased by half of its value.Function sighash: 0x8e2749d6.* +_Triggered in the callgraph by both `lock` and `withdraw` functions.This method can also have any public actor as its `tx.origin`.For each successfull unexpired lock recovered, `userRecord[_castAddrToKey(l.relayerAddress)]` is decreased by half of its value.Function sighash: 0x8e2749d6._ #### Parameters -| Name | Type | Description | -|---|---|---| -| lockIDs | bytes32[] | undefined | +| Name | Type | Description | +| ------- | --------- | ----------- | +| lockIDs | bytes32[] | undefined | ### userRecord @@ -408,21 +352,19 @@ Unlocks expired locks. function userRecord(uint256) external view returns (uint256) ``` - - -*Stores an relayer's last computed credit.* +_Stores an relayer's last computed credit._ #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### validBacenSigners @@ -430,21 +372,19 @@ function userRecord(uint256) external view returns (uint256) function validBacenSigners(uint256) external view returns (bool) ``` - - -*List of valid Bacen signature addresses* +_List of valid Bacen signature addresses_ #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | #### Returns | Name | Type | Description | -|---|---|---| -| _0 | bool | undefined | +| ---- | ---- | ----------- | +| \_0 | bool | undefined | ### withdraw @@ -454,14 +394,14 @@ function withdraw(uint256 depositID, bytes32[] expiredLocks) external nonpayable Seller's expired deposit fund sweeper. -*A seller may use this method to recover tokens from expired deposits.Function sighash: 0x36317972.* +_A seller may use this method to recover tokens from expired deposits.Function sighash: 0x36317972._ #### Parameters -| Name | Type | Description | -|---|---|---| -| depositID | uint256 | undefined | -| expiredLocks | bytes32[] | undefined | +| Name | Type | Description | +| ------------ | --------- | ----------- | +| depositID | uint256 | undefined | +| expiredLocks | bytes32[] | undefined | ### withdrawBalance @@ -469,12 +409,7 @@ Seller's expired deposit fund sweeper. function withdrawBalance() external nonpayable ``` - - -*Contract's underlying balance withdraw method.Function sighash: 0x5fd8c710.* - - - +_Contract's underlying balance withdraw method.Function sighash: 0x5fd8c710._ ## Events @@ -484,16 +419,12 @@ function withdrawBalance() external nonpayable event AllowedERC20Updated(address indexed token, bool indexed state) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| token `indexed` | address | undefined | -| state `indexed` | bool | undefined | +| Name | Type | Description | +| --------------- | ------- | ----------- | +| token `indexed` | address | undefined | +| state `indexed` | bool | undefined | ### DepositAdded @@ -503,16 +434,14 @@ event DepositAdded(address indexed seller, uint256 depositID, address token, uin ███ Events ████████████████████████████████████████████████████████████ - - #### Parameters -| Name | Type | Description | -|---|---|---| -| seller `indexed` | address | undefined | -| depositID | uint256 | undefined | -| token | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ---------------- | ------- | ----------- | +| seller `indexed` | address | undefined | +| depositID | uint256 | undefined | +| token | address | undefined | +| amount | uint256 | undefined | ### DepositClosed @@ -520,16 +449,12 @@ event DepositAdded(address indexed seller, uint256 depositID, address token, uin event DepositClosed(address indexed seller, uint256 depositID) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| seller `indexed` | address | undefined | -| depositID | uint256 | undefined | +| Name | Type | Description | +| ---------------- | ------- | ----------- | +| seller `indexed` | address | undefined | +| depositID | uint256 | undefined | ### DepositWithdrawn @@ -537,17 +462,13 @@ event DepositClosed(address indexed seller, uint256 depositID) event DepositWithdrawn(address indexed seller, uint256 depositID, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| seller `indexed` | address | undefined | -| depositID | uint256 | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ---------------- | ------- | ----------- | +| seller `indexed` | address | undefined | +| depositID | uint256 | undefined | +| amount | uint256 | undefined | ### FundsWithdrawn @@ -555,16 +476,12 @@ event DepositWithdrawn(address indexed seller, uint256 depositID, uint256 amount event FundsWithdrawn(address owner, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| owner | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| owner | address | undefined | +| amount | uint256 | undefined | ### LockAdded @@ -572,18 +489,14 @@ event FundsWithdrawn(address owner, uint256 amount) event LockAdded(address indexed buyer, bytes32 indexed lockID, uint256 depositID, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| buyer `indexed` | address | undefined | -| lockID `indexed` | bytes32 | undefined | -| depositID | uint256 | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ---------------- | ------- | ----------- | +| buyer `indexed` | address | undefined | +| lockID `indexed` | bytes32 | undefined | +| depositID | uint256 | undefined | +| amount | uint256 | undefined | ### LockBlocksUpdated @@ -591,15 +504,11 @@ event LockAdded(address indexed buyer, bytes32 indexed lockID, uint256 depositID event LockBlocksUpdated(uint256 blocks) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| blocks | uint256 | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| blocks | uint256 | undefined | ### LockReleased @@ -607,16 +516,12 @@ event LockBlocksUpdated(uint256 blocks) event LockReleased(address indexed buyer, bytes32 lockId) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| buyer `indexed` | address | undefined | -| lockId | bytes32 | undefined | +| Name | Type | Description | +| --------------- | ------- | ----------- | +| buyer `indexed` | address | undefined | +| lockId | bytes32 | undefined | ### LockReturned @@ -624,16 +529,12 @@ event LockReleased(address indexed buyer, bytes32 lockId) event LockReturned(address indexed buyer, bytes32 lockId) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| buyer `indexed` | address | undefined | -| lockId | bytes32 | undefined | +| Name | Type | Description | +| --------------- | ------- | ----------- | +| buyer `indexed` | address | undefined | +| lockId | bytes32 | undefined | ### OwnerUpdated @@ -641,16 +542,12 @@ event LockReturned(address indexed buyer, bytes32 lockId) event OwnerUpdated(address indexed user, address indexed newOwner) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| user `indexed` | address | undefined | -| newOwner `indexed` | address | undefined | +| Name | Type | Description | +| ------------------ | ------- | ----------- | +| user `indexed` | address | undefined | +| newOwner `indexed` | address | undefined | ### ReputationUpdated @@ -658,15 +555,11 @@ event OwnerUpdated(address indexed user, address indexed newOwner) event ReputationUpdated(address reputation) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| reputation | address | undefined | +| Name | Type | Description | +| ---------- | ------- | ----------- | +| reputation | address | undefined | ### ValidSignersUpdated @@ -674,17 +567,11 @@ event ReputationUpdated(address reputation) event ValidSignersUpdated(address[] signers) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| signers | address[] | undefined | - - +| Name | Type | Description | +| ------- | --------- | ----------- | +| signers | address[] | undefined | ## Errors @@ -694,10 +581,7 @@ event ValidSignersUpdated(address[] signers) error AddressDenied() ``` - - -*Address doesn't exist in a MerkleTree.Address not allowed as relayer.0x3b8474be* - +_Address doesn't exist in a MerkleTree.Address not allowed as relayer.0x3b8474be_ ### AlreadyReleased @@ -705,10 +589,7 @@ error AddressDenied() error AlreadyReleased() ``` - - -*Lock already released or returned.0x63b4904e* - +_Lock already released or returned.0x63b4904e_ ### AmountNotAllowed @@ -716,10 +597,7 @@ error AlreadyReleased() error AmountNotAllowed() ``` - - -*Wished amount to be locked exceeds the limit allowed.0x1c18f846* - +_Wished amount to be locked exceeds the limit allowed.0x1c18f846_ ### DepositAlreadyExists @@ -727,10 +605,7 @@ error AmountNotAllowed() error DepositAlreadyExists() ``` - - -*Deposit already exist and it is still valid.0xc44bd765* - +_Deposit already exist and it is still valid.0xc44bd765_ ### InvalidDeposit @@ -738,10 +613,7 @@ error DepositAlreadyExists() error InvalidDeposit() ``` - - -*Deposit not valid anymore.0xb2e532de* - +_Deposit not valid anymore.0xb2e532de_ ### InvalidSigner @@ -749,10 +621,7 @@ error InvalidDeposit() error InvalidSigner() ``` - - -*Signer is not a valid signer.0x815e1d64* - +_Signer is not a valid signer.0x815e1d64_ ### LengthMismatch @@ -760,10 +629,7 @@ error InvalidSigner() error LengthMismatch() ``` - - -*Arrays' length don't match.0xff633a38* - +_Arrays' length don't match.0xff633a38_ ### LoopOverflow @@ -771,10 +637,7 @@ error LengthMismatch() error LoopOverflow() ``` - - -*Loop bounds have overflowed.0xdfb035c9* - +_Loop bounds have overflowed.0xdfb035c9_ ### NoTokens @@ -782,10 +645,7 @@ error LoopOverflow() error NoTokens() ``` - - -*No tokens array provided as argument.0xdf957883* - +_No tokens array provided as argument.0xdf957883_ ### NotEnoughTokens @@ -793,10 +653,7 @@ error NoTokens() error NotEnoughTokens() ``` - - -*Not enough token remaining on deposit.0x22bbb43c* - +_Not enough token remaining on deposit.0x22bbb43c_ ### NotExpired @@ -804,10 +661,7 @@ error NotEnoughTokens() error NotExpired() ``` - - -*Lock not expired or already released.Another lock with same ID is not expired yet.0xd0404f85* - +_Lock not expired or already released.Another lock with same ID is not expired yet.0xd0404f85_ ### OnlySeller @@ -815,10 +669,7 @@ error NotExpired() error OnlySeller() ``` - - -*Only seller could call this function.`msg.sender` and the seller differ.0x85d1f726* - +_Only seller could call this function.`msg.sender` and the seller differ.0x85d1f726_ ### Reentrancy @@ -826,21 +677,13 @@ error OnlySeller() error Reentrancy() ``` - - - - - ### TokenDenied ```solidity error TokenDenied() ``` - - -*Token address not allowed to be deposited.0x1578328e* - +_Token address not allowed to be deposited.0x1578328e_ ### TxAlreadyUsed @@ -848,9 +691,4 @@ error TokenDenied() error TxAlreadyUsed() ``` - - -*Transaction already used to unlock payment.0xf490a6ea* - - - +_Transaction already used to unlock payment.0xf490a6ea_ diff --git a/docs/Reputation.md b/docs/Reputation.md index 03ebfea..866311a 100644 --- a/docs/Reputation.md +++ b/docs/Reputation.md @@ -1,13 +1,5 @@ # Reputation - - - - - - - - ## Methods ### limiter @@ -16,21 +8,17 @@ function limiter(uint256 _userCredit) external pure returns (uint256 _spendLimit) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _userCredit | uint256 | undefined | +| Name | Type | Description | +| ------------ | ------- | ----------- | +| \_userCredit | uint256 | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _spendLimit | uint256 | undefined | +| Name | Type | Description | +| ------------ | ------- | ----------- | +| \_spendLimit | uint256 | undefined | ### magicValue @@ -38,16 +26,13 @@ function limiter(uint256 _userCredit) external pure returns (uint256 _spendLimit function magicValue() external view returns (uint256) ``` - - -*Denominator's constant operand for the `limiter` fx. * - +_Denominator's constant operand for the `limiter` fx. _ #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### maxLimit @@ -55,16 +40,13 @@ function magicValue() external view returns (uint256) function maxLimit() external view returns (uint256) ``` - - -*Asymptote numerator constant value for the `limiter` fx.* - +_Asymptote numerator constant value for the `limiter` fx._ #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### owner @@ -72,16 +54,11 @@ function maxLimit() external view returns (uint256) function owner() external view returns (address) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | ### setOwner @@ -89,17 +66,11 @@ function owner() external view returns (address) function setOwner(address newOwner) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| newOwner | address | undefined | - - +| Name | Type | Description | +| -------- | ------- | ----------- | +| newOwner | address | undefined | ## Events @@ -109,16 +80,9 @@ function setOwner(address newOwner) external nonpayable event OwnerUpdated(address indexed user, address indexed newOwner) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| user `indexed` | address | undefined | -| newOwner `indexed` | address | undefined | - - - +| Name | Type | Description | +| ------------------ | ------- | ----------- | +| user `indexed` | address | undefined | +| newOwner `indexed` | address | undefined | diff --git a/docs/lib/auth/Owned.md b/docs/lib/auth/Owned.md index 0629a7a..6857e48 100644 --- a/docs/lib/auth/Owned.md +++ b/docs/lib/auth/Owned.md @@ -1,13 +1,9 @@ # Owned -*Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Owned.sol)* - - +_Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Owned.sol)_ Simple single owner authorization mixin. - - ## Methods ### owner @@ -16,16 +12,11 @@ Simple single owner authorization mixin. function owner() external view returns (address) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | ### setOwner @@ -33,17 +24,11 @@ function owner() external view returns (address) function setOwner(address newOwner) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| newOwner | address | undefined | - - +| Name | Type | Description | +| -------- | ------- | ----------- | +| newOwner | address | undefined | ## Events @@ -53,16 +38,9 @@ function setOwner(address newOwner) external nonpayable event OwnerUpdated(address indexed user, address indexed newOwner) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| user `indexed` | address | undefined | -| newOwner `indexed` | address | undefined | - - - +| Name | Type | Description | +| ------------------ | ------- | ----------- | +| user `indexed` | address | undefined | +| newOwner `indexed` | address | undefined | diff --git a/docs/lib/interfaces/IReputation.md b/docs/lib/interfaces/IReputation.md index 0cbce34..329640a 100644 --- a/docs/lib/interfaces/IReputation.md +++ b/docs/lib/interfaces/IReputation.md @@ -1,13 +1,5 @@ # IReputation - - - - - - - - ## Methods ### limiter @@ -16,22 +8,14 @@ function limiter(uint256 _userCredit) external pure returns (uint256 _spendLimit) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _userCredit | uint256 | undefined | +| Name | Type | Description | +| ------------ | ------- | ----------- | +| \_userCredit | uint256 | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _spendLimit | uint256 | undefined | - - - - +| Name | Type | Description | +| ------------ | ------- | ----------- | +| \_spendLimit | uint256 | undefined | diff --git a/docs/lib/mock/MockToken.md b/docs/lib/mock/MockToken.md index 7bc0c2e..49ef399 100644 --- a/docs/lib/mock/MockToken.md +++ b/docs/lib/mock/MockToken.md @@ -1,13 +1,5 @@ # MockToken - - - - - - - - ## Methods ### DOMAIN_SEPARATOR @@ -16,16 +8,11 @@ function DOMAIN_SEPARATOR() external view returns (bytes32) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | bytes32 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | bytes32 | undefined | ### allowance @@ -33,22 +20,18 @@ function DOMAIN_SEPARATOR() external view returns (bytes32) function allowance(address, address) external view returns (uint256) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | -| _1 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | +| \_1 | address | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### approve @@ -56,22 +39,18 @@ function allowance(address, address) external view returns (uint256) function approve(address spender, uint256 amount) external nonpayable returns (bool) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| spender | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ------- | ------- | ----------- | +| spender | address | undefined | +| amount | uint256 | undefined | #### Returns | Name | Type | Description | -|---|---|---| -| _0 | bool | undefined | +| ---- | ---- | ----------- | +| \_0 | bool | undefined | ### balanceOf @@ -79,21 +58,17 @@ function approve(address spender, uint256 amount) external nonpayable returns (b function balanceOf(address) external view returns (uint256) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### decimals @@ -101,16 +76,11 @@ function balanceOf(address) external view returns (uint256) function decimals() external view returns (uint8) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint8 | undefined | +| Name | Type | Description | +| ---- | ----- | ----------- | +| \_0 | uint8 | undefined | ### name @@ -118,16 +88,11 @@ function decimals() external view returns (uint8) function name() external view returns (string) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | string | undefined | +| Name | Type | Description | +| ---- | ------ | ----------- | +| \_0 | string | undefined | ### nonces @@ -135,21 +100,17 @@ function name() external view returns (string) function nonces(address) external view returns (uint256) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### permit @@ -157,21 +118,17 @@ function nonces(address) external view returns (uint256) function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| owner | address | undefined | -| spender | address | undefined | -| value | uint256 | undefined | -| deadline | uint256 | undefined | -| v | uint8 | undefined | -| r | bytes32 | undefined | -| s | bytes32 | undefined | +| Name | Type | Description | +| -------- | ------- | ----------- | +| owner | address | undefined | +| spender | address | undefined | +| value | uint256 | undefined | +| deadline | uint256 | undefined | +| v | uint8 | undefined | +| r | bytes32 | undefined | +| s | bytes32 | undefined | ### symbol @@ -179,16 +136,11 @@ function permit(address owner, address spender, uint256 value, uint256 deadline, function symbol() external view returns (string) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | string | undefined | +| Name | Type | Description | +| ---- | ------ | ----------- | +| \_0 | string | undefined | ### totalSupply @@ -196,16 +148,11 @@ function symbol() external view returns (string) function totalSupply() external view returns (uint256) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### transfer @@ -213,22 +160,18 @@ function totalSupply() external view returns (uint256) function transfer(address to, uint256 amount) external nonpayable returns (bool) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| to | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| to | address | undefined | +| amount | uint256 | undefined | #### Returns | Name | Type | Description | -|---|---|---| -| _0 | bool | undefined | +| ---- | ---- | ----------- | +| \_0 | bool | undefined | ### transferFrom @@ -236,25 +179,19 @@ function transfer(address to, uint256 amount) external nonpayable returns (bool) function transferFrom(address from, address to, uint256 amount) external nonpayable returns (bool) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| from | address | undefined | -| to | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| from | address | undefined | +| to | address | undefined | +| amount | uint256 | undefined | #### Returns | Name | Type | Description | -|---|---|---| -| _0 | bool | undefined | - - +| ---- | ---- | ----------- | +| \_0 | bool | undefined | ## Events @@ -264,17 +201,13 @@ function transferFrom(address from, address to, uint256 amount) external nonpaya event Approval(address indexed owner, address indexed spender, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| owner `indexed` | address | undefined | -| spender `indexed` | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ----------------- | ------- | ----------- | +| owner `indexed` | address | undefined | +| spender `indexed` | address | undefined | +| amount | uint256 | undefined | ### Transfer @@ -282,17 +215,10 @@ event Approval(address indexed owner, address indexed spender, uint256 amount) event Transfer(address indexed from, address indexed to, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| from `indexed` | address | undefined | -| to `indexed` | address | undefined | -| amount | uint256 | undefined | - - - +| Name | Type | Description | +| -------------- | ------- | ----------- | +| from `indexed` | address | undefined | +| to `indexed` | address | undefined | +| amount | uint256 | undefined | diff --git a/docs/lib/tokens/ERC20.md b/docs/lib/tokens/ERC20.md index 9ead6a7..6216aa8 100644 --- a/docs/lib/tokens/ERC20.md +++ b/docs/lib/tokens/ERC20.md @@ -1,12 +1,10 @@ # ERC20 -*Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)* - - +_Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)_ Modern and gas efficient ERC20 + EIP-2612 implementation. -*Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.* +_Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it._ ## Methods @@ -16,16 +14,11 @@ Modern and gas efficient ERC20 + EIP-2612 implementation. function DOMAIN_SEPARATOR() external view returns (bytes32) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | bytes32 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | bytes32 | undefined | ### allowance @@ -33,22 +26,18 @@ function DOMAIN_SEPARATOR() external view returns (bytes32) function allowance(address, address) external view returns (uint256) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | -| _1 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | +| \_1 | address | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### approve @@ -56,22 +45,18 @@ function allowance(address, address) external view returns (uint256) function approve(address spender, uint256 amount) external nonpayable returns (bool) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| spender | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ------- | ------- | ----------- | +| spender | address | undefined | +| amount | uint256 | undefined | #### Returns | Name | Type | Description | -|---|---|---| -| _0 | bool | undefined | +| ---- | ---- | ----------- | +| \_0 | bool | undefined | ### balanceOf @@ -79,21 +64,17 @@ function approve(address spender, uint256 amount) external nonpayable returns (b function balanceOf(address) external view returns (uint256) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### decimals @@ -101,16 +82,11 @@ function balanceOf(address) external view returns (uint256) function decimals() external view returns (uint8) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint8 | undefined | +| Name | Type | Description | +| ---- | ----- | ----------- | +| \_0 | uint8 | undefined | ### name @@ -118,16 +94,11 @@ function decimals() external view returns (uint8) function name() external view returns (string) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | string | undefined | +| Name | Type | Description | +| ---- | ------ | ----------- | +| \_0 | string | undefined | ### nonces @@ -135,21 +106,17 @@ function name() external view returns (string) function nonces(address) external view returns (uint256) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| _0 | address | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | address | undefined | #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### permit @@ -157,21 +124,17 @@ function nonces(address) external view returns (uint256) function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| owner | address | undefined | -| spender | address | undefined | -| value | uint256 | undefined | -| deadline | uint256 | undefined | -| v | uint8 | undefined | -| r | bytes32 | undefined | -| s | bytes32 | undefined | +| Name | Type | Description | +| -------- | ------- | ----------- | +| owner | address | undefined | +| spender | address | undefined | +| value | uint256 | undefined | +| deadline | uint256 | undefined | +| v | uint8 | undefined | +| r | bytes32 | undefined | +| s | bytes32 | undefined | ### symbol @@ -179,16 +142,11 @@ function permit(address owner, address spender, uint256 value, uint256 deadline, function symbol() external view returns (string) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | string | undefined | +| Name | Type | Description | +| ---- | ------ | ----------- | +| \_0 | string | undefined | ### totalSupply @@ -196,16 +154,11 @@ function symbol() external view returns (string) function totalSupply() external view returns (uint256) ``` - - - - - #### Returns -| Name | Type | Description | -|---|---|---| -| _0 | uint256 | undefined | +| Name | Type | Description | +| ---- | ------- | ----------- | +| \_0 | uint256 | undefined | ### transfer @@ -213,22 +166,18 @@ function totalSupply() external view returns (uint256) function transfer(address to, uint256 amount) external nonpayable returns (bool) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| to | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| to | address | undefined | +| amount | uint256 | undefined | #### Returns | Name | Type | Description | -|---|---|---| -| _0 | bool | undefined | +| ---- | ---- | ----------- | +| \_0 | bool | undefined | ### transferFrom @@ -236,25 +185,19 @@ function transfer(address to, uint256 amount) external nonpayable returns (bool) function transferFrom(address from, address to, uint256 amount) external nonpayable returns (bool) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| from | address | undefined | -| to | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ------ | ------- | ----------- | +| from | address | undefined | +| to | address | undefined | +| amount | uint256 | undefined | #### Returns | Name | Type | Description | -|---|---|---| -| _0 | bool | undefined | - - +| ---- | ---- | ----------- | +| \_0 | bool | undefined | ## Events @@ -264,17 +207,13 @@ function transferFrom(address from, address to, uint256 amount) external nonpaya event Approval(address indexed owner, address indexed spender, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| owner `indexed` | address | undefined | -| spender `indexed` | address | undefined | -| amount | uint256 | undefined | +| Name | Type | Description | +| ----------------- | ------- | ----------- | +| owner `indexed` | address | undefined | +| spender `indexed` | address | undefined | +| amount | uint256 | undefined | ### Transfer @@ -282,17 +221,10 @@ event Approval(address indexed owner, address indexed spender, uint256 amount) event Transfer(address indexed from, address indexed to, uint256 amount) ``` - - - - #### Parameters -| Name | Type | Description | -|---|---|---| -| from `indexed` | address | undefined | -| to `indexed` | address | undefined | -| amount | uint256 | undefined | - - - +| Name | Type | Description | +| -------------- | ------- | ----------- | +| from `indexed` | address | undefined | +| to `indexed` | address | undefined | +| amount | uint256 | undefined | diff --git a/docs/lib/utils/Counters.md b/docs/lib/utils/Counters.md index 30ca393..3b17675 100644 --- a/docs/lib/utils/Counters.md +++ b/docs/lib/utils/Counters.md @@ -1,14 +1,12 @@ # Counters -*buf0t9Modified from OpenZeppelin Contracts (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol)* +_buf0t9Modified from OpenZeppelin Contracts (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol)_ > Counters Provides counters that can only be incremented, decrementedor reset. -*Include with `using Counters for Counters.Counter;`* - - +_Include with `using Counters for Counters.Counter;`_ ## Errors @@ -18,9 +16,4 @@ Provides counters that can only be incremented, decrementedor reset. error DecOverflow() ``` - - -*0xce3a3d37* - - - +_0xce3a3d37_ diff --git a/docs/lib/utils/FixedPointMathLib.md b/docs/lib/utils/FixedPointMathLib.md index bdf17ae..ad5f3d7 100644 --- a/docs/lib/utils/FixedPointMathLib.md +++ b/docs/lib/utils/FixedPointMathLib.md @@ -1,12 +1,5 @@ # FixedPointMathLib -*Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)* - - +_Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)_ Arithmetic library with operations for fixed-point numbers. - - - - - diff --git a/docs/lib/utils/MerkleProofLib.md b/docs/lib/utils/MerkleProofLib.md index 8cf262e..2768596 100644 --- a/docs/lib/utils/MerkleProofLib.md +++ b/docs/lib/utils/MerkleProofLib.md @@ -1,12 +1,5 @@ # MerkleProofLib -*Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)* - - +_Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)_ Gas optimized verification of proof of inclusion for a leaf in a Merkle tree. - - - - - diff --git a/docs/lib/utils/ReentrancyGuard.md b/docs/lib/utils/ReentrancyGuard.md index 9143e78..26bf837 100644 --- a/docs/lib/utils/ReentrancyGuard.md +++ b/docs/lib/utils/ReentrancyGuard.md @@ -1,15 +1,9 @@ # ReentrancyGuard -*z0r0z.ethModified from Seaport (https://github.com/ProjectOpenSea/seaport/blob/main/contracts/lib/ReentrancyGuard.sol)Modified from Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/ReentrancyGuard.sol)* - - +_z0r0z.ethModified from Seaport (https://github.com/ProjectOpenSea/seaport/blob/main/contracts/lib/ReentrancyGuard.sol)Modified from Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/ReentrancyGuard.sol)_ Reentrancy protection for smart contracts. - - - - ## Errors ### Reentrancy @@ -17,10 +11,3 @@ Reentrancy protection for smart contracts. ```solidity error Reentrancy() ``` - - - - - - - diff --git a/docs/lib/utils/SafeTransferLib.md b/docs/lib/utils/SafeTransferLib.md index 464d256..454ca1c 100644 --- a/docs/lib/utils/SafeTransferLib.md +++ b/docs/lib/utils/SafeTransferLib.md @@ -1,12 +1,7 @@ # SafeTransferLib -*Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol)* - - +_Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol)_ Safe ETH and ERC20 transfer library that gracefully handles missing return values. -*Caution! This library won't check that a token has code, responsibility is delegated to the caller.* - - - +_Caution! This library won't check that a token has code, responsibility is delegated to the caller._ diff --git a/hardhat.config.ts b/hardhat.config.ts index a4f0b17..40c6b9a 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,12 +1,11 @@ import "@nomicfoundation/hardhat-chai-matchers"; import "@nomicfoundation/hardhat-toolbox"; import { config as dotenvConfig } from "dotenv"; +import "hardhat-tracer"; import { HardhatUserConfig } from "hardhat/config"; import { NetworkUserConfig } from "hardhat/types"; import { resolve } from "path"; -import "hardhat-tracer"; - dotenvConfig({ path: resolve(__dirname, "./.env") }); const mnemonic: string | undefined = process.env.MNEMONIC; diff --git a/scripts/1-deploy-p2pix.ts b/scripts/1-deploy-p2pix.ts index df92024..b549127 100644 --- a/scripts/1-deploy-p2pix.ts +++ b/scripts/1-deploy-p2pix.ts @@ -2,6 +2,7 @@ import "@nomiclabs/hardhat-ethers"; import "@nomiclabs/hardhat-etherscan"; import * as fs from "fs"; import { ethers, network } from "hardhat"; + // import hre from "hardhat"; interface Deploys { diff --git a/scripts/2-deploy-mockToken.ts b/scripts/2-deploy-mockToken.ts index f4723a8..d8d4cd8 100644 --- a/scripts/2-deploy-mockToken.ts +++ b/scripts/2-deploy-mockToken.ts @@ -3,6 +3,7 @@ import "@nomiclabs/hardhat-etherscan"; import { BigNumber } from "ethers"; import * as fs from "fs"; import { ethers, network } from "hardhat"; + // import hre from "hardhat"; interface Deploys { diff --git a/src/types/factories/EventAndErrors__factory.ts b/src/types/factories/EventAndErrors__factory.ts index 6c19178..c8a443a 100644 --- a/src/types/factories/EventAndErrors__factory.ts +++ b/src/types/factories/EventAndErrors__factory.ts @@ -70,6 +70,11 @@ const _abi = [ name: "OnlySeller", type: "error", }, + { + inputs: [], + name: "StaticCallFailed", + type: "error", + }, { inputs: [], name: "TokenDenied", diff --git a/src/types/factories/p2pix.sol/P2PIX__factory.ts b/src/types/factories/p2pix.sol/P2PIX__factory.ts index ac4c7b9..8d2d323 100644 --- a/src/types/factories/p2pix.sol/P2PIX__factory.ts +++ b/src/types/factories/p2pix.sol/P2PIX__factory.ts @@ -110,6 +110,11 @@ const _abi = [ name: "Reentrancy", type: "error", }, + { + inputs: [], + name: "StaticCallFailed", + type: "error", + }, { inputs: [], name: "TokenDenied", @@ -862,7 +867,7 @@ const _abi = [ ]; const _bytecode = - "0x608060405260018055604051620027f9380380620027f98339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600660205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083016020830282015b8083146200037f578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b6121c980620006306000396000f3fe60806040526004361061018f5760003560e01c806377cd38a4116100d65780638e2a3d361161007f578063c52164c611610059578063c52164c614610539578063d6e8b97314610559578063f7d0e04b1461057957600080fd5b80638e2a3d36146104c25780639872dbfe146104f357806398a268711461050957600080fd5b80638652b37e116100b05780638652b37e1461044a5780638da5cb5b1461046a5780638e2749d6146104a257600080fd5b806377cd38a4146103dd5780637f94f65d1461040a5780638642b5c31461042a57600080fd5b806336317972116101385780635fd8c710116101125780635fd8c7101461036857806369cc6af41461037d57806372fada5c146103bd57600080fd5b806336317972146102fd5780634b2ae9801461031d578063574983c81461034857600080fd5b806316d722401161016957806316d722401461021d57806329cc7d10146102c65780632dfdf0b5146102e657600080fd5b8063049373201461019b5780630d2a2d44146101db57806313af4035146101fd57600080fd5b3661019657005b600080fd5b3480156101a757600080fd5b506101c86101b6366004611ac5565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101e757600080fd5b506101fb6101f6366004611bd2565b610599565b005b34801561020957600080fd5b506101fb610218366004611c0f565b61068a565b34801561022957600080fd5b50610282610238366004611ac5565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101d2565b3480156102d257600080fd5b506101c86102e1366004611c2c565b61071e565b3480156102f257600080fd5b506003546101c89081565b34801561030957600080fd5b506101fb610318366004611d09565b6108fc565b34801561032957600080fd5b506101c8610338366004611c0f565b600c1b611000600160ac1b031690565b34801561035457600080fd5b506101fb610363366004611ac5565b6109bc565b34801561037457600080fd5b506101fb610a3a565b34801561038957600080fd5b506103ad610398366004611c0f565b600b6020526000908152604090205460ff1681565b60405190151581526020016101d2565b3480156103c957600080fd5b506101fb6103d8366004611ac5565b610ac4565b3480156103e957600080fd5b506101c86103f8366004611ac5565b600a6020526000908152604090205481565b34801561041657600080fd5b506101fb610425366004611d55565b610b4c565b34801561043657600080fd5b506101fb610445366004611d81565b610b97565b34801561045657600080fd5b506101c8610465366004611de5565b610f65565b34801561047657600080fd5b5060005461048a906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b3480156104ae57600080fd5b506101fb6104bd366004611e99565b6112a7565b3480156104ce57600080fd5b506104e26104dd366004611ac5565b6113ff565b6040516101d2959493929190611edb565b3480156104ff57600080fd5b506101c860045481565b34801561051557600080fd5b506103ad610524366004611ac5565b60066020526000908152604090205460ff1681565b34801561054557600080fd5b5060025461048a906001600160a01b031681565b34801561056557600080fd5b506101fb610574366004611f68565b6114c9565b34801561058557600080fd5b506101fb610594366004611c0f565b6115a1565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b8082101561064e57600061062784848151811061060c5761060c612032565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff191660019081179091559290920191506105ed565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d78160405161067f9190612048565b60405180910390a150565b6000546001600160a01b031633146106d35760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff1661075957604051630abc194760e11b815260040160405180910390fd5b610761611628565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506107d6611678565b83156107e6576107e63385610b4c565b6000838152600760209081526040909120825181558183015180518493610814926001850192910190611a2c565b5060408201516002820180546001600160a01b039283166001600160a01b03199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff0000000000000000000000000000000000000000009095169190921617929092179091556108919080546001019055565b61089d8233308a6116a3565b6108a660018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b610904611678565b61090d8361173a565b61091782826112a7565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109475761094784610ac4565b600381015481546000835560028301546001600160a01b03928316926109709184911683611777565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a25050506109b760018055565b505050565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161067f91815260200190565b6000546001600160a01b03163314610a835760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b47610a8e3382611803565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d910161067f565b610acd8161173a565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b6001600160a01b038216331415610b7e57600c9190911b611000600160ac1b03166000908152600a6020526040902055565b6040516342e8fb9360e11b815260040160405180910390fd5b610b9f611678565b6000868152600860205260409020600381015443101580610bc257506002810154155b15610be0576040516331da482760e11b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c1092600186019290918b91016120d0565b604051602081830303815290604052805190602001209050600081604051602001610c6791907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cb557604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d299060019060a0016020604051602081039080840390855afa158015610d0d573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610d5b57604051632057875960e21b815260040160405180910390fd5b6003840154600186015460028701546001600160a01b0390921691600091610d829161218d565b60006002890181905560038901819055868152600960205260409020805460ff191660011790556006880154909150336001600160a01b0390911614610e3d576001870154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610df39084906121a4565b909155505060028701546006880154600590600090600c1b611000600160ac1b031681526020019081526020016000206000828254610e3291906121a4565b90915550610e839050565b86600201548760010154610e5191906121a4565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e7d9084906121a4565b90915550505b6004870154610e9d9083906001600160a01b031683611777565b600187015415610f095760058701546001600160a01b038d8116911614610efa576005870154600180890154610ee29285926001600160a01b0390911691901c611777565b610ef5828d60018a60010154901c611777565b610f09565b610f09828d8960010154611777565b60048701546040518e81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a250505050505050610f5d60018055565b505050505050565b6000610f6f611678565b610f7983836112a7565b60008a81526007602052604090206003810154600160a01b900460ff16610fb357604051635972996f60e11b815260040160405180910390fd5b8054871115610fd5576040516308aeed0f60e21b815260040160405180910390fd5b610fe08b888c61185e565b915060006040518060e001604052808d81526020018a81526020018981526020016004544361100f91906121a4565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611150576002820154600c1b611000600160ac1b03166000908152600a60205260409020546110669088908890336118e2565b60008381526008602090815260408083208451815591840151600183015583015160028201556060830151600382015560808301516004820180546001600160a01b039283166001600160a01b03199182161790915560a085015160058401805491841691831691909117905560c0850151600690930180549390921692169190911790558254899184916110fc90849061218d565b9091555050805160408051918252602082018a905284916001600160a01b038e16917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a35050611291565b611000600160ac1b0333600c1b166000908152600560205260408120549061117782611914565b9050808360400151111561119e57604051630e0c7c2360e11b815260040160405180910390fd5b60008581526008602090815260408083208651815591860151600183015585015160028201556060850151600382015560808501516004820180546001600160a01b039283166001600160a01b03199182161790915560a087015160058401805491841691831691909117905560c08701516006909301805493909216921691909117905584548b91869161123490849061218d565b92505081905550848d6001600160a01b03167f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea85600001518d604051611284929190918252602082015260400190565b60405180910390a3505050505b61129a60018055565b9998505050505050505050565b6000815b808210156113e3576000600860008686868181106112cb576112cb612032565b90506020020135815260200190815260200160002090506112eb816119b5565b60028101548154600090815260076020526040812080549091906113109084906121a4565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c6064811161136457600082815260056020526040902060649055611376565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff8888888181106113b7576113b7612032565b905060200201356040516113cd91815260200190565b60405180910390a28460010194505050506112ab565b808210156113f95763dfb035c96000526004601cfd5b50505050565b6007602052600090815260409020805460018201805491929161142190612095565b80601f016020809104026020016040519081016040528092919081815260200182805461144d90612095565b801561149a5780601f1061146f5761010080835404028352916020019161149a565b820191906000526020600020905b81548152906001019060200180831161147d57829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b031633146115125760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b8151806115275763df9578836000526004601cfd5b8151811461153d5763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f5d578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915061154c565b6000546001600160a01b031633146115ea5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200161067f565b600061163360035490565b600081815260076020526040902060030154909150600160a01b900460ff161515600114156116755760405163c44bd76560e01b815260040160405180910390fd5b90565b6001546002141561169c5760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806117335760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016105de565b5050505050565b6000818152600760205260409020600201546001600160a01b03163314611774576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113f95760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016105de565b600080600080600085875af19050806109b75760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016105de565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118db5760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118f78484846001600160a01b0385166119e8565b6113f957604051631dc23a5f60e11b815260040160405180910390fd5b600080634d2b179160e01b8360405160240161193291815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa505060005195945050505050565b4381600301541015806119ca57506002810154155b156117745760405163d0404f8560e01b815260040160405180910390fd5b60008315611a24578360051b8501855b803580851160051b94855260209485185260406000209301818110611a1c57611a21565b6119f8565b50505b501492915050565b828054611a3890612095565b90600052602060002090601f016020900481019282611a5a5760008555611aa0565b82601f10611a7357805160ff1916838001178555611aa0565b82800160010185558215611aa0579182015b82811115611aa0578251825591602001919060010190611a85565b50611aac929150611ab0565b5090565b5b80821115611aac5760008155600101611ab1565b600060208284031215611ad757600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1d57611b1d611ade565b604052919050565b600067ffffffffffffffff821115611b3f57611b3f611ade565b5060051b60200190565b6001600160a01b038116811461177457600080fd5b600082601f830112611b6f57600080fd5b81356020611b84611b7f83611b25565b611af4565b82815260059290921b84018101918181019086841115611ba357600080fd5b8286015b84811015611bc7578035611bba81611b49565b8352918301918301611ba7565b509695505050505050565b600060208284031215611be457600080fd5b813567ffffffffffffffff811115611bfb57600080fd5b611c0784828501611b5e565b949350505050565b600060208284031215611c2157600080fd5b81356118db81611b49565b600080600080600060808688031215611c4457600080fd5b8535611c4f81611b49565b945060208601359350604086013567ffffffffffffffff80821115611c7357600080fd5b818801915088601f830112611c8757600080fd5b813581811115611c9657600080fd5b896020828501011115611ca857600080fd5b96999598505060200195606001359392505050565b60008083601f840112611ccf57600080fd5b50813567ffffffffffffffff811115611ce757600080fd5b6020830191508360208260051b8501011115611d0257600080fd5b9250929050565b600080600060408486031215611d1e57600080fd5b83359250602084013567ffffffffffffffff811115611d3c57600080fd5b611d4886828701611cbd565b9497909650939450505050565b60008060408385031215611d6857600080fd5b8235611d7381611b49565b946020939093013593505050565b60008060008060008060c08789031215611d9a57600080fd5b863595506020870135611dac81611b49565b945060408701359350606087013592506080870135915060a087013560ff81168114611dd757600080fd5b809150509295509295509295565b600080600080600080600080600060e08a8c031215611e0357600080fd5b8935985060208a0135611e1581611b49565b975060408a0135611e2581611b49565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611e5057600080fd5b611e5c8d838e01611cbd565b909650945060c08c0135915080821115611e7557600080fd5b50611e828c828d01611cbd565b915080935050809150509295985092959850929598565b60008060208385031215611eac57600080fd5b823567ffffffffffffffff811115611ec357600080fd5b611ecf85828601611cbd565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f0f5788810183015185820160c001528201611ef3565b81811115611f2157600060c083870101525b50601f01601f1916830160c0019150611f47905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611f7b57600080fd5b823567ffffffffffffffff80821115611f9357600080fd5b611f9f86838701611b5e565b9350602091508185013581811115611fb657600080fd5b85019050601f81018613611fc957600080fd5b8035611fd7611b7f82611b25565b81815260059190911b82018301908381019088831115611ff657600080fd5b928401925b8284101561202357833580151581146120145760008081fd5b82529284019290840190611ffb565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120895783516001600160a01b031683529284019291840191600101612064565b50909695505050505050565b600181811c908216806120a957607f821691505b602082108114156120ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c9150808316806120ec57607f831692505b602080841082141561210c57634e487b7160e01b86526022600452602486fd5b81801561212057600181146121315761215e565b60ff1986168952848901965061215e565b60008c81526020902060005b868110156121565781548b82015290850190830161213d565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561219f5761219f612177565b500390565b600082198211156121b7576121b7612177565b50019056fea164736f6c6343000809000a"; + "0x60806040526001805560405162002814380380620028148339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600660205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083016020830282015b8083146200037f578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b6121e480620006306000396000f3fe60806040526004361061018f5760003560e01c806377cd38a4116100d65780638e2a3d361161007f578063c52164c611610059578063c52164c614610539578063d6e8b97314610559578063f7d0e04b1461057957600080fd5b80638e2a3d36146104c25780639872dbfe146104f357806398a268711461050957600080fd5b80638652b37e116100b05780638652b37e1461044a5780638da5cb5b1461046a5780638e2749d6146104a257600080fd5b806377cd38a4146103dd5780637f94f65d1461040a5780638642b5c31461042a57600080fd5b806336317972116101385780635fd8c710116101125780635fd8c7101461036857806369cc6af41461037d57806372fada5c146103bd57600080fd5b806336317972146102fd5780634b2ae9801461031d578063574983c81461034857600080fd5b806316d722401161016957806316d722401461021d57806329cc7d10146102c65780632dfdf0b5146102e657600080fd5b8063049373201461019b5780630d2a2d44146101db57806313af4035146101fd57600080fd5b3661019657005b600080fd5b3480156101a757600080fd5b506101c86101b6366004611ae0565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101e757600080fd5b506101fb6101f6366004611bed565b610599565b005b34801561020957600080fd5b506101fb610218366004611c2a565b61068a565b34801561022957600080fd5b50610282610238366004611ae0565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101d2565b3480156102d257600080fd5b506101c86102e1366004611c47565b61071e565b3480156102f257600080fd5b506003546101c89081565b34801561030957600080fd5b506101fb610318366004611d24565b6108fc565b34801561032957600080fd5b506101c8610338366004611c2a565b600c1b611000600160ac1b031690565b34801561035457600080fd5b506101fb610363366004611ae0565b6109bc565b34801561037457600080fd5b506101fb610a3a565b34801561038957600080fd5b506103ad610398366004611c2a565b600b6020526000908152604090205460ff1681565b60405190151581526020016101d2565b3480156103c957600080fd5b506101fb6103d8366004611ae0565b610ac4565b3480156103e957600080fd5b506101c86103f8366004611ae0565b600a6020526000908152604090205481565b34801561041657600080fd5b506101fb610425366004611d70565b610b4c565b34801561043657600080fd5b506101fb610445366004611d9c565b610b97565b34801561045657600080fd5b506101c8610465366004611e00565b610f65565b34801561047657600080fd5b5060005461048a906001600160a01b031681565b6040516001600160a01b0390911681526020016101d2565b3480156104ae57600080fd5b506101fb6104bd366004611eb4565b6112a7565b3480156104ce57600080fd5b506104e26104dd366004611ae0565b6113ff565b6040516101d2959493929190611ef6565b3480156104ff57600080fd5b506101c860045481565b34801561051557600080fd5b506103ad610524366004611ae0565b60066020526000908152604090205460ff1681565b34801561054557600080fd5b5060025461048a906001600160a01b031681565b34801561056557600080fd5b506101fb610574366004611f83565b6114c9565b34801561058557600080fd5b506101fb610594366004611c2a565b6115a1565b6000546001600160a01b031633146105e75760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b8082101561064e57600061062784848151811061060c5761060c61204d565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff191660019081179091559290920191506105ed565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d78160405161067f9190612063565b60405180910390a150565b6000546001600160a01b031633146106d35760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff1661075957604051630abc194760e11b815260040160405180910390fd5b610761611628565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506107d6611678565b83156107e6576107e63385610b4c565b6000838152600760209081526040909120825181558183015180518493610814926001850192910190611a47565b5060408201516002820180546001600160a01b039283166001600160a01b03199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff0000000000000000000000000000000000000000009095169190921617929092179091556108919080546001019055565b61089d8233308a6116a3565b6108a660018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b610904611678565b61090d8361173a565b61091782826112a7565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109475761094784610ac4565b600381015481546000835560028301546001600160a01b03928316926109709184911683611777565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a25050506109b760018055565b505050565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161067f91815260200190565b6000546001600160a01b03163314610a835760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b47610a8e3382611803565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d910161067f565b610acd8161173a565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b6001600160a01b038216331415610b7e57600c9190911b611000600160ac1b03166000908152600a6020526040902055565b6040516342e8fb9360e11b815260040160405180910390fd5b610b9f611678565b6000868152600860205260409020600381015443101580610bc257506002810154155b15610be0576040516331da482760e11b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c1092600186019290918b91016120eb565b604051602081830303815290604052805190602001209050600081604051602001610c6791907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cb557604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d299060019060a0016020604051602081039080840390855afa158015610d0d573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610d5b57604051632057875960e21b815260040160405180910390fd5b6003840154600186015460028701546001600160a01b0390921691600091610d82916121a8565b60006002890181905560038901819055868152600960205260409020805460ff191660011790556006880154909150336001600160a01b0390911614610e3d576001870154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610df39084906121bf565b909155505060028701546006880154600590600090600c1b611000600160ac1b031681526020019081526020016000206000828254610e3291906121bf565b90915550610e839050565b86600201548760010154610e5191906121bf565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e7d9084906121bf565b90915550505b6004870154610e9d9083906001600160a01b031683611777565b600187015415610f095760058701546001600160a01b038d8116911614610efa576005870154600180890154610ee29285926001600160a01b0390911691901c611777565b610ef5828d60018a60010154901c611777565b610f09565b610f09828d8960010154611777565b60048701546040518e81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a250505050505050610f5d60018055565b505050505050565b6000610f6f611678565b610f7983836112a7565b60008a81526007602052604090206003810154600160a01b900460ff16610fb357604051635972996f60e11b815260040160405180910390fd5b8054871115610fd5576040516308aeed0f60e21b815260040160405180910390fd5b610fe08b888c61185e565b915060006040518060e001604052808d81526020018a81526020018981526020016004544361100f91906121bf565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611150576002820154600c1b611000600160ac1b03166000908152600a60205260409020546110669088908890336118e2565b60008381526008602090815260408083208451815591840151600183015583015160028201556060830151600382015560808301516004820180546001600160a01b039283166001600160a01b03199182161790915560a085015160058401805491841691831691909117905560c0850151600690930180549390921692169190911790558254899184916110fc9084906121a8565b9091555050805160408051918252602082018a905284916001600160a01b038e16917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a35050611291565b611000600160ac1b0333600c1b166000908152600560205260408120549061117782611914565b9050808360400151111561119e57604051630e0c7c2360e11b815260040160405180910390fd5b60008581526008602090815260408083208651815591860151600183015585015160028201556060850151600382015560808501516004820180546001600160a01b039283166001600160a01b03199182161790915560a087015160058401805491841691831691909117905560c08701516006909301805493909216921691909117905584548b9186916112349084906121a8565b92505081905550848d6001600160a01b03167f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea85600001518d604051611284929190918252602082015260400190565b60405180910390a3505050505b61129a60018055565b9998505050505050505050565b6000815b808210156113e3576000600860008686868181106112cb576112cb61204d565b90506020020135815260200190815260200160002090506112eb816119d0565b60028101548154600090815260076020526040812080549091906113109084906121bf565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c6064811161136457600082815260056020526040902060649055611376565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff8888888181106113b7576113b761204d565b905060200201356040516113cd91815260200190565b60405180910390a28460010194505050506112ab565b808210156113f95763dfb035c96000526004601cfd5b50505050565b60076020526000908152604090208054600182018054919291611421906120b0565b80601f016020809104026020016040519081016040528092919081815260200182805461144d906120b0565b801561149a5780601f1061146f5761010080835404028352916020019161149a565b820191906000526020600020905b81548152906001019060200180831161147d57829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b031633146115125760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b8151806115275763df9578836000526004601cfd5b8151811461153d5763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f5d578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915061154c565b6000546001600160a01b031633146115ea5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016105de565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200161067f565b600061163360035490565b600081815260076020526040902060030154909150600160a01b900460ff161515600114156116755760405163c44bd76560e01b815260040160405180910390fd5b90565b6001546002141561169c5760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806117335760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016105de565b5050505050565b6000818152600760205260409020600201546001600160a01b03163314611774576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113f95760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016105de565b600080600080600085875af19050806109b75760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016105de565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118db5760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118f78484846001600160a01b038516611a03565b6113f957604051631dc23a5f60e11b815260040160405180910390fd5b600080634d2b179160e01b8360405160240161193291815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826119c75763e10bf1cc6000526004601cfd5b50505050919050565b4381600301541015806119e557506002810154155b156117745760405163d0404f8560e01b815260040160405180910390fd5b60008315611a3f578360051b8501855b803580851160051b94855260209485185260406000209301818110611a3757611a3c565b611a13565b50505b501492915050565b828054611a53906120b0565b90600052602060002090601f016020900481019282611a755760008555611abb565b82601f10611a8e57805160ff1916838001178555611abb565b82800160010185558215611abb579182015b82811115611abb578251825591602001919060010190611aa0565b50611ac7929150611acb565b5090565b5b80821115611ac75760008155600101611acc565b600060208284031215611af257600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b3857611b38611af9565b604052919050565b600067ffffffffffffffff821115611b5a57611b5a611af9565b5060051b60200190565b6001600160a01b038116811461177457600080fd5b600082601f830112611b8a57600080fd5b81356020611b9f611b9a83611b40565b611b0f565b82815260059290921b84018101918181019086841115611bbe57600080fd5b8286015b84811015611be2578035611bd581611b64565b8352918301918301611bc2565b509695505050505050565b600060208284031215611bff57600080fd5b813567ffffffffffffffff811115611c1657600080fd5b611c2284828501611b79565b949350505050565b600060208284031215611c3c57600080fd5b81356118db81611b64565b600080600080600060808688031215611c5f57600080fd5b8535611c6a81611b64565b945060208601359350604086013567ffffffffffffffff80821115611c8e57600080fd5b818801915088601f830112611ca257600080fd5b813581811115611cb157600080fd5b896020828501011115611cc357600080fd5b96999598505060200195606001359392505050565b60008083601f840112611cea57600080fd5b50813567ffffffffffffffff811115611d0257600080fd5b6020830191508360208260051b8501011115611d1d57600080fd5b9250929050565b600080600060408486031215611d3957600080fd5b83359250602084013567ffffffffffffffff811115611d5757600080fd5b611d6386828701611cd8565b9497909650939450505050565b60008060408385031215611d8357600080fd5b8235611d8e81611b64565b946020939093013593505050565b60008060008060008060c08789031215611db557600080fd5b863595506020870135611dc781611b64565b945060408701359350606087013592506080870135915060a087013560ff81168114611df257600080fd5b809150509295509295509295565b600080600080600080600080600060e08a8c031215611e1e57600080fd5b8935985060208a0135611e3081611b64565b975060408a0135611e4081611b64565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611e6b57600080fd5b611e778d838e01611cd8565b909650945060c08c0135915080821115611e9057600080fd5b50611e9d8c828d01611cd8565b915080935050809150509295985092959850929598565b60008060208385031215611ec757600080fd5b823567ffffffffffffffff811115611ede57600080fd5b611eea85828601611cd8565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f2a5788810183015185820160c001528201611f0e565b81811115611f3c57600060c083870101525b50601f01601f1916830160c0019150611f62905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611f9657600080fd5b823567ffffffffffffffff80821115611fae57600080fd5b611fba86838701611b79565b9350602091508185013581811115611fd157600080fd5b85019050601f81018613611fe457600080fd5b8035611ff2611b9a82611b40565b81815260059190911b8201830190838101908883111561201157600080fd5b928401925b8284101561203e578335801515811461202f5760008081fd5b82529284019290840190612016565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120a45783516001600160a01b03168352928401929184019160010161207f565b50909695505050505050565b600181811c908216806120c457607f821691505b602082108114156120e557634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c91508083168061210757607f831692505b602080841082141561212757634e487b7160e01b86526022600452602486fd5b81801561213b576001811461214c57612179565b60ff19861689528489019650612179565b60008c81526020902060005b868110156121715781548b820152908501908301612158565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156121ba576121ba612192565b500390565b600082198211156121d2576121d2612192565b50019056fea164736f6c6343000809000a"; type P2PIXConstructorParams = | [signer?: Signer] diff --git a/test/1-deposit.test.ts b/test/1-deposit.test.ts index a60f0fc..8b3f3c8 100644 --- a/test/1-deposit.test.ts +++ b/test/1-deposit.test.ts @@ -38,7 +38,7 @@ // const ownerKey = await p2pix._castAddrToKey(owner.address); // const wallet2Key = await p2pix._castAddrToKey(wallet2.address); - + // // Verify values at deployment // expect( // await p2pix.callStatic.validBacenSigners(ownerKey), diff --git a/test/2-lock-release.test.ts b/test/2-lock-release.test.ts index 6928eb2..6a634eb 100644 --- a/test/2-lock-release.test.ts +++ b/test/2-lock-release.test.ts @@ -286,7 +286,7 @@ // p2pix.unlockExpired([lockID]), // ).to.be.revertedWithCustomError( // p2pix, P2PixErrors.NotExpired); - + // await network.provider.send("evm_mine"); // await network.provider.send("evm_mine"); // await network.provider.send("evm_mine"); @@ -302,4 +302,4 @@ // ).to.be.revertedWithCustomError( // p2pix, P2PixErrors.NotExpired); // }); -// }); \ No newline at end of file +// }); diff --git a/test/p2pix.test.ts b/test/p2pix.test.ts new file mode 100644 index 0000000..bfae0b3 --- /dev/null +++ b/test/p2pix.test.ts @@ -0,0 +1,149 @@ +import "@nomicfoundation/hardhat-chai-matchers"; +import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { BigNumber, Wallet } from "ethers"; +import { ethers, network } from "hardhat"; + +import { MockToken, P2PIX, Reputation } from "../src/types"; +import { P2PixErrors } from "./utils/errors"; +import { p2pixFixture } from "./utils/fixtures"; + +describe("P2PIX", () => { + type WalletWithAddress = Wallet & SignerWithAddress; + + // contract deployer/admin + let owner: WalletWithAddress; + + // extra EOAs + let acc01: WalletWithAddress; + let acc02: WalletWithAddress; + let acc03: WalletWithAddress; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let res: any; + + let p2pix: P2PIX; // Contract instance + let erc20: MockToken; // Token instance + let reputation: Reputation; // Reputation Interface instance; + + const fundAmount: BigNumber = + ethers.utils.parseEther("10000"); + const price: BigNumber = ethers.utils.parseEther("100"); + + const zero = ethers.constants.AddressZero; + + before("Set signers and reset network", async () => { + [owner, acc01, acc02, acc03] = + await // eslint-disable-next-line @typescript-eslint/no-explicit-any + (ethers as any).getSigners(); + + await network.provider.send("hardhat_reset"); + }); + beforeEach("Load deployment fixtures", async () => { + ({ erc20, p2pix, reputation } = await loadFixture( + p2pixFixture, + )); + }); + + describe("Init", async () => { + it("P2PIX, Reputation and ERC20 should initialize", async () => { + await p2pix.deployed(); + await erc20.deployed(); + await reputation.deployed(); + expect(p2pix).to.be.ok; + expect(erc20).to.be.ok; + expect(reputation).to.be.ok; + + const ownerKey = await p2pix._castAddrToKey( + owner.address, + ); + const acc01Key = await p2pix._castAddrToKey( + acc01.address, + ); + + // storage checks + expect( + await p2pix.callStatic.defaultLockBlocks(), + ).to.eq(4); + expect(await p2pix.callStatic.reputation()).to.eq( + reputation.address, + ); + expect(await p2pix.callStatic.depositCount()).to.eq(0); + expect( + await p2pix.callStatic.validBacenSigners(ownerKey), + ).to.eq(true); + expect( + await p2pix.callStatic.validBacenSigners(acc01Key), + ).to.eq(true); + expect( + await p2pix.callStatic.allowedERC20s(erc20.address), + ).to.eq(true); + + // event emission + await expect(await p2pix.deployTransaction) + .to.emit(p2pix, "OwnerUpdated") + .withArgs(zero, owner.address) + .and.to.emit(p2pix, "LockBlocksUpdated") + .withArgs(4) + .and.to.emit(p2pix, "ReputationUpdated") + .withArgs(reputation.address) + .and.to.emit(p2pix, "ValidSignersUpdated") + .withArgs([owner.address, acc01.address]) + .and.to.emit(p2pix, "AllowedERC20Updated") + .withArgs(erc20.address, true); + }); + + it("accounts have been funded", async () => { + // can't be eq to fundAmount due to contract deployment cost + res = await ethers.provider.getBalance(owner.address); + expect(res.toString()).to.have.lengthOf(22); + // console.log(res); // lengthOf = 22 + // console.log(fundAmount); // lengthOf = 23 + + // those should eq to hardhat prefunded account's value + expect( + await ethers.provider.getBalance(acc01.address), + ).to.eq(fundAmount); + expect( + await ethers.provider.getBalance(acc02.address), + ).to.eq(fundAmount); + expect( + await ethers.provider.getBalance(acc03.address), + ).to.eq(fundAmount); + }); + }); + + // each describe tests a set of functionalities of the contract's behavior + describe("Owner Functions", async () => { + it("should allow contract's balance withdraw", async () => { + const oldBal = await p2pix.provider.getBalance( + p2pix.address, + ); + const tx1 = await acc01.sendTransaction({ + to: p2pix.address, + value: price, + }); + const newBal = await p2pix.provider.getBalance( + p2pix.address, + ); + + expect(tx1).to.be.ok; + expect(oldBal).to.eq(0); + expect(newBal).to.eq(price); + + await expect( + p2pix.withdrawBalance(), + ).to.changeEtherBalances( + [owner.address, p2pix.address], + [price, "-100000000000000000000"], + ); + + await expect( + p2pix.connect(acc01).withdrawBalance(), + ).to.be.revertedWith( + P2PixErrors.UNAUTHORIZED, + ); + }); + }); +}); diff --git a/test/utils/errors.ts b/test/utils/errors.ts index 764a875..021a6f2 100644 --- a/test/utils/errors.ts +++ b/test/utils/errors.ts @@ -8,4 +8,5 @@ export enum P2PixErrors { AlreadyReleased = "AlreadyReleased", TxAlreadyUsed = "TxAlreadyUsed", InvalidSigner = "InvalidSigner", -} \ No newline at end of file + UNAUTHORIZED = "UNAUTHORIZED", +} diff --git a/test/utils/fixtures.ts b/test/utils/fixtures.ts new file mode 100644 index 0000000..55835c2 --- /dev/null +++ b/test/utils/fixtures.ts @@ -0,0 +1,82 @@ +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { Signer } from "ethers"; +import { ethers } from "hardhat"; + +// import keccak256 from "keccak256"; +// import { MerkleTree } from "merkletreejs"; +import { + MockToken, + P2PIX, + Reputation, +} from "../../src/types"; + +// exported interfaces +export interface P2pixFixture { + p2pix: P2PIX; + reputation: Reputation; + erc20: MockToken; + // proof: string[]; + // wrongProof: string[]; + // merkleRoot: string; +} + +// exported constants +export const getSignerAddrs = ( + amount: number, + addrs: SignerWithAddress[], +): string[] => { + const signers: string[] = []; + const buffr = addrs.slice(0, amount); + for (let i = 0; i < amount; i++) { + signers.push(buffr[i].address); + } + return signers; +}; +export const randomSigners = (amount: number): Signer[] => { + const signers: Signer[] = []; + for (let i = 0; i < amount; i++) { + signers.push(ethers.Wallet.createRandom()); + } + return signers; +}; +export const getError = (Error: string) => + ethers.utils + .keccak256(ethers.utils.toUtf8Bytes(Error)) + .slice(0, 10); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const padBuffer = (addr: any) => { + return Buffer.from( + addr.substr(2).padStart(32 * 2, 0), + "hex", + ); +}; + +// exported async functions +export async function p2pixFixture(): Promise { + const validSigners = getSignerAddrs( + 2, + await ethers.getSigners(), + ); + + const Reputation = await ethers.getContractFactory( + "Reputation", + ); + const reputation = + (await Reputation.deploy()) as Reputation; + + const ERC20 = await ethers.getContractFactory("MockToken"); + const erc20 = (await ERC20.deploy( + ethers.utils.parseEther("20000000"), // 20M + )) as MockToken; + + const P2PIX = await ethers.getContractFactory("P2PIX"); + const p2pix = (await P2PIX.deploy( + 4, + validSigners, + reputation.address, + [erc20.address], + [true], + )) as P2PIX; + + return { reputation, erc20, p2pix }; +} diff --git a/yarn.lock b/yarn.lock index a1e4441..d73d285 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3175,7 +3175,7 @@ __metadata: languageName: node linkType: hard -"bn.js@npm:^5.2.1": +"bn.js@npm:^5.2.0, bn.js@npm:^5.2.1": version: 5.2.1 resolution: "bn.js@npm:5.2.1" checksum: 3dd8c8d38055fedfa95c1d5fc3c99f8dd547b36287b37768db0abab3c239711f88ff58d18d155dd8ad902b0b0cee973747b7ae20ea12a09473272b0201c9edd3 @@ -3291,6 +3291,13 @@ __metadata: languageName: node linkType: hard +"buffer-reverse@npm:^1.0.1": + version: 1.0.1 + resolution: "buffer-reverse@npm:1.0.1" + checksum: e350872a89b17af0a7e1bd7a73239a535164f3f010b0800add44f2e52bd0511548dc5b96c20309effba969868c385023d2d02a0add6155f6a76da7b3073b77bd + languageName: node + linkType: hard + "buffer-xor@npm:^1.0.3": version: 1.0.3 resolution: "buffer-xor@npm:1.0.3" @@ -4146,6 +4153,13 @@ __metadata: languageName: node linkType: hard +"crypto-js@npm:^3.1.9-1": + version: 3.3.0 + resolution: "crypto-js@npm:3.3.0" + checksum: 193923143a4784b2f974366068d96fe8280168fd3fef2bfea9551a5c3e32096f5a8fa49ff4eeb5bd0b9716d325618d38cfbe6125e359a4ef488fbca93e600824 + languageName: node + linkType: hard + "cz-conventional-changelog@npm:3.2.0": version: 3.2.0 resolution: "cz-conventional-changelog@npm:3.2.0" @@ -5067,7 +5081,7 @@ __metadata: languageName: node linkType: hard -"ethers@npm:^5.7.2": +"ethers@npm:^5.6.1, ethers@npm:^5.7.2": version: 5.7.2 resolution: "ethers@npm:5.7.2" dependencies: @@ -6035,6 +6049,19 @@ fsevents@~2.1.1: languageName: node linkType: hard +"hardhat-tracer@npm:^1.2.0": + version: 1.2.0 + resolution: "hardhat-tracer@npm:1.2.0" + dependencies: + ethers: ^5.6.1 + peerDependencies: + chalk: 4.x + ethers: 5.x + hardhat: 2.x + checksum: 1d348fb3ed60cbde2287329730ccd37c73af80cc2cf4ccfb045f26af26c7efebd4a6fdf611035f34ca7fb75d0eb95985e8f5ed4f0537d2615fb6e126d1d035f0 + languageName: node + linkType: hard + "hardhat@npm:^2.12.2": version: 2.12.2 resolution: "hardhat@npm:2.12.2" @@ -7028,6 +7055,17 @@ fsevents@~2.1.1: languageName: node linkType: hard +"keccak256@npm:^1.0.6": + version: 1.0.6 + resolution: "keccak256@npm:1.0.6" + dependencies: + bn.js: ^5.2.0 + buffer: ^6.0.3 + keccak: ^3.0.2 + checksum: decafb4b37adcfa6d06b6a5d28546d0d7a9f01ccf4b8cc8963cf8188fcc79a230d7e22988e860813623c602d764259734423e38fd7b9aadfeb409d6928a1d4cf + languageName: node + linkType: hard + "keccak@npm:^3.0.0": version: 3.0.1 resolution: "keccak@npm:3.0.1" @@ -7456,6 +7494,19 @@ fsevents@~2.1.1: languageName: node linkType: hard +"merkletreejs@npm:^0.2.32": + version: 0.2.32 + resolution: "merkletreejs@npm:0.2.32" + dependencies: + bignumber.js: ^9.0.1 + buffer-reverse: ^1.0.1 + crypto-js: ^3.1.9-1 + treeify: ^1.1.0 + web3-utils: ^1.3.4 + checksum: 041b235adde94de584fdf5ef60138baca8d6f16bb48b3b7f714b607eaa76e4207ed5fef501ee5967371c56c5876804c4ff6da4705707f8cc0362d5c1e0358425 + languageName: node + linkType: hard + "micromatch@npm:^4.0.2, micromatch@npm:^4.0.4": version: 4.0.4 resolution: "micromatch@npm:4.0.4" @@ -8407,9 +8458,12 @@ fsevents@~2.1.1: fs-extra: ^10.1.0 hardhat: ^2.12.2 hardhat-gas-reporter: ^1.0.9 + hardhat-tracer: ^1.2.0 husky: ^8.0.1 + keccak256: ^1.0.6 lint-staged: ^13.0.3 lodash: ^4.17.21 + merkletreejs: ^0.2.32 mocha: ^10.1.0 pinst: ^3.0.0 prettier: ^2.7.1 @@ -10295,6 +10349,13 @@ resolve@1.17.0: languageName: node linkType: hard +"treeify@npm:^1.1.0": + version: 1.1.0 + resolution: "treeify@npm:1.1.0" + checksum: aa00dded220c1dd052573bd6fc2c52862f09870851a284f0d3650d72bf913ba9b4f6b824f4f1ab81899bae29375f4266b07fe47cbf82343a1efa13cc09ce87af + languageName: node + linkType: hard + "trim-newlines@npm:^3.0.0": version: 3.0.0 resolution: "trim-newlines@npm:3.0.0" @@ -10805,7 +10866,7 @@ resolve@1.17.0: languageName: node linkType: hard -"web3-utils@npm:^1.3.6": +"web3-utils@npm:^1.3.4, web3-utils@npm:^1.3.6": version: 1.8.1 resolution: "web3-utils@npm:1.8.1" dependencies: