From 0d612572c6e67e93c6ee087e77e9f35073ad95dd Mon Sep 17 00:00:00 2001 From: PedroCailleret Date: Tue, 20 Dec 2022 01:39:35 -0300 Subject: [PATCH 1/3] feat: :construction: Deposit struct replaced for packed uint --- .../DataTypes.sol/DataTypes.dbg.json | 2 +- .../EventAndErrors.dbg.json | 2 +- .../EventAndErrors.sol/EventAndErrors.json | 80 +- artifacts/contracts/p2pix.sol/P2PIX.dbg.json | 2 +- artifacts/contracts/p2pix.sol/P2PIX.json | 318 +- contracts/DataTypes.sol | 27 +- contracts/EventAndErrors.sol | 21 +- contracts/p2pix.sol | 458 ++- src/types/EventAndErrors.ts | 87 +- .../factories/EventAndErrors__factory.ts | 80 +- .../factories/p2pix.sol/P2PIX__factory.ts | 316 +- src/types/p2pix.sol/P2PIX.ts | 516 ++- test/Reputation.test.ts | 2 - test/p2pix.test.ts | 3558 ++++++++--------- 14 files changed, 3092 insertions(+), 2377 deletions(-) diff --git a/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json b/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json index 5e2cce7..e79a018 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../build-info/f807a312b7619f2547c334c76d81a8da.json" } diff --git a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json index 5e2cce7..e79a018 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../build-info/f807a312b7619f2547c334c76d81a8da.json" } diff --git a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json index 0679a99..a2428ef 100644 --- a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json +++ b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json @@ -18,11 +18,21 @@ "name": "AmountNotAllowed", "type": "error" }, + { + "inputs": [], + "name": "DecOverflow", + "type": "error" + }, { "inputs": [], "name": "DepositAlreadyExists", "type": "error" }, + { + "inputs": [], + "name": "EmptyPixTarget", + "type": "error" + }, { "inputs": [], "name": "InvalidDeposit", @@ -48,6 +58,11 @@ "name": "LoopOverflow", "type": "error" }, + { + "inputs": [], + "name": "MaxBalExceeded", + "type": "error" + }, { "inputs": [], "name": "NoTokens", @@ -63,6 +78,11 @@ "name": "NotExpired", "type": "error" }, + { + "inputs": [], + "name": "NotInitialized", + "type": "error" + }, { "inputs": [], "name": "OnlySeller", @@ -111,12 +131,6 @@ "name": "seller", "type": "address" }, - { - "indexed": false, - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - }, { "indexed": false, "internalType": "address", @@ -144,29 +158,10 @@ }, { "indexed": false, - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - } - ], - "name": "DepositClosed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, "internalType": "address", - "name": "seller", + "name": "token", "type": "address" }, - { - "indexed": false, - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - }, { "indexed": false, "internalType": "uint256", @@ -214,7 +209,7 @@ { "indexed": false, "internalType": "uint256", - "name": "depositID", + "name": "seller", "type": "uint256" }, { @@ -254,6 +249,12 @@ "internalType": "bytes32", "name": "lockId", "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], "name": "LockReleased", @@ -310,6 +311,31 @@ "name": "RootUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "ValidSet", + "type": "event" + }, { "anonymous": false, "inputs": [ diff --git a/artifacts/contracts/p2pix.sol/P2PIX.dbg.json b/artifacts/contracts/p2pix.sol/P2PIX.dbg.json index 0081d48..0df3fc6 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/948b888bf726ea051449ea823f31e46a.json" + "buildInfo": "../../build-info/a89635dd94b1e537327e1582c6d97eb3.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.json b/artifacts/contracts/p2pix.sol/P2PIX.json index e2d2365..1c83664 100644 --- a/artifacts/contracts/p2pix.sol/P2PIX.json +++ b/artifacts/contracts/p2pix.sol/P2PIX.json @@ -49,11 +49,21 @@ "name": "AmountNotAllowed", "type": "error" }, + { + "inputs": [], + "name": "DecOverflow", + "type": "error" + }, { "inputs": [], "name": "DepositAlreadyExists", "type": "error" }, + { + "inputs": [], + "name": "EmptyPixTarget", + "type": "error" + }, { "inputs": [], "name": "InvalidDeposit", @@ -79,6 +89,11 @@ "name": "LoopOverflow", "type": "error" }, + { + "inputs": [], + "name": "MaxBalExceeded", + "type": "error" + }, { "inputs": [], "name": "NoTokens", @@ -94,6 +109,11 @@ "name": "NotExpired", "type": "error" }, + { + "inputs": [], + "name": "NotInitialized", + "type": "error" + }, { "inputs": [], "name": "OnlySeller", @@ -147,12 +167,6 @@ "name": "seller", "type": "address" }, - { - "indexed": false, - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - }, { "indexed": false, "internalType": "address", @@ -180,29 +194,10 @@ }, { "indexed": false, - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - } - ], - "name": "DepositClosed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, "internalType": "address", - "name": "seller", + "name": "token", "type": "address" }, - { - "indexed": false, - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - }, { "indexed": false, "internalType": "uint256", @@ -250,7 +245,7 @@ { "indexed": false, "internalType": "uint256", - "name": "depositID", + "name": "seller", "type": "uint256" }, { @@ -290,6 +285,12 @@ "internalType": "bytes32", "name": "lockId", "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], "name": "LockReleased", @@ -365,6 +366,31 @@ "name": "RootUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "ValidSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -410,6 +436,25 @@ "stateMutability": "pure", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_key", + "type": "uint256" + } + ], + "name": "_castKeyToAddr", + "outputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, { "inputs": [ { @@ -429,19 +474,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - } - ], - "name": "cancelDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "defaultLockBlocks", @@ -463,14 +495,19 @@ "type": "address" }, { - "internalType": "uint256", + "internalType": "uint96", "name": "_amount", - "type": "uint256" + "type": "uint96" }, { - "internalType": "string", + "internalType": "uint160", "name": "_pixTarget", - "type": "string" + "type": "uint160" + }, + { + "internalType": "bool", + "name": "_valid", + "type": "bool" }, { "internalType": "bytes32", @@ -479,23 +516,28 @@ } ], "name": "deposit", - "outputs": [ - { - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - } - ], + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [], - "name": "depositCount", + "inputs": [ + { + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "internalType": "contract ERC20", + "name": "token", + "type": "address" + } + ], + "name": "getBalance", "outputs": [ { "internalType": "uint256", - "name": "_val", + "name": "bal", "type": "uint256" } ], @@ -505,9 +547,62 @@ { "inputs": [ { - "internalType": "uint256", - "name": "_depositID", - "type": "uint256" + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "internalType": "contract ERC20", + "name": "token", + "type": "address" + } + ], + "name": "getPixTarget", + "outputs": [ + { + "internalType": "uint160", + "name": "pixTarget", + "type": "uint160" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "internalType": "contract ERC20", + "name": "token", + "type": "address" + } + ], + "name": "getValid", + "outputs": [ + { + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_seller", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" }, { "internalType": "address", @@ -552,41 +647,15 @@ "type": "function" }, { - "inputs": [ + "inputs": [], + "name": "lockCounter", + "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], - "name": "mapDeposits", - "outputs": [ - { - "internalType": "uint256", - "name": "remaining", - "type": "uint256" - }, - { - "internalType": "string", - "name": "pixTarget", - "type": "string" - }, - { - "internalType": "address", - "name": "seller", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "bool", - "name": "valid", - "type": "bool" - } - ], "stateMutability": "view", "type": "function" }, @@ -602,7 +671,12 @@ "outputs": [ { "internalType": "uint256", - "name": "depositID", + "name": "sellerKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "counter", "type": "uint256" }, { @@ -620,6 +694,11 @@ "name": "expirationBlock", "type": "uint256" }, + { + "internalType": "uint160", + "name": "pixTarget", + "type": "uint160" + }, { "internalType": "address", "name": "buyerAddress", @@ -634,6 +713,11 @@ "internalType": "address", "name": "relayerAddress", "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" } ], "stateMutability": "view", @@ -722,6 +806,30 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "contract ERC20", + "name": "", + "type": "address" + } + ], + "name": "sellerBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -792,6 +900,24 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "contract ERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "setValidState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -883,9 +1009,9 @@ { "inputs": [ { - "internalType": "uint256", - "name": "depositID", - "type": "uint256" + "internalType": "contract ERC20", + "name": "token", + "type": "address" }, { "internalType": "bytes32[]", @@ -894,7 +1020,13 @@ } ], "name": "withdraw", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "_sellerBalance", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -910,8 +1042,8 @@ "type": "receive" } ], - "bytecode": "0x608060405260018055604051620028a1380380620028a18339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600660205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083016020830282015b8083146200037f578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b61227180620006306000396000f3fe6080604052600436106101a55760003560e01c806372fada5c116100e15780638e2749d61161008a57806398a268711161006457806398a268711461056b578063c52164c61461059b578063d6e8b973146105bb578063f7d0e04b146105db57600080fd5b80638e2749d6146105045780638e2a3d36146105245780639872dbfe1461055557600080fd5b80637f94f65d116100bb5780637f94f65d1461048c5780638652b37e146104ac5780638da5cb5b146104cc57600080fd5b806372fada5c1461041f578063758d77d41461043f57806377cd38a41461045f57600080fd5b8063363179721161014e578063574983c811610128578063574983c81461039e5780635fd8c710146103be57806369cc6af4146103d35780636a1460241461040357600080fd5b80633631797214610313578063461f3120146103335780634b2ae9801461037357600080fd5b806316d722401161017f57806316d722401461023357806329cc7d10146102dc5780632dfdf0b5146102fc57600080fd5b806304937320146101b15780630d2a2d44146101f157806313af40351461021357600080fd5b366101ac57005b600080fd5b3480156101bd57600080fd5b506101de6101cc366004611b2c565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004611c39565b6105fb565b005b34801561021f57600080fd5b5061021161022e366004611c76565b6106ec565b34801561023f57600080fd5b5061029861024e366004611b2c565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101e8565b3480156102e857600080fd5b506101de6102f7366004611c93565b61078d565b34801561030857600080fd5b506003546101de9081565b34801561031f57600080fd5b5061021161032e366004611d70565b610978565b34801561033f57600080fd5b5061036361034e366004611b2c565b60096020526000908152604090205460ff1681565b60405190151581526020016101e8565b34801561037f57600080fd5b506101de61038e366004611c76565b600c1b611000600160ac1b031690565b3480156103aa57600080fd5b506102116103b9366004611b2c565b610a38565b3480156103ca57600080fd5b50610211610ab6565b3480156103df57600080fd5b506103636103ee366004611c76565b600b6020526000908152604090205460ff1681565b34801561040f57600080fd5b506101de670de0b6b3a764000081565b34801561042b57600080fd5b5061021161043a366004611b2c565b610b40565b34801561044b57600080fd5b5061021161045a366004611dbc565b610bc8565b34801561046b57600080fd5b506101de61047a366004611b2c565b600a6020526000908152604090205481565b34801561049857600080fd5b506102116104a7366004611e20565b610f9e565b3480156104b857600080fd5b506101de6104c7366004611e4c565b611031565b3480156104d857600080fd5b506000546104ec906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b34801561051057600080fd5b5061021161051f366004611f00565b611211565b34801561053057600080fd5b5061054461053f366004611b2c565b611379565b6040516101e8959493929190611f42565b34801561056157600080fd5b506101de60045481565b34801561057757600080fd5b50610363610586366004611b2c565b60066020526000908152604090205460ff1681565b3480156105a757600080fd5b506002546104ec906001600160a01b031681565b3480156105c757600080fd5b506102116105d6366004611fcf565b611443565b3480156105e757600080fd5b506102116105f6366004611c76565b61151b565b6000546001600160a01b031633146106495760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156106b057600061068984848151811061066e5761066e612099565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff1916600190811790915592909201915061064f565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516106e191906120af565b60405180910390a150565b6000546001600160a01b031633146107355760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff166107c857604051630abc194760e11b815260040160405180910390fd5b6107d06115a2565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506108456115b2565b8315610855576108553385610f9e565b6000838152600760209081526040909120825181558183015180518493610883926001850192910190611a93565b5060408201516002820180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff00000000000000000000000000000000000000000090951691909216179290921790915561090d9080546001019055565b6109198233308a6115dd565b61092260018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b6109806115b2565b61098983611674565b6109938282611211565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109c3576109c384610b40565b600381015481546000835560028301546001600160a01b03928316926109ec91849116836116b1565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a2505050610a3360018055565b505050565b6000546001600160a01b03163314610a815760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516106e191815260200190565b6000546001600160a01b03163314610aff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b47610b0a338261173d565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91016106e1565b610b4981611674565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b610bd06115b2565b60008681526008602052604090206002810154610c00576040516331da482760e11b815260040160405180910390fd5b4381600301541015610c25576040516307b7d7dd60e51b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c5592600186019290918b9101612137565b604051602081830303815290604052805190602001209050600081604051602001610cac91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cfa57604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d6e9060019060a0016020604051602081039080840390855afa158015610d52573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610da057604051632057875960e21b815260040160405180910390fd5b6003840154600286015460018701546001600160a01b0390921691600090610dc890836121f4565b600060028a0181905560038a01819055878152600960205260409020805460ff191660011790556006890154909150336001600160a01b0390911614610e79576001880154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e3990849061220b565b90915550506006880154600c1b611000600160ac1b031660009081526005602052604081208054849290610e6e90849061220b565b90915550610ebb9050565b818860010154610e89919061220b565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610eb590849061220b565b90915550505b6004880154610ed59084906001600160a01b0316836116b1565b600188015415610f415760058801546001600160a01b038e8116911614610f325760058801546001808a0154610f1a9286926001600160a01b0390911691901c6116b1565b610f2d838e60018b60010154901c6116b1565b610f41565b610f41838e8a600101546116b1565b60048801546040518f81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a25050505050505050610f9660018055565b505050505050565b6001600160a01b03821633141561101857611000600160ac1b03600c83901b166000908152600a602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b600061103b6115b2565b6110458383611211565b60008a81526007602052604090206003810154600160a01b900460ff1661107f57604051635972996f60e11b815260040160405180910390fd5b80548711156110a1576040516308aeed0f60e21b815260040160405180910390fd5b6110ac8b888c611798565b915060006040518060e001604052808d81526020018a8152602001898152602001600454436110db919061220b565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611144576002820154600c1b611000600160ac1b03166000908152600a602052604090205461113290889088903361181c565b61113d83828461184e565b50506111fb565b68056bc75e2d631000008160400151116111635761113d83828461184e565b611000600160ac1b0333600c1b166000908152600560205260408120549061119b611196670de0b6b3a764000084612223565b61194c565b90506111af670de0b6b3a764000082612245565b836040015111806111cd575069d3c21bcecceda10000008360400151115b156111eb57604051630e0c7c2360e11b815260040160405180910390fd5b6111f685848661184e565b505050505b61120460018055565b9998505050505050505050565b6000815b8082101561135d5760006008600086868681811061123557611235612099565b905060200201358152602001908152602001600020905061125581611a08565b600281015481546000908152600760205260408120805490919061127a90849061220b565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c68056bc75e2d6310000081116112de57600082815260056020526040902068056bc75e2d6310000090556112f0565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff88888881811061133157611331612099565b9050602002013560405161134791815260200190565b60405180910390a2846001019450505050611215565b808210156113735763dfb035c96000526004601cfd5b50505050565b6007602052600090815260409020805460018201805491929161139b906120fc565b80601f01602080910402602001604051908101604052809291908181526020018280546113c7906120fc565b80156114145780601f106113e957610100808354040283529160200191611414565b820191906000526020600020905b8154815290600101906020018083116113f757829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b0316331461148c5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b8151806114a15763df9578836000526004601cfd5b815181146114b75763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f96578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a36020830192506020820191506114c6565b6000546001600160a01b031633146115645760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f906020016106e1565b60006115ad60035490565b905090565b600154600214156115d65760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d116001600051141617169150600060605280604052508061166d5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610640565b5050505050565b6000818152600760205260409020600201546001600160a01b031633146116ae576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113735760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610640565b600080600080600085875af1905080610a335760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610640565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118155760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118318484846001600160a01b038516611a4f565b61137357604051631dc23a5f60e11b815260040160405180910390fd5b600083815260086020908152604080832085518155918501516001830155840151600282018190556060850151600383015560808501516004830180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199182161790915560a087015160058501805491841691831691909117905560c087015160069094018054949092169316929092179091558254909183916118f49084906121f4565b9091555050608082015182516040808501518151928352602083015285926001600160a01b0316917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a3505050565b600080634d2b179160e01b8360405160240161196a91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826119ff5763e10bf1cc6000526004601cfd5b50505050919050565b4381600301541115611a2d5760405163d0404f8560e01b815260040160405180910390fd5b60028101546116ae576040516331da482760e11b815260040160405180910390fd5b60008315611a8b578360051b8501855b803580851160051b94855260209485185260406000209301818110611a8357611a88565b611a5f565b50505b501492915050565b828054611a9f906120fc565b90600052602060002090601f016020900481019282611ac15760008555611b07565b82601f10611ada57805160ff1916838001178555611b07565b82800160010185558215611b07579182015b82811115611b07578251825591602001919060010190611aec565b50611b13929150611b17565b5090565b5b80821115611b135760008155600101611b18565b600060208284031215611b3e57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b8457611b84611b45565b604052919050565b600067ffffffffffffffff821115611ba657611ba6611b45565b5060051b60200190565b6001600160a01b03811681146116ae57600080fd5b600082601f830112611bd657600080fd5b81356020611beb611be683611b8c565b611b5b565b82815260059290921b84018101918181019086841115611c0a57600080fd5b8286015b84811015611c2e578035611c2181611bb0565b8352918301918301611c0e565b509695505050505050565b600060208284031215611c4b57600080fd5b813567ffffffffffffffff811115611c6257600080fd5b611c6e84828501611bc5565b949350505050565b600060208284031215611c8857600080fd5b813561181581611bb0565b600080600080600060808688031215611cab57600080fd5b8535611cb681611bb0565b945060208601359350604086013567ffffffffffffffff80821115611cda57600080fd5b818801915088601f830112611cee57600080fd5b813581811115611cfd57600080fd5b896020828501011115611d0f57600080fd5b96999598505060200195606001359392505050565b60008083601f840112611d3657600080fd5b50813567ffffffffffffffff811115611d4e57600080fd5b6020830191508360208260051b8501011115611d6957600080fd5b9250929050565b600080600060408486031215611d8557600080fd5b83359250602084013567ffffffffffffffff811115611da357600080fd5b611daf86828701611d24565b9497909650939450505050565b60008060008060008060c08789031215611dd557600080fd5b863595506020870135611de781611bb0565b945060408701359350606087013592506080870135915060a087013560ff81168114611e1257600080fd5b809150509295509295509295565b60008060408385031215611e3357600080fd5b8235611e3e81611bb0565b946020939093013593505050565b600080600080600080600080600060e08a8c031215611e6a57600080fd5b8935985060208a0135611e7c81611bb0565b975060408a0135611e8c81611bb0565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611eb757600080fd5b611ec38d838e01611d24565b909650945060c08c0135915080821115611edc57600080fd5b50611ee98c828d01611d24565b915080935050809150509295985092959850929598565b60008060208385031215611f1357600080fd5b823567ffffffffffffffff811115611f2a57600080fd5b611f3685828601611d24565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f765788810183015185820160c001528201611f5a565b81811115611f8857600060c083870101525b50601f01601f1916830160c0019150611fae905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611fe257600080fd5b823567ffffffffffffffff80821115611ffa57600080fd5b61200686838701611bc5565b935060209150818501358181111561201d57600080fd5b85019050601f8101861361203057600080fd5b803561203e611be682611b8c565b81815260059190911b8201830190838101908883111561205d57600080fd5b928401925b8284101561208a578335801515811461207b5760008081fd5b82529284019290840190612062565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120f05783516001600160a01b0316835292840192918401916001016120cb565b50909695505050505050565b600181811c9082168061211057607f821691505b6020821081141561213157634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c91508083168061215357607f831692505b602080841082141561217357634e487b7160e01b86526022600452602486fd5b8180156121875760018114612198576121c5565b60ff198616895284890196506121c5565b60008c81526020902060005b868110156121bd5781548b8201529085019083016121a4565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b600082821015612206576122066121de565b500390565b6000821982111561221e5761221e6121de565b500190565b60008261224057634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561225f5761225f6121de565b50029056fea164736f6c6343000809000a", - "deployedBytecode": "0x6080604052600436106101a55760003560e01c806372fada5c116100e15780638e2749d61161008a57806398a268711161006457806398a268711461056b578063c52164c61461059b578063d6e8b973146105bb578063f7d0e04b146105db57600080fd5b80638e2749d6146105045780638e2a3d36146105245780639872dbfe1461055557600080fd5b80637f94f65d116100bb5780637f94f65d1461048c5780638652b37e146104ac5780638da5cb5b146104cc57600080fd5b806372fada5c1461041f578063758d77d41461043f57806377cd38a41461045f57600080fd5b8063363179721161014e578063574983c811610128578063574983c81461039e5780635fd8c710146103be57806369cc6af4146103d35780636a1460241461040357600080fd5b80633631797214610313578063461f3120146103335780634b2ae9801461037357600080fd5b806316d722401161017f57806316d722401461023357806329cc7d10146102dc5780632dfdf0b5146102fc57600080fd5b806304937320146101b15780630d2a2d44146101f157806313af40351461021357600080fd5b366101ac57005b600080fd5b3480156101bd57600080fd5b506101de6101cc366004611b2c565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004611c39565b6105fb565b005b34801561021f57600080fd5b5061021161022e366004611c76565b6106ec565b34801561023f57600080fd5b5061029861024e366004611b2c565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101e8565b3480156102e857600080fd5b506101de6102f7366004611c93565b61078d565b34801561030857600080fd5b506003546101de9081565b34801561031f57600080fd5b5061021161032e366004611d70565b610978565b34801561033f57600080fd5b5061036361034e366004611b2c565b60096020526000908152604090205460ff1681565b60405190151581526020016101e8565b34801561037f57600080fd5b506101de61038e366004611c76565b600c1b611000600160ac1b031690565b3480156103aa57600080fd5b506102116103b9366004611b2c565b610a38565b3480156103ca57600080fd5b50610211610ab6565b3480156103df57600080fd5b506103636103ee366004611c76565b600b6020526000908152604090205460ff1681565b34801561040f57600080fd5b506101de670de0b6b3a764000081565b34801561042b57600080fd5b5061021161043a366004611b2c565b610b40565b34801561044b57600080fd5b5061021161045a366004611dbc565b610bc8565b34801561046b57600080fd5b506101de61047a366004611b2c565b600a6020526000908152604090205481565b34801561049857600080fd5b506102116104a7366004611e20565b610f9e565b3480156104b857600080fd5b506101de6104c7366004611e4c565b611031565b3480156104d857600080fd5b506000546104ec906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b34801561051057600080fd5b5061021161051f366004611f00565b611211565b34801561053057600080fd5b5061054461053f366004611b2c565b611379565b6040516101e8959493929190611f42565b34801561056157600080fd5b506101de60045481565b34801561057757600080fd5b50610363610586366004611b2c565b60066020526000908152604090205460ff1681565b3480156105a757600080fd5b506002546104ec906001600160a01b031681565b3480156105c757600080fd5b506102116105d6366004611fcf565b611443565b3480156105e757600080fd5b506102116105f6366004611c76565b61151b565b6000546001600160a01b031633146106495760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156106b057600061068984848151811061066e5761066e612099565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff1916600190811790915592909201915061064f565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516106e191906120af565b60405180910390a150565b6000546001600160a01b031633146107355760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff166107c857604051630abc194760e11b815260040160405180910390fd5b6107d06115a2565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506108456115b2565b8315610855576108553385610f9e565b6000838152600760209081526040909120825181558183015180518493610883926001850192910190611a93565b5060408201516002820180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff00000000000000000000000000000000000000000090951691909216179290921790915561090d9080546001019055565b6109198233308a6115dd565b61092260018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b6109806115b2565b61098983611674565b6109938282611211565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109c3576109c384610b40565b600381015481546000835560028301546001600160a01b03928316926109ec91849116836116b1565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a2505050610a3360018055565b505050565b6000546001600160a01b03163314610a815760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516106e191815260200190565b6000546001600160a01b03163314610aff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b47610b0a338261173d565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91016106e1565b610b4981611674565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b610bd06115b2565b60008681526008602052604090206002810154610c00576040516331da482760e11b815260040160405180910390fd5b4381600301541015610c25576040516307b7d7dd60e51b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c5592600186019290918b9101612137565b604051602081830303815290604052805190602001209050600081604051602001610cac91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cfa57604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d6e9060019060a0016020604051602081039080840390855afa158015610d52573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610da057604051632057875960e21b815260040160405180910390fd5b6003840154600286015460018701546001600160a01b0390921691600090610dc890836121f4565b600060028a0181905560038a01819055878152600960205260409020805460ff191660011790556006890154909150336001600160a01b0390911614610e79576001880154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e3990849061220b565b90915550506006880154600c1b611000600160ac1b031660009081526005602052604081208054849290610e6e90849061220b565b90915550610ebb9050565b818860010154610e89919061220b565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610eb590849061220b565b90915550505b6004880154610ed59084906001600160a01b0316836116b1565b600188015415610f415760058801546001600160a01b038e8116911614610f325760058801546001808a0154610f1a9286926001600160a01b0390911691901c6116b1565b610f2d838e60018b60010154901c6116b1565b610f41565b610f41838e8a600101546116b1565b60048801546040518f81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a25050505050505050610f9660018055565b505050505050565b6001600160a01b03821633141561101857611000600160ac1b03600c83901b166000908152600a602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b600061103b6115b2565b6110458383611211565b60008a81526007602052604090206003810154600160a01b900460ff1661107f57604051635972996f60e11b815260040160405180910390fd5b80548711156110a1576040516308aeed0f60e21b815260040160405180910390fd5b6110ac8b888c611798565b915060006040518060e001604052808d81526020018a8152602001898152602001600454436110db919061220b565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611144576002820154600c1b611000600160ac1b03166000908152600a602052604090205461113290889088903361181c565b61113d83828461184e565b50506111fb565b68056bc75e2d631000008160400151116111635761113d83828461184e565b611000600160ac1b0333600c1b166000908152600560205260408120549061119b611196670de0b6b3a764000084612223565b61194c565b90506111af670de0b6b3a764000082612245565b836040015111806111cd575069d3c21bcecceda10000008360400151115b156111eb57604051630e0c7c2360e11b815260040160405180910390fd5b6111f685848661184e565b505050505b61120460018055565b9998505050505050505050565b6000815b8082101561135d5760006008600086868681811061123557611235612099565b905060200201358152602001908152602001600020905061125581611a08565b600281015481546000908152600760205260408120805490919061127a90849061220b565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c68056bc75e2d6310000081116112de57600082815260056020526040902068056bc75e2d6310000090556112f0565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff88888881811061133157611331612099565b9050602002013560405161134791815260200190565b60405180910390a2846001019450505050611215565b808210156113735763dfb035c96000526004601cfd5b50505050565b6007602052600090815260409020805460018201805491929161139b906120fc565b80601f01602080910402602001604051908101604052809291908181526020018280546113c7906120fc565b80156114145780601f106113e957610100808354040283529160200191611414565b820191906000526020600020905b8154815290600101906020018083116113f757829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b0316331461148c5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b8151806114a15763df9578836000526004601cfd5b815181146114b75763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f96578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a36020830192506020820191506114c6565b6000546001600160a01b031633146115645760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f906020016106e1565b60006115ad60035490565b905090565b600154600214156115d65760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d116001600051141617169150600060605280604052508061166d5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610640565b5050505050565b6000818152600760205260409020600201546001600160a01b031633146116ae576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113735760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610640565b600080600080600085875af1905080610a335760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610640565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118155760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118318484846001600160a01b038516611a4f565b61137357604051631dc23a5f60e11b815260040160405180910390fd5b600083815260086020908152604080832085518155918501516001830155840151600282018190556060850151600383015560808501516004830180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199182161790915560a087015160058501805491841691831691909117905560c087015160069094018054949092169316929092179091558254909183916118f49084906121f4565b9091555050608082015182516040808501518151928352602083015285926001600160a01b0316917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a3505050565b600080634d2b179160e01b8360405160240161196a91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826119ff5763e10bf1cc6000526004601cfd5b50505050919050565b4381600301541115611a2d5760405163d0404f8560e01b815260040160405180910390fd5b60028101546116ae576040516331da482760e11b815260040160405180910390fd5b60008315611a8b578360051b8501855b803580851160051b94855260209485185260406000209301818110611a8357611a88565b611a5f565b50505b501492915050565b828054611a9f906120fc565b90600052602060002090601f016020900481019282611ac15760008555611b07565b82601f10611ada57805160ff1916838001178555611b07565b82800160010185558215611b07579182015b82811115611b07578251825591602001919060010190611aec565b50611b13929150611b17565b5090565b5b80821115611b135760008155600101611b18565b600060208284031215611b3e57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b8457611b84611b45565b604052919050565b600067ffffffffffffffff821115611ba657611ba6611b45565b5060051b60200190565b6001600160a01b03811681146116ae57600080fd5b600082601f830112611bd657600080fd5b81356020611beb611be683611b8c565b611b5b565b82815260059290921b84018101918181019086841115611c0a57600080fd5b8286015b84811015611c2e578035611c2181611bb0565b8352918301918301611c0e565b509695505050505050565b600060208284031215611c4b57600080fd5b813567ffffffffffffffff811115611c6257600080fd5b611c6e84828501611bc5565b949350505050565b600060208284031215611c8857600080fd5b813561181581611bb0565b600080600080600060808688031215611cab57600080fd5b8535611cb681611bb0565b945060208601359350604086013567ffffffffffffffff80821115611cda57600080fd5b818801915088601f830112611cee57600080fd5b813581811115611cfd57600080fd5b896020828501011115611d0f57600080fd5b96999598505060200195606001359392505050565b60008083601f840112611d3657600080fd5b50813567ffffffffffffffff811115611d4e57600080fd5b6020830191508360208260051b8501011115611d6957600080fd5b9250929050565b600080600060408486031215611d8557600080fd5b83359250602084013567ffffffffffffffff811115611da357600080fd5b611daf86828701611d24565b9497909650939450505050565b60008060008060008060c08789031215611dd557600080fd5b863595506020870135611de781611bb0565b945060408701359350606087013592506080870135915060a087013560ff81168114611e1257600080fd5b809150509295509295509295565b60008060408385031215611e3357600080fd5b8235611e3e81611bb0565b946020939093013593505050565b600080600080600080600080600060e08a8c031215611e6a57600080fd5b8935985060208a0135611e7c81611bb0565b975060408a0135611e8c81611bb0565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611eb757600080fd5b611ec38d838e01611d24565b909650945060c08c0135915080821115611edc57600080fd5b50611ee98c828d01611d24565b915080935050809150509295985092959850929598565b60008060208385031215611f1357600080fd5b823567ffffffffffffffff811115611f2a57600080fd5b611f3685828601611d24565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f765788810183015185820160c001528201611f5a565b81811115611f8857600060c083870101525b50601f01601f1916830160c0019150611fae905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611fe257600080fd5b823567ffffffffffffffff80821115611ffa57600080fd5b61200686838701611bc5565b935060209150818501358181111561201d57600080fd5b85019050601f8101861361203057600080fd5b803561203e611be682611b8c565b81815260059190911b8201830190838101908883111561205d57600080fd5b928401925b8284101561208a578335801515811461207b5760008081fd5b82529284019290840190612062565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120f05783516001600160a01b0316835292840192918401916001016120cb565b50909695505050505050565b600181811c9082168061211057607f821691505b6020821081141561213157634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c91508083168061215357607f831692505b602080841082141561217357634e487b7160e01b86526022600452602486fd5b8180156121875760018114612198576121c5565b60ff198616895284890196506121c5565b60008c81526020902060005b868110156121bd5781548b8201529085019083016121a4565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b600082821015612206576122066121de565b500390565b6000821982111561221e5761221e6121de565b500190565b60008261224057634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561225f5761225f6121de565b50029056fea164736f6c6343000809000a", + "bytecode": "0x60806040526001805560405162002aa438038062002aa48339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b61247480620006306000396000f3fe6080604052600436106101d15760003560e01c80637f94f65d116100f75780639872dbfe11610095578063c52164c611610064578063c52164c6146106cc578063d4fac45d146106ec578063d6e8b9731461074b578063f7d0e04b1461076b57600080fd5b80639872dbfe146105fa57806398a26871146106105780639eee8d4b14610640578063ad8f2eed1461067857600080fd5b806385313e73116100d157806385313e73146105845780638da5cb5b146105a45780638db564c2146105c45780638e2749d6146105da57600080fd5b80637f94f65d146104d757806380e1d302146104f757806384ab1d281461054b57600080fd5b80634b2ae9801161016f5780636a1460241161013e5780636a1460241461044e5780636d82d9e01461046a578063758d77d41461048a57806377cd38a4146104aa57600080fd5b80634b2ae980146103be578063574983c8146103e95780635fd8c7101461040957806369cc6af41461041e57600080fd5b806316d72240116101ab57806316d722401461025f5780632b9f00e91461033e578063328a71811461035e578063461f31201461037e57600080fd5b806304937320146101dd5780630d2a2d441461021d57806313af40351461023f57600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b5061020a6101f8366004611ddb565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561022957600080fd5b5061023d610238366004611ee8565b61078b565b005b34801561024b57600080fd5b5061023d61025a366004611f25565b61087c565b34801561026b57600080fd5b506102df61027a366004611ddb565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009909801549698959794969395946001600160a01b0393841694928416939182169290821691168a565b604080519a8b5260208b019990995297890196909652606088019490945260808701929092526001600160a01b0390811660a087015290811660c086015290811660e08501529081166101008401521661012082015261014001610214565b34801561034a57600080fd5b5061020a610359366004611f8e565b61091d565b34801561036a57600080fd5b5061023d610379366004612074565b610c90565b34801561038a57600080fd5b506103ae610399366004611ddb565b60096020526000908152604090205460ff1681565b6040519015158152602001610214565b3480156103ca57600080fd5b5061020a6103d9366004611f25565b600c1b611000600160ac1b031690565b3480156103f557600080fd5b5061023d610404366004611ddb565b610e4f565b34801561041557600080fd5b5061023d610ecd565b34801561042a57600080fd5b506103ae610439366004611f25565b600a6020526000908152604090205460ff1681565b34801561045a57600080fd5b5061020a670de0b6b3a764000081565b34801561047657600080fd5b5061023d6104853660046120e7565b610f57565b34801561049657600080fd5b5061023d6104a536600461211c565b611045565b3480156104b657600080fd5b5061020a6104c5366004611ddb565b60066020526000908152604090205481565b3480156104e357600080fd5b5061023d6104f2366004612180565b611429565b34801561050357600080fd5b506103ae6105123660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b039094168352929052205460ff1c90565b34801561055757600080fd5b5061056c610566366004611ddb565b600c1c90565b6040516001600160a01b039091168152602001610214565b34801561059057600080fd5b5061020a61059f3660046121e5565b6114bc565b3480156105b057600080fd5b5060005461056c906001600160a01b031681565b3480156105d057600080fd5b5061020a60045481565b3480156105e657600080fd5b5061023d6105f536600461223a565b6115ee565b34801561060657600080fd5b5061020a60035481565b34801561061c57600080fd5b506103ae61062b366004611ddb565b60086020526000908152604090205460ff1681565b34801561064c57600080fd5b5061020a61065b36600461227c565b600b60209081526000928352604080842090915290825290205481565b34801561068457600080fd5b5061056c6106933660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b0390941683529290522054605f1c90565b3480156106d857600080fd5b5060025461056c906001600160a01b031681565b3480156106f857600080fd5b5061020a6107073660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b03909416835292905220546b3fffffffffffffffffffffff1690565b34801561075757600080fd5b5061023d6107663660046122a1565b6117de565b34801561077757600080fd5b5061023d610786366004611f25565b6118b6565b6000546001600160a01b031633146107d95760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156108405760006108198484815181106107fe576107fe612363565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600860205260409020805460ff191660019081179091559290920191506107df565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516108719190612379565b60405180910390a150565b6000546001600160a01b031633146108c55760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061092761193d565b61093183836115ee565b600c8b901b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038e1684529091529020548a9060ff1c61098557604051635972996f60e11b815260040160405180910390fd5b611000600160ac1b03600c8d901b166000908152600b602090815260408083206001600160a01b03851684529091529020546b3fffffffffffffffffffffff16878110156109e6576040516308aeed0f60e21b815260040160405180910390fd5b600454611000600160ac1b03600c8f901b1690600090610a079060016123dc565b90506004548a8e604051602001610a4393929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b60405160208183030381529060405280519060200120945043600560008781526020019081526020016000206004015410610a915760405163d0404f8560e01b815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c815260200160035443610ac591906123dc565b8152602001605f600b60008781526020019081526020016000206000896001600160a01b03166001600160a01b0316815260200190815260200160002054901c6001600160a01b031681526020018f6001600160a01b031681526020018e6001600160a01b03168152602001336001600160a01b03168152602001866001600160a01b0316815250905089899050600014610ba457600083815260066020526040902054610b77908b908b9033611968565b610b85848c8884898861199a565b60048054906000610b95836123f4565b91905055505050505050610c79565b68056bc75e2d63100000816060015111610bc657610b85848c8884898861199a565b611000600160ac1b0333600c1b1660009081526007602052604081205490610bfe610bf9670de0b6b3a76400008461240f565b611b0e565b9050610c12670de0b6b3a764000082612431565b83606001511180610c30575069d3c21bcecceda10000008360600151115b15610c4e57604051630e0c7c2360e11b815260040160405180910390fd5b610c5c868e8a868b8a61199a565b60048054906000610c6c836123f4565b9190505550505050505050505b610c8260018055565b9a9950505050505050505050565b84611000600160ac1b0333600c1b166001600160a01b038516610cc65760405163351de29f60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604090205460ff16610cff57604051630abc194760e11b815260040160405180910390fd5b6000818152600b602090815260408083206001600160a01b03861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610d556bffffffffffffffffffffffff8a16836123dc565b1115610d745760405163f3fb0eb960e01b815260040160405180910390fd5b610d7c61193d565b8415610d8c57610d8c3386611429565b87878760ff81901b605f83901b610da385876123dc565b6000898152600b602090815260408083206001600160a01b038e16845290915290209117919091179055610de78733306bffffffffffffffffffffffff8f16611bca565b610df060018055565b604080516001600160a01b038e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b6000546001600160a01b03163314610e985760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161087191815260200190565b6000546001600160a01b03163314610f165760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b47610f213382611c61565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610871565b611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b03871684529091529020548015611026576000828152600b602090815260408083206001600160a01b038816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a25061103f565b6040516321c4e35760e21b815260040160405180910390fd5b50505050565b61104d61193d565b6000868152600560205260409020600381015461107d576040516331da482760e11b815260040160405180910390fd5b43816004015410156110a2576040516307b7d7dd60e51b815260040160405180910390fd5b6005810154600382015460405160609290921b6bffffffffffffffffffffffff1916602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161113291907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561118057604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526111f49060019060a0016020604051602081039080840390855afa1580156111d8573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526008602052604090205490915060ff1661122657604051632057875960e21b815260040160405180910390fd5b6009840154600385015460028601546001600160a01b039092169160009061124e9083612450565b60006003890181905560048901819055878152600960205260409020805460ff191660011790556008880154909150336001600160a01b03909116146112ff576002870154611000600160ac1b0333600c1b16600090815260076020526040812080549091906112bf9084906123dc565b90915550506008870154600c1b611000600160ac1b0316600090815260076020526040812080548492906112f49084906123dc565b909155506113419050565b81876002015461130f91906123dc565b611000600160ac1b0333600c1b166000908152600760205260408120805490919061133b9084906123dc565b90915550505b600687015461135b9084906001600160a01b031683611cc1565b6002870154156113c75760078701546001600160a01b038d81169116146113b857600787015460028801546113a09185916001600160a01b039091169060011c611cc1565b6113b3838d60018a60020154901c611cc1565b6113c7565b6113c7838d8960020154611cc1565b6006870154604080518f8152602081018590526001600160a01b03909216917f3fd2eee5028b09fa70abe3da4f6023ea41bfde24cfcb9c167f17d6fbe79eece3910160405180910390a25050505050505061142160018055565b505050505050565b6001600160a01b0382163314156114a357611000600160ac1b03600c83901b1660009081526006602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b60006114c661193d565b6114d083836115ee565b33600c1b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038816845290915290205460ff1c15156001141561151957611519846000610f57565b50611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b0388168452909152812080546b3fffffffffffffffffffffff8116939284929161156b908490612450565b90915550508161158e57604051635972996f60e11b815260040160405180910390fd5b611599853384611cc1565b604080516001600160a01b03871681526020810184905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a2506115e760018055565b9392505050565b6000815b808210156117c85760006005600086868681811061161257611612612363565b905060200201358152602001908152602001600020905061163281611d4d565b80546000908152600b6020908152604080832060098501546001600160a01b0316845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e40000009061168890836123dc565b11156116a75760405163f3fb0eb960e01b815260040160405180910390fd5b600382015482546000908152600b6020908152604080832060098701546001600160a01b03168452909152812080549091906116e49084906123dc565b90915550506000600383018190556008830154600c1b611000600160ac1b031660008181526007602052604090205490915060011c68056bc75e2d63100000811161174857600082815260076020526040902068056bc75e2d63100000905561175a565b60008281526007602052604090208190555b60068401546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff89898981811061179b5761179b612363565b905060200201356040516117b191815260200190565b60405180910390a2856001019550505050506115f2565b8082101561103f5763dfb035c96000526004601cfd5b6000546001600160a01b031633146118275760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b81518061183c5763df9578836000526004601cfd5b815181146118525763ff633a386000526004601cfd5b60208301602083018260051b82015b808314611421578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611861565b6000546001600160a01b031633146118ff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610871565b600154600214156119615760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b61197d8484846001600160a01b038516611d97565b61103f57604051631dc23a5f60e11b815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a0850151908201805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b039384161790915560c0860151600684018054831691841691909117905560e086015160078401805483169184169190911790556101008601516008840180548316918416919091179055610120860151600990930180549091169290911691909117905585611a785763ce3a3d376000526004601cfd5b6000818152600b602090815260408083206001600160a01b038616845290915281208054879290611aaa908490612450565b909155505060c08301518351606085015160405187936001600160a01b0316927f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea92611afe92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b83604051602401611b2c91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d9150600051905080945082611bc15763e10bf1cc6000526004601cfd5b50505050919050565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080611c5a5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016107d0565b5050505050565b600080600080600085875af1905080611cbc5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016107d0565b505050565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d116001600051141617169150600060605280604052508061103f5760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016107d0565b4381600401541115611d725760405163d0404f8560e01b815260040160405180910390fd5b6003810154611d94576040516331da482760e11b815260040160405180910390fd5b50565b60008315611dd3578360051b8501855b803580851160051b94855260209485185260406000209301818110611dcb57611dd0565b611da7565b50505b501492915050565b600060208284031215611ded57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611e3357611e33611df4565b604052919050565b600067ffffffffffffffff821115611e5557611e55611df4565b5060051b60200190565b6001600160a01b0381168114611d9457600080fd5b600082601f830112611e8557600080fd5b81356020611e9a611e9583611e3b565b611e0a565b82815260059290921b84018101918181019086841115611eb957600080fd5b8286015b84811015611edd578035611ed081611e5f565b8352918301918301611ebd565b509695505050505050565b600060208284031215611efa57600080fd5b813567ffffffffffffffff811115611f1157600080fd5b611f1d84828501611e74565b949350505050565b600060208284031215611f3757600080fd5b81356115e781611e5f565b60008083601f840112611f5457600080fd5b50813567ffffffffffffffff811115611f6c57600080fd5b6020830191508360208260051b8501011115611f8757600080fd5b9250929050565b6000806000806000806000806000806101008b8d031215611fae57600080fd5b8a35611fb981611e5f565b995060208b0135611fc981611e5f565b985060408b0135611fd981611e5f565b975060608b0135611fe981611e5f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561201457600080fd5b6120208e838f01611f42565b909650945060e08d013591508082111561203957600080fd5b506120468d828e01611f42565b915080935050809150509295989b9194979a5092959850565b8035801515811461206f57600080fd5b919050565b600080600080600060a0868803121561208c57600080fd5b853561209781611e5f565b945060208601356bffffffffffffffffffffffff811681146120b857600080fd5b935060408601356120c881611e5f565b92506120d66060870161205f565b949793965091946080013592915050565b600080604083850312156120fa57600080fd5b823561210581611e5f565b91506121136020840161205f565b90509250929050565b60008060008060008060c0878903121561213557600080fd5b86359550602087013561214781611e5f565b945060408701359350606087013592506080870135915060a087013560ff8116811461217257600080fd5b809150509295509295509295565b6000806040838503121561219357600080fd5b823561219e81611e5f565b946020939093013593505050565b600080604083850312156121bf57600080fd5b82356121ca81611e5f565b915060208301356121da81611e5f565b809150509250929050565b6000806000604084860312156121fa57600080fd5b833561220581611e5f565b9250602084013567ffffffffffffffff81111561222157600080fd5b61222d86828701611f42565b9497909650939450505050565b6000806020838503121561224d57600080fd5b823567ffffffffffffffff81111561226457600080fd5b61227085828601611f42565b90969095509350505050565b6000806040838503121561228f57600080fd5b8235915060208301356121da81611e5f565b600080604083850312156122b457600080fd5b823567ffffffffffffffff808211156122cc57600080fd5b6122d886838701611e74565b93506020915081850135818111156122ef57600080fd5b85019050601f8101861361230257600080fd5b8035612310611e9582611e3b565b81815260059190911b8201830190838101908883111561232f57600080fd5b928401925b82841015612354576123458461205f565b82529284019290840190612334565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156123ba5783516001600160a01b031683529284019291840191600101612395565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156123ef576123ef6123c6565b500190565b6000600019821415612408576124086123c6565b5060010190565b60008261242c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561244b5761244b6123c6565b500290565b600082821015612462576124626123c6565b50039056fea164736f6c6343000809000a", + "deployedBytecode": "0x6080604052600436106101d15760003560e01c80637f94f65d116100f75780639872dbfe11610095578063c52164c611610064578063c52164c6146106cc578063d4fac45d146106ec578063d6e8b9731461074b578063f7d0e04b1461076b57600080fd5b80639872dbfe146105fa57806398a26871146106105780639eee8d4b14610640578063ad8f2eed1461067857600080fd5b806385313e73116100d157806385313e73146105845780638da5cb5b146105a45780638db564c2146105c45780638e2749d6146105da57600080fd5b80637f94f65d146104d757806380e1d302146104f757806384ab1d281461054b57600080fd5b80634b2ae9801161016f5780636a1460241161013e5780636a1460241461044e5780636d82d9e01461046a578063758d77d41461048a57806377cd38a4146104aa57600080fd5b80634b2ae980146103be578063574983c8146103e95780635fd8c7101461040957806369cc6af41461041e57600080fd5b806316d72240116101ab57806316d722401461025f5780632b9f00e91461033e578063328a71811461035e578063461f31201461037e57600080fd5b806304937320146101dd5780630d2a2d441461021d57806313af40351461023f57600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b5061020a6101f8366004611ddb565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561022957600080fd5b5061023d610238366004611ee8565b61078b565b005b34801561024b57600080fd5b5061023d61025a366004611f25565b61087c565b34801561026b57600080fd5b506102df61027a366004611ddb565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009909801549698959794969395946001600160a01b0393841694928416939182169290821691168a565b604080519a8b5260208b019990995297890196909652606088019490945260808701929092526001600160a01b0390811660a087015290811660c086015290811660e08501529081166101008401521661012082015261014001610214565b34801561034a57600080fd5b5061020a610359366004611f8e565b61091d565b34801561036a57600080fd5b5061023d610379366004612074565b610c90565b34801561038a57600080fd5b506103ae610399366004611ddb565b60096020526000908152604090205460ff1681565b6040519015158152602001610214565b3480156103ca57600080fd5b5061020a6103d9366004611f25565b600c1b611000600160ac1b031690565b3480156103f557600080fd5b5061023d610404366004611ddb565b610e4f565b34801561041557600080fd5b5061023d610ecd565b34801561042a57600080fd5b506103ae610439366004611f25565b600a6020526000908152604090205460ff1681565b34801561045a57600080fd5b5061020a670de0b6b3a764000081565b34801561047657600080fd5b5061023d6104853660046120e7565b610f57565b34801561049657600080fd5b5061023d6104a536600461211c565b611045565b3480156104b657600080fd5b5061020a6104c5366004611ddb565b60066020526000908152604090205481565b3480156104e357600080fd5b5061023d6104f2366004612180565b611429565b34801561050357600080fd5b506103ae6105123660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b039094168352929052205460ff1c90565b34801561055757600080fd5b5061056c610566366004611ddb565b600c1c90565b6040516001600160a01b039091168152602001610214565b34801561059057600080fd5b5061020a61059f3660046121e5565b6114bc565b3480156105b057600080fd5b5060005461056c906001600160a01b031681565b3480156105d057600080fd5b5061020a60045481565b3480156105e657600080fd5b5061023d6105f536600461223a565b6115ee565b34801561060657600080fd5b5061020a60035481565b34801561061c57600080fd5b506103ae61062b366004611ddb565b60086020526000908152604090205460ff1681565b34801561064c57600080fd5b5061020a61065b36600461227c565b600b60209081526000928352604080842090915290825290205481565b34801561068457600080fd5b5061056c6106933660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b0390941683529290522054605f1c90565b3480156106d857600080fd5b5060025461056c906001600160a01b031681565b3480156106f857600080fd5b5061020a6107073660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b03909416835292905220546b3fffffffffffffffffffffff1690565b34801561075757600080fd5b5061023d6107663660046122a1565b6117de565b34801561077757600080fd5b5061023d610786366004611f25565b6118b6565b6000546001600160a01b031633146107d95760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156108405760006108198484815181106107fe576107fe612363565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600860205260409020805460ff191660019081179091559290920191506107df565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516108719190612379565b60405180910390a150565b6000546001600160a01b031633146108c55760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061092761193d565b61093183836115ee565b600c8b901b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038e1684529091529020548a9060ff1c61098557604051635972996f60e11b815260040160405180910390fd5b611000600160ac1b03600c8d901b166000908152600b602090815260408083206001600160a01b03851684529091529020546b3fffffffffffffffffffffff16878110156109e6576040516308aeed0f60e21b815260040160405180910390fd5b600454611000600160ac1b03600c8f901b1690600090610a079060016123dc565b90506004548a8e604051602001610a4393929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b60405160208183030381529060405280519060200120945043600560008781526020019081526020016000206004015410610a915760405163d0404f8560e01b815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c815260200160035443610ac591906123dc565b8152602001605f600b60008781526020019081526020016000206000896001600160a01b03166001600160a01b0316815260200190815260200160002054901c6001600160a01b031681526020018f6001600160a01b031681526020018e6001600160a01b03168152602001336001600160a01b03168152602001866001600160a01b0316815250905089899050600014610ba457600083815260066020526040902054610b77908b908b9033611968565b610b85848c8884898861199a565b60048054906000610b95836123f4565b91905055505050505050610c79565b68056bc75e2d63100000816060015111610bc657610b85848c8884898861199a565b611000600160ac1b0333600c1b1660009081526007602052604081205490610bfe610bf9670de0b6b3a76400008461240f565b611b0e565b9050610c12670de0b6b3a764000082612431565b83606001511180610c30575069d3c21bcecceda10000008360600151115b15610c4e57604051630e0c7c2360e11b815260040160405180910390fd5b610c5c868e8a868b8a61199a565b60048054906000610c6c836123f4565b9190505550505050505050505b610c8260018055565b9a9950505050505050505050565b84611000600160ac1b0333600c1b166001600160a01b038516610cc65760405163351de29f60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604090205460ff16610cff57604051630abc194760e11b815260040160405180910390fd5b6000818152600b602090815260408083206001600160a01b03861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610d556bffffffffffffffffffffffff8a16836123dc565b1115610d745760405163f3fb0eb960e01b815260040160405180910390fd5b610d7c61193d565b8415610d8c57610d8c3386611429565b87878760ff81901b605f83901b610da385876123dc565b6000898152600b602090815260408083206001600160a01b038e16845290915290209117919091179055610de78733306bffffffffffffffffffffffff8f16611bca565b610df060018055565b604080516001600160a01b038e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b6000546001600160a01b03163314610e985760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161087191815260200190565b6000546001600160a01b03163314610f165760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b47610f213382611c61565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610871565b611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b03871684529091529020548015611026576000828152600b602090815260408083206001600160a01b038816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a25061103f565b6040516321c4e35760e21b815260040160405180910390fd5b50505050565b61104d61193d565b6000868152600560205260409020600381015461107d576040516331da482760e11b815260040160405180910390fd5b43816004015410156110a2576040516307b7d7dd60e51b815260040160405180910390fd5b6005810154600382015460405160609290921b6bffffffffffffffffffffffff1916602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161113291907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561118057604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526111f49060019060a0016020604051602081039080840390855afa1580156111d8573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526008602052604090205490915060ff1661122657604051632057875960e21b815260040160405180910390fd5b6009840154600385015460028601546001600160a01b039092169160009061124e9083612450565b60006003890181905560048901819055878152600960205260409020805460ff191660011790556008880154909150336001600160a01b03909116146112ff576002870154611000600160ac1b0333600c1b16600090815260076020526040812080549091906112bf9084906123dc565b90915550506008870154600c1b611000600160ac1b0316600090815260076020526040812080548492906112f49084906123dc565b909155506113419050565b81876002015461130f91906123dc565b611000600160ac1b0333600c1b166000908152600760205260408120805490919061133b9084906123dc565b90915550505b600687015461135b9084906001600160a01b031683611cc1565b6002870154156113c75760078701546001600160a01b038d81169116146113b857600787015460028801546113a09185916001600160a01b039091169060011c611cc1565b6113b3838d60018a60020154901c611cc1565b6113c7565b6113c7838d8960020154611cc1565b6006870154604080518f8152602081018590526001600160a01b03909216917f3fd2eee5028b09fa70abe3da4f6023ea41bfde24cfcb9c167f17d6fbe79eece3910160405180910390a25050505050505061142160018055565b505050505050565b6001600160a01b0382163314156114a357611000600160ac1b03600c83901b1660009081526006602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b60006114c661193d565b6114d083836115ee565b33600c1b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038816845290915290205460ff1c15156001141561151957611519846000610f57565b50611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b0388168452909152812080546b3fffffffffffffffffffffff8116939284929161156b908490612450565b90915550508161158e57604051635972996f60e11b815260040160405180910390fd5b611599853384611cc1565b604080516001600160a01b03871681526020810184905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a2506115e760018055565b9392505050565b6000815b808210156117c85760006005600086868681811061161257611612612363565b905060200201358152602001908152602001600020905061163281611d4d565b80546000908152600b6020908152604080832060098501546001600160a01b0316845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e40000009061168890836123dc565b11156116a75760405163f3fb0eb960e01b815260040160405180910390fd5b600382015482546000908152600b6020908152604080832060098701546001600160a01b03168452909152812080549091906116e49084906123dc565b90915550506000600383018190556008830154600c1b611000600160ac1b031660008181526007602052604090205490915060011c68056bc75e2d63100000811161174857600082815260076020526040902068056bc75e2d63100000905561175a565b60008281526007602052604090208190555b60068401546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff89898981811061179b5761179b612363565b905060200201356040516117b191815260200190565b60405180910390a2856001019550505050506115f2565b8082101561103f5763dfb035c96000526004601cfd5b6000546001600160a01b031633146118275760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b81518061183c5763df9578836000526004601cfd5b815181146118525763ff633a386000526004601cfd5b60208301602083018260051b82015b808314611421578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611861565b6000546001600160a01b031633146118ff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610871565b600154600214156119615760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b61197d8484846001600160a01b038516611d97565b61103f57604051631dc23a5f60e11b815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a0850151908201805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b039384161790915560c0860151600684018054831691841691909117905560e086015160078401805483169184169190911790556101008601516008840180548316918416919091179055610120860151600990930180549091169290911691909117905585611a785763ce3a3d376000526004601cfd5b6000818152600b602090815260408083206001600160a01b038616845290915281208054879290611aaa908490612450565b909155505060c08301518351606085015160405187936001600160a01b0316927f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea92611afe92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b83604051602401611b2c91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d9150600051905080945082611bc15763e10bf1cc6000526004601cfd5b50505050919050565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080611c5a5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016107d0565b5050505050565b600080600080600085875af1905080611cbc5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016107d0565b505050565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d116001600051141617169150600060605280604052508061103f5760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016107d0565b4381600401541115611d725760405163d0404f8560e01b815260040160405180910390fd5b6003810154611d94576040516331da482760e11b815260040160405180910390fd5b50565b60008315611dd3578360051b8501855b803580851160051b94855260209485185260406000209301818110611dcb57611dd0565b611da7565b50505b501492915050565b600060208284031215611ded57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611e3357611e33611df4565b604052919050565b600067ffffffffffffffff821115611e5557611e55611df4565b5060051b60200190565b6001600160a01b0381168114611d9457600080fd5b600082601f830112611e8557600080fd5b81356020611e9a611e9583611e3b565b611e0a565b82815260059290921b84018101918181019086841115611eb957600080fd5b8286015b84811015611edd578035611ed081611e5f565b8352918301918301611ebd565b509695505050505050565b600060208284031215611efa57600080fd5b813567ffffffffffffffff811115611f1157600080fd5b611f1d84828501611e74565b949350505050565b600060208284031215611f3757600080fd5b81356115e781611e5f565b60008083601f840112611f5457600080fd5b50813567ffffffffffffffff811115611f6c57600080fd5b6020830191508360208260051b8501011115611f8757600080fd5b9250929050565b6000806000806000806000806000806101008b8d031215611fae57600080fd5b8a35611fb981611e5f565b995060208b0135611fc981611e5f565b985060408b0135611fd981611e5f565b975060608b0135611fe981611e5f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561201457600080fd5b6120208e838f01611f42565b909650945060e08d013591508082111561203957600080fd5b506120468d828e01611f42565b915080935050809150509295989b9194979a5092959850565b8035801515811461206f57600080fd5b919050565b600080600080600060a0868803121561208c57600080fd5b853561209781611e5f565b945060208601356bffffffffffffffffffffffff811681146120b857600080fd5b935060408601356120c881611e5f565b92506120d66060870161205f565b949793965091946080013592915050565b600080604083850312156120fa57600080fd5b823561210581611e5f565b91506121136020840161205f565b90509250929050565b60008060008060008060c0878903121561213557600080fd5b86359550602087013561214781611e5f565b945060408701359350606087013592506080870135915060a087013560ff8116811461217257600080fd5b809150509295509295509295565b6000806040838503121561219357600080fd5b823561219e81611e5f565b946020939093013593505050565b600080604083850312156121bf57600080fd5b82356121ca81611e5f565b915060208301356121da81611e5f565b809150509250929050565b6000806000604084860312156121fa57600080fd5b833561220581611e5f565b9250602084013567ffffffffffffffff81111561222157600080fd5b61222d86828701611f42565b9497909650939450505050565b6000806020838503121561224d57600080fd5b823567ffffffffffffffff81111561226457600080fd5b61227085828601611f42565b90969095509350505050565b6000806040838503121561228f57600080fd5b8235915060208301356121da81611e5f565b600080604083850312156122b457600080fd5b823567ffffffffffffffff808211156122cc57600080fd5b6122d886838701611e74565b93506020915081850135818111156122ef57600080fd5b85019050601f8101861361230257600080fd5b8035612310611e9582611e3b565b81815260059190911b8201830190838101908883111561232f57600080fd5b928401925b82841015612354576123458461205f565b82529284019290840190612334565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156123ba5783516001600160a01b031683529284019291840191600101612395565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156123ef576123ef6123c6565b500190565b6000600019821415612408576124086123c6565b5060010190565b60008261242c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561244b5761244b6123c6565b500290565b600082821015612462576124626123c6565b50039056fea164736f6c6343000809000a", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/contracts/DataTypes.sol b/contracts/DataTypes.sol index 345301f..4d7a4bd 100644 --- a/contracts/DataTypes.sol +++ b/contracts/DataTypes.sol @@ -2,26 +2,28 @@ pragma solidity 0.8.9; library DataTypes { - struct Deposit { - /// @dev Remaining tokens available. - uint256 remaining; - /// @dev The PIX account for the seller receive transactions. - string pixTarget; - address seller; - /// @dev ERC20 stable token address. - address token; - /// @dev Could be invalidated by the seller. - bool valid; - } + // struct Deposit { + // /// @dev Remaining tokens available. + // uint256 remaining; + // /// @dev The PIX account for the seller receive transactions. + // string pixTarget; + // address seller; + // /// @dev ERC20 stable token address. + // address token; + // /// @dev Could be invalidated by the seller. + // bool valid; + // } struct Lock { - uint256 depositID; + uint256 sellerKey; + uint256 counter; /// @dev Amount to be paid for relayer. uint256 relayerPremium; /// @dev Amount to be tranfered via PIX. uint256 amount; /// @dev If not paid at this block will be expired. uint256 expirationBlock; + uint160 pixTarget; /// @dev Where the tokens are sent the when order gets validated. address buyerAddress; /// @dev Relayer's target address that receives `relayerPremium` funds. @@ -29,5 +31,6 @@ library DataTypes { /// @dev Relayer address (msg.sender) that facilitated this transaction. /// @dev Reputation points accruer. address relayerAddress; + address token; } } diff --git a/contracts/EventAndErrors.sol b/contracts/EventAndErrors.sol index 20359c6..606c451 100644 --- a/contracts/EventAndErrors.sol +++ b/contracts/EventAndErrors.sol @@ -7,28 +7,30 @@ interface EventAndErrors { event DepositAdded( address indexed seller, - uint256 depositID, + // uint256 depositID, address token, uint256 amount ); - event DepositClosed( + event ValidSet( address indexed seller, - uint256 depositID + address token, + bool state ); event DepositWithdrawn( address indexed seller, - uint256 depositID, + address token, uint256 amount ); event LockAdded( address indexed buyer, bytes32 indexed lockID, - uint256 depositID, + uint256 seller, uint256 amount ); event LockReleased( address indexed buyer, - bytes32 lockId + bytes32 lockId, + uint256 amount ); event LockReturned( address indexed buyer, @@ -103,4 +105,11 @@ interface EventAndErrors { /// @dev Reverts on an expired lock. /// @dev 0xf6fafba0 error LockExpired(); + + /// @dev 0xce3a3d37 + error DecOverflow(); + /// @dev 0x + error MaxBalExceeded(); + error EmptyPixTarget(); + error NotInitialized(); } diff --git a/contracts/p2pix.sol b/contracts/p2pix.sol index ac18658..11121ba 100644 --- a/contracts/p2pix.sol +++ b/contracts/p2pix.sol @@ -9,7 +9,7 @@ pragma solidity 0.8.9; /// import { Owned } from "./lib/auth/Owned.sol"; -import { Counters } from "./lib/utils/Counters.sol"; +// import { Counters } from "./lib/utils/Counters.sol"; import { ERC20, SafeTransferLib } from "./lib/utils/SafeTransferLib.sol"; import { IReputation } from "./lib/interfaces/IReputation.sol"; import { MerkleProofLib as Merkle } from "./lib/utils/MerkleProofLib.sol"; @@ -25,36 +25,53 @@ contract P2PIX is // solhint-disable use-forbidden-name // solhint-disable no-inline-assembly - using Counters for Counters.Counter; - using DT for DT.Deposit; + // using Counters for Counters.Counter; using DT for DT.Lock; + /// ███ Constants ██████████████████████████████████████████████████████████ + + /// @dev The bitmask of `sellerBalance` entry. + uint256 constant private BITMASK_SB_ENTRY = (1 << 94) - 1; + /// @dev The bit position of `pixTarget` in `sellerBalance`. + uint256 constant private BITPOS_PIXTARGET = 95; + /// @dev The bit position of `valid` in `sellerBalance`. + uint256 constant private BITPOS_VALID = 255; + /// @dev The bitmask of all 256 bits of `sellerBalance` except for the last one. + uint256 constant private BITMASK_VALID = (1 << 255) - 1; + /// @dev The scalar of BRZ token. + uint256 constant public WAD = 1e18; + /// ███ Storage ████████████████████████████████████████████████████████████ IReputation public reputation; - Counters.Counter public depositCount; - + // Counters.Counter public depositCount; /// @dev Default blocks that lock will hold tokens. uint256 public defaultLockBlocks; - /// @dev The scalar of BRZ token. - uint256 constant public WAD = 1e18; + uint256 public lockCounter; + /// @dev List of Locks. + mapping(bytes32 => DT.Lock) public mapLocks; + /// @dev Seller casted to key => Seller's allowlist merkleroot. + mapping(uint256 => bytes32) public sellerAllowList; /// @dev Stores an relayer's last computed credit. mapping(uint256 => uint256) public userRecord; /// @dev List of valid Bacen signature addresses mapping(uint256 => bool) public validBacenSigners; - /// @dev Seller list of deposits - mapping(uint256 => DT.Deposit) public mapDeposits; - /// @dev List of Locks. - mapping(bytes32 => DT.Lock) public mapLocks; /// @dev List of Pix transactions already signed. mapping(bytes32 => bool) public usedTransactions; - /// @dev Seller casted to key => Seller's allowlist merkleroot. - mapping(uint256 => bytes32) public sellerAllowList; /// @dev Tokens allowed to serve as the underlying amount of a deposit. mapping(ERC20 => bool) public allowedERC20s; + // BITS LAYOUT + // `uint96` [0...94] := balance + // `uint160` [95...254] := pixTarget + // `bool` [255] := valid + + /// @dev `balance` max. value = 10**26. + /// @dev `pixTarget` keys are restricted to 160 bits. + mapping(uint256 => mapping(ERC20 => uint256)) public sellerBalance; + /// ███ Constructor ████████████████████████████████████████████████████████ constructor( @@ -77,37 +94,46 @@ contract P2PIX is /// @dev Seller needs to send his tokens to the P2PIX smart contract. /// @param _pixTarget Pix key destination provided by the offer's seller. /// @param allowlistRoot Optional allow list merkleRoot update `bytes32` value. - /// @return depositID The `uint256` return value provided /// as the deposit identifier. /// @dev Function sighash: 0xbfe07da6. function deposit( address _token, - uint256 _amount, - string calldata _pixTarget, + uint96 _amount, + uint160 _pixTarget, + bool _valid, bytes32 allowlistRoot - ) public returns (uint256 depositID) { + ) public { ERC20 t = ERC20(_token); - if (!allowedERC20s[t]) revert TokenDenied(); - - (depositID) = _encodeDepositID(); - - DT.Deposit memory d = DT.Deposit({ - remaining: _amount, - pixTarget: _pixTarget, - seller: msg.sender, - token: _token, - valid: true - }); + uint256 k = _castAddrToKey(msg.sender); + + if(_pixTarget == 0) + revert EmptyPixTarget(); + if (!allowedERC20s[t]) + revert TokenDenied(); + uint256 _sellerBalance = + sellerBalance[k][t]; + + uint256 currBal = + _sellerBalance & BITMASK_SB_ENTRY; + if ((currBal + _amount) > 1e8 ether) + revert MaxBalExceeded(); setReentrancyGuard(); if (allowlistRoot != 0) { setRoot(msg.sender, allowlistRoot); } - - mapDeposits[depositID] = d; - depositCount.increment(); - + + uint256 amountCasted; + uint256 pixTargetCasted; + uint256 validCasted; + (amountCasted, pixTargetCasted, validCasted) = + _castToUint(_amount, _pixTarget, _valid); + sellerBalance[k][t] = + (currBal + amountCasted) | + (pixTargetCasted << BITPOS_PIXTARGET) | + (validCasted << BITPOS_VALID); + SafeTransferLib.safeTransferFrom( t, msg.sender, @@ -119,7 +145,6 @@ contract P2PIX is emit DepositAdded( msg.sender, - depositID, _token, _amount ); @@ -129,14 +154,26 @@ contract P2PIX is /// locks made to his/her token offering order. /// @dev This function does not affect any ongoing active locks. /// @dev Function sighash: 0x72fada5c. - - function cancelDeposit(uint256 depositID) public { - _onlySeller(depositID); - mapDeposits[depositID].valid = false; - emit DepositClosed( - mapDeposits[depositID].seller, - depositID + function setValidState(ERC20 token, bool state) public { + uint256 key = _castAddrToKey(msg.sender); + uint256 _sellerBalance = + sellerBalance[key][token]; + if (_sellerBalance != 0) { + uint256 _valid; + assembly { + _valid := state + } + _sellerBalance = (_sellerBalance & BITMASK_VALID) | + (_valid << BITPOS_VALID); + sellerBalance[key][token] = _sellerBalance; + + emit ValidSet( + msg.sender, + address(token), + state ); + } else + revert NotInitialized(); } /// @notice Public method designed to lock an remaining amount of @@ -159,7 +196,8 @@ contract P2PIX is /// @return lockID The `bytes32` value returned as the lock identifier. /// @dev Function sighash: 0x03aaf306. function lock( - uint256 _depositID, + address _seller, + address _token, address _buyerAddress, address _relayerTarget, uint256 _relayerPremium, @@ -168,44 +206,77 @@ contract P2PIX is bytes32[] calldata expiredLocks ) public nonReentrant returns (bytes32 lockID) { unlockExpired(expiredLocks); - DT.Deposit storage d = mapDeposits[_depositID]; + ERC20 t = ERC20(_token); + if (!getValid(_seller, t)) + revert InvalidDeposit(); + uint256 bal = getBalance(_seller, t); + if (bal < _amount) + revert NotEnoughTokens(); - if (!d.valid) revert InvalidDeposit(); - if (d.remaining < _amount) revert NotEnoughTokens(); + uint256 k = + _castAddrToKey(_seller); - (lockID) = _encodeLockID( - _depositID, - _amount, - _buyerAddress + uint256 cachedCounter = + lockCounter + 1; + + lockID = keccak256( + abi.encodePacked( + lockCounter, + _amount, + _buyerAddress + ) ); + if (mapLocks[lockID].expirationBlock >= block.number) + revert NotExpired(); - DT.Lock memory l = DT.Lock({ - depositID: _depositID, - relayerPremium: _relayerPremium, - amount: _amount, - expirationBlock: (block.number + - defaultLockBlocks), - buyerAddress: _buyerAddress, - relayerTarget: _relayerTarget, - relayerAddress: msg.sender - }); + DT.Lock memory l = DT.Lock( + k, + cachedCounter, + _relayerPremium, + _amount, + (block.number + defaultLockBlocks), + uint160(sellerBalance[k][t] >> BITPOS_PIXTARGET), + _buyerAddress, + _relayerTarget, + msg.sender, + address(t) + ); if (merkleProof.length != 0) { merkleVerify( merkleProof, - sellerAllowList[_castAddrToKey(d.seller)], + sellerAllowList[k], msg.sender ); - _addLock(lockID, l, d); + _addLock( + bal, + _amount, + lockID, + l, + t, + k); + + lockCounter++; // Halt execution and output `lockID`. return lockID; + } else { if (l.amount <= 1e2 ether) { - _addLock(lockID, l, d); - // Halt execution and output `lockID`. - return lockID; + _addLock( + bal, + _amount, + lockID, + l, + t, + k); + + lockCounter++; + + // Halt execution and output `lockID`. + return lockID; + } else { uint256 userCredit = userRecord[ _castAddrToKey(msg.sender) @@ -213,12 +284,22 @@ contract P2PIX is uint256 spendLimit; (spendLimit) = _limiter(userCredit / WAD); - if (l.amount > (spendLimit * WAD) || l.amount > 1e6 ether) - revert AmountNotAllowed(); + if (l.amount > (spendLimit * WAD) || + l.amount > 1e6 ether) + revert AmountNotAllowed(); - _addLock(lockID, l, d); - // Halt execution and output `lockID`. - return lockID; + _addLock( + bal, + _amount, + lockID, + l, + t, + k); + + lockCounter++; + + // Halt execution and output `lockID`. + return lockID; } } } @@ -250,10 +331,9 @@ contract P2PIX is if (l.expirationBlock < block.number) revert LockExpired(); - DT.Deposit storage d = mapDeposits[l.depositID]; bytes32 message = keccak256( abi.encodePacked( - d.pixTarget, + l.pixTarget, l.amount, pixTimestamp ) @@ -275,7 +355,7 @@ contract P2PIX is if (!validBacenSigners[signer]) revert InvalidSigner(); - ERC20 t = ERC20(d.token); + ERC20 t = ERC20(l.token); // We cache values before zeroing them out. uint256 lockAmount = l.amount; @@ -324,7 +404,7 @@ contract P2PIX is } } - emit LockReleased(l.buyerAddress, lockID); + emit LockReleased(l.buyerAddress, lockID, lockAmount); } /// @notice Unlocks expired locks. @@ -344,7 +424,13 @@ contract P2PIX is _notExpired(l); - mapDeposits[l.depositID].remaining += l.amount; + uint256 _sellerBalance = + sellerBalance[l.sellerKey][ERC20(l.token)] & BITMASK_SB_ENTRY; + if((_sellerBalance + l.amount) > 1e8 ether) + revert MaxBalExceeded(); + + sellerBalance[l.sellerKey][ERC20(l.token)] += l.amount; + l.amount = 0; uint256 userKey = _castAddrToKey( @@ -379,28 +465,44 @@ contract P2PIX is /// tokens from expired deposits. /// @dev Function sighash: 0x36317972. function withdraw( - uint256 depositID, + ERC20 token, bytes32[] calldata expiredLocks - ) public nonReentrant { - _onlySeller(depositID); + ) + public + nonReentrant + returns(uint256 _sellerBalance) + { unlockExpired(expiredLocks); - DT.Deposit storage d = mapDeposits[depositID]; + if (getValid(msg.sender, token) + == true + ) { + setValidState(token, false); + } - if (d.valid == true) { - cancelDeposit(depositID); - } + uint256 key = + _castAddrToKey(msg.sender); - ERC20 token = ERC20(d.token); + sellerBalance[key][token] -= + (_sellerBalance = + sellerBalance[key][token] + & BITMASK_SB_ENTRY); + + if(_sellerBalance == 0) + revert InvalidDeposit(); - // Withdraw remaining tokens from mapDeposit[depositID] - uint256 amount = d.remaining; - d.remaining = 0; + // safeTransfer tokens to seller + SafeTransferLib.safeTransfer( + token, + msg.sender, + _sellerBalance + ); - // safeTransfer tokens to seller - SafeTransferLib.safeTransfer(token, d.seller, amount); - - emit DepositWithdrawn(msg.sender, depositID, amount); + emit DepositWithdrawn( + msg.sender, + address(token), + _sellerBalance + ); } function setRoot( @@ -481,7 +583,7 @@ contract P2PIX is let tLoc := add(_tokens, 0x20) let sLoc := add(_states, 0x20) for { - let end := add(tLoc, mul(tLen, 0x20)) + let end := add(tLoc, shl(5, tLen)) } iszero(eq(tLoc, end)) { tLoc := add(tLoc, 0x20) sLoc := add(sLoc, 0x20) @@ -508,14 +610,6 @@ contract P2PIX is // solhint-disable-next-line no-empty-blocks receive() external payable {} - /// @notice Access control private view method that - /// performs auth check on an deposit's seller. - /// @dev Function sighash: 0x4125a4d9. - function _onlySeller(uint256 _depositID) private view { - if (mapDeposits[_depositID].seller != msg.sender) - revert OnlySeller(); - } - /// @notice Private view auxiliar logic that reverts /// on a not expired lock passed as argument of the function. /// @dev Called exclusively by the `unlockExpired` method. @@ -526,31 +620,74 @@ contract P2PIX is if (_l.amount == 0) revert AlreadyReleased(); } - /// @notice Internal view auxiliar logic that returns a new valid `_depositID`. - /// @dev It reverts on an already valid counter (`uint256`) value. - /// @dev Function sighash: 0xdb51d697. - function _encodeDepositID() - internal - view - returns (uint256 _depositID) - { - (_depositID) = depositCount.current(); - } - function _addLock( + uint256 _bal, + uint256 _amount, bytes32 _lockID, DT.Lock memory _l, - DT.Deposit storage _d + ERC20 _t, + uint256 _k ) internal { + mapLocks[_lockID] = _l; - _d.remaining -= _l.amount; + + assembly { + if iszero( + iszero( + or( + iszero(_bal), + lt( + sub( + _bal, + _amount), + 0x0 + )))) { + // DecOverflow() + mstore(0x00, 0xce3a3d37) + revert(0x1c, 0x04) + } + } + + // we can directly dec from packed uint entry value + sellerBalance[_k][_t] -= _amount; emit LockAdded( _l.buyerAddress, _lockID, - _l.depositID, + _l.sellerKey, _l.amount ); + + /// @todo + // assembly { + // // sstore(mp.slot, _l) + // mstore(0x00, _k) + // mstore(0x20, sellerBalance.slot) + // let sbkslot := keccak256(0x00, 0x40) + // mstore(0x00, _t) + // mstore(0x20, sbkslot) + // let sbslot := keccak256(0x00,0x40) + // let oldsb := sload(sbslot) + // sstore( + // sbslot, + // or( + // or( + // _newBal, + // shr( + // oldsb, + // BITPOS_PIXTARGET + // )), + // and( + // shr( + // oldsb, + // BITPOS_VALID + // ), + // BITMASK_SB_ENTRY + // ) + // ) + // ) + // } + } /// @notice Private view auxiliar logic that encodes/returns @@ -559,21 +696,21 @@ contract P2PIX is /// as argument of the function. /// @dev Called exclusively by the `lock` method. /// @dev Function sighash: 0x3fc5fb52. - function _encodeLockID( - uint256 _depositID, - uint256 _amount, - address _buyerAddress - ) private view returns (bytes32 _lockID) { - _lockID = keccak256( - abi.encodePacked( - _depositID, - _amount, - _buyerAddress - ) - ); - if (mapLocks[_lockID].expirationBlock >= block.number) - revert NotExpired(); - } + // function _encodeLockID( + // uint256 _lockCounter, + // uint256 _amount, + // address _buyerAddress + // ) private view returns (bytes32 _lockID) { + // _lockID = keccak256( + // abi.encodePacked( + // _lockCounter, + // _amount, + // _buyerAddress + // ) + // ); + // if (mapLocks[_lockID].expirationBlock >= block.number) + // revert NotExpired(); + // } function merkleVerify( bytes32[] calldata _merkleProof, @@ -628,6 +765,69 @@ contract P2PIX is } } + function _castToUint( + uint96 _amount, + uint160 _pixTarget, + bool _valid) + private + pure + returns ( + uint256 _amountCasted, + uint256 _pixTargetCasted, + uint256 _validCasted + ) { + assembly { + _amountCasted := _amount + _pixTargetCasted := _pixTarget + _validCasted := _valid + } + } + + function getBalance( + address seller, + ERC20 token + ) + public + view + returns(uint256 bal) + { + bal = + sellerBalance[ + _castAddrToKey(seller) + ][token] & BITMASK_SB_ENTRY; + } + + function getValid( + address seller, + ERC20 token + ) + public + view + returns(bool valid) + { + uint256 b = + (sellerBalance[ + _castAddrToKey(seller) + ][token] >> BITPOS_VALID) & BITMASK_SB_ENTRY; + assembly { valid := b } + } + + function getPixTarget( + address seller, + ERC20 token + ) + public + view + returns(uint160 pixTarget) + { + pixTarget = + uint160( + sellerBalance[ + _castAddrToKey(seller) + ][token] >> BITPOS_PIXTARGET + ); + } + /// @notice Public method that handles `address` /// to `uint256` safe type casting. /// @dev Function sighash: 0x4b2ae980. @@ -636,4 +836,10 @@ contract P2PIX is ) public pure returns (uint256 _key) { _key = uint256(uint160(address(_addr))) << 12; } + + function _castKeyToAddr( + uint256 _key + ) public pure returns (address _addr) { + _addr = address(uint160(uint256(_key >> 12))); + } } diff --git a/src/types/EventAndErrors.ts b/src/types/EventAndErrors.ts index 0e4e70c..666505b 100644 --- a/src/types/EventAndErrors.ts +++ b/src/types/EventAndErrors.ts @@ -17,22 +17,21 @@ export interface EventAndErrorsInterface extends utils.Interface { events: { "AllowedERC20Updated(address,bool)": EventFragment; - "DepositAdded(address,uint256,address,uint256)": EventFragment; - "DepositClosed(address,uint256)": EventFragment; - "DepositWithdrawn(address,uint256,uint256)": EventFragment; + "DepositAdded(address,address,uint256)": EventFragment; + "DepositWithdrawn(address,address,uint256)": EventFragment; "FundsWithdrawn(address,uint256)": EventFragment; "LockAdded(address,bytes32,uint256,uint256)": EventFragment; "LockBlocksUpdated(uint256)": EventFragment; - "LockReleased(address,bytes32)": EventFragment; + "LockReleased(address,bytes32,uint256)": EventFragment; "LockReturned(address,bytes32)": EventFragment; "ReputationUpdated(address)": EventFragment; "RootUpdated(address,bytes32)": EventFragment; + "ValidSet(address,address,bool)": EventFragment; "ValidSignersUpdated(address[])": EventFragment; }; getEvent(nameOrSignatureOrTopic: "AllowedERC20Updated"): EventFragment; getEvent(nameOrSignatureOrTopic: "DepositAdded"): EventFragment; - getEvent(nameOrSignatureOrTopic: "DepositClosed"): EventFragment; getEvent(nameOrSignatureOrTopic: "DepositWithdrawn"): EventFragment; getEvent(nameOrSignatureOrTopic: "FundsWithdrawn"): EventFragment; getEvent(nameOrSignatureOrTopic: "LockAdded"): EventFragment; @@ -41,6 +40,7 @@ export interface EventAndErrorsInterface extends utils.Interface { getEvent(nameOrSignatureOrTopic: "LockReturned"): EventFragment; getEvent(nameOrSignatureOrTopic: "ReputationUpdated"): EventFragment; getEvent(nameOrSignatureOrTopic: "RootUpdated"): EventFragment; + getEvent(nameOrSignatureOrTopic: "ValidSet"): EventFragment; getEvent(nameOrSignatureOrTopic: "ValidSignersUpdated"): EventFragment; } @@ -58,35 +58,23 @@ export type AllowedERC20UpdatedEventFilter = export interface DepositAddedEventObject { seller: string; - depositID: BigNumber; token: string; amount: BigNumber; } export type DepositAddedEvent = TypedEvent< - [string, BigNumber, string, BigNumber], + [string, string, BigNumber], DepositAddedEventObject >; export type DepositAddedEventFilter = TypedEventFilter; -export interface DepositClosedEventObject { - seller: string; - depositID: BigNumber; -} -export type DepositClosedEvent = TypedEvent< - [string, BigNumber], - DepositClosedEventObject ->; - -export type DepositClosedEventFilter = TypedEventFilter; - export interface DepositWithdrawnEventObject { seller: string; - depositID: BigNumber; + token: string; amount: BigNumber; } export type DepositWithdrawnEvent = TypedEvent< - [string, BigNumber, BigNumber], + [string, string, BigNumber], DepositWithdrawnEventObject >; @@ -107,7 +95,7 @@ export type FundsWithdrawnEventFilter = TypedEventFilter; export interface LockAddedEventObject { buyer: string; lockID: string; - depositID: BigNumber; + seller: BigNumber; amount: BigNumber; } export type LockAddedEvent = TypedEvent< @@ -131,9 +119,10 @@ export type LockBlocksUpdatedEventFilter = export interface LockReleasedEventObject { buyer: string; lockId: string; + amount: BigNumber; } export type LockReleasedEvent = TypedEvent< - [string, string], + [string, string, BigNumber], LockReleasedEventObject >; @@ -172,6 +161,18 @@ export type RootUpdatedEvent = TypedEvent< export type RootUpdatedEventFilter = TypedEventFilter; +export interface ValidSetEventObject { + seller: string; + token: string; + state: boolean; +} +export type ValidSetEvent = TypedEvent< + [string, string, boolean], + ValidSetEventObject +>; + +export type ValidSetEventFilter = TypedEventFilter; + export interface ValidSignersUpdatedEventObject { signers: string[]; } @@ -223,36 +224,25 @@ export interface EventAndErrors extends BaseContract { state?: PromiseOrValue | null ): AllowedERC20UpdatedEventFilter; - "DepositAdded(address,uint256,address,uint256)"( + "DepositAdded(address,address,uint256)"( seller?: PromiseOrValue | null, - depositID?: null, token?: null, amount?: null ): DepositAddedEventFilter; DepositAdded( seller?: PromiseOrValue | null, - depositID?: null, token?: null, amount?: null ): DepositAddedEventFilter; - "DepositClosed(address,uint256)"( + "DepositWithdrawn(address,address,uint256)"( seller?: PromiseOrValue | null, - depositID?: null - ): DepositClosedEventFilter; - DepositClosed( - seller?: PromiseOrValue | null, - depositID?: null - ): DepositClosedEventFilter; - - "DepositWithdrawn(address,uint256,uint256)"( - seller?: PromiseOrValue | null, - depositID?: null, + token?: null, amount?: null ): DepositWithdrawnEventFilter; DepositWithdrawn( seller?: PromiseOrValue | null, - depositID?: null, + token?: null, amount?: null ): DepositWithdrawnEventFilter; @@ -265,26 +255,28 @@ export interface EventAndErrors extends BaseContract { "LockAdded(address,bytes32,uint256,uint256)"( buyer?: PromiseOrValue | null, lockID?: PromiseOrValue | null, - depositID?: null, + seller?: null, amount?: null ): LockAddedEventFilter; LockAdded( buyer?: PromiseOrValue | null, lockID?: PromiseOrValue | null, - depositID?: null, + seller?: null, amount?: null ): LockAddedEventFilter; "LockBlocksUpdated(uint256)"(blocks?: null): LockBlocksUpdatedEventFilter; LockBlocksUpdated(blocks?: null): LockBlocksUpdatedEventFilter; - "LockReleased(address,bytes32)"( + "LockReleased(address,bytes32,uint256)"( buyer?: PromiseOrValue | null, - lockId?: null + lockId?: null, + amount?: null ): LockReleasedEventFilter; LockReleased( buyer?: PromiseOrValue | null, - lockId?: null + lockId?: null, + amount?: null ): LockReleasedEventFilter; "LockReturned(address,bytes32)"( @@ -307,6 +299,17 @@ export interface EventAndErrors extends BaseContract { ): RootUpdatedEventFilter; RootUpdated(seller?: null, merkleRoot?: null): RootUpdatedEventFilter; + "ValidSet(address,address,bool)"( + seller?: PromiseOrValue | null, + token?: null, + state?: null + ): ValidSetEventFilter; + ValidSet( + seller?: PromiseOrValue | null, + token?: null, + state?: null + ): ValidSetEventFilter; + "ValidSignersUpdated(address[])"( signers?: null ): ValidSignersUpdatedEventFilter; diff --git a/src/types/factories/EventAndErrors__factory.ts b/src/types/factories/EventAndErrors__factory.ts index 817b9b2..853c096 100644 --- a/src/types/factories/EventAndErrors__factory.ts +++ b/src/types/factories/EventAndErrors__factory.ts @@ -25,11 +25,21 @@ const _abi = [ name: "AmountNotAllowed", type: "error", }, + { + inputs: [], + name: "DecOverflow", + type: "error", + }, { inputs: [], name: "DepositAlreadyExists", type: "error", }, + { + inputs: [], + name: "EmptyPixTarget", + type: "error", + }, { inputs: [], name: "InvalidDeposit", @@ -55,6 +65,11 @@ const _abi = [ name: "LoopOverflow", type: "error", }, + { + inputs: [], + name: "MaxBalExceeded", + type: "error", + }, { inputs: [], name: "NoTokens", @@ -70,6 +85,11 @@ const _abi = [ name: "NotExpired", type: "error", }, + { + inputs: [], + name: "NotInitialized", + type: "error", + }, { inputs: [], name: "OnlySeller", @@ -118,12 +138,6 @@ const _abi = [ name: "seller", type: "address", }, - { - indexed: false, - internalType: "uint256", - name: "depositID", - type: "uint256", - }, { indexed: false, internalType: "address", @@ -151,29 +165,10 @@ const _abi = [ }, { indexed: false, - internalType: "uint256", - name: "depositID", - type: "uint256", - }, - ], - name: "DepositClosed", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, internalType: "address", - name: "seller", + name: "token", type: "address", }, - { - indexed: false, - internalType: "uint256", - name: "depositID", - type: "uint256", - }, { indexed: false, internalType: "uint256", @@ -221,7 +216,7 @@ const _abi = [ { indexed: false, internalType: "uint256", - name: "depositID", + name: "seller", type: "uint256", }, { @@ -262,6 +257,12 @@ const _abi = [ name: "lockId", type: "bytes32", }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, ], name: "LockReleased", type: "event", @@ -317,6 +318,31 @@ const _abi = [ name: "RootUpdated", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "seller", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "state", + type: "bool", + }, + ], + name: "ValidSet", + type: "event", + }, { anonymous: false, inputs: [ diff --git a/src/types/factories/p2pix.sol/P2PIX__factory.ts b/src/types/factories/p2pix.sol/P2PIX__factory.ts index 56e5edd..1a7a162 100644 --- a/src/types/factories/p2pix.sol/P2PIX__factory.ts +++ b/src/types/factories/p2pix.sol/P2PIX__factory.ts @@ -60,11 +60,21 @@ const _abi = [ name: "AmountNotAllowed", type: "error", }, + { + inputs: [], + name: "DecOverflow", + type: "error", + }, { inputs: [], name: "DepositAlreadyExists", type: "error", }, + { + inputs: [], + name: "EmptyPixTarget", + type: "error", + }, { inputs: [], name: "InvalidDeposit", @@ -90,6 +100,11 @@ const _abi = [ name: "LoopOverflow", type: "error", }, + { + inputs: [], + name: "MaxBalExceeded", + type: "error", + }, { inputs: [], name: "NoTokens", @@ -105,6 +120,11 @@ const _abi = [ name: "NotExpired", type: "error", }, + { + inputs: [], + name: "NotInitialized", + type: "error", + }, { inputs: [], name: "OnlySeller", @@ -158,12 +178,6 @@ const _abi = [ name: "seller", type: "address", }, - { - indexed: false, - internalType: "uint256", - name: "depositID", - type: "uint256", - }, { indexed: false, internalType: "address", @@ -191,29 +205,10 @@ const _abi = [ }, { indexed: false, - internalType: "uint256", - name: "depositID", - type: "uint256", - }, - ], - name: "DepositClosed", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, internalType: "address", - name: "seller", + name: "token", type: "address", }, - { - indexed: false, - internalType: "uint256", - name: "depositID", - type: "uint256", - }, { indexed: false, internalType: "uint256", @@ -261,7 +256,7 @@ const _abi = [ { indexed: false, internalType: "uint256", - name: "depositID", + name: "seller", type: "uint256", }, { @@ -302,6 +297,12 @@ const _abi = [ name: "lockId", type: "bytes32", }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, ], name: "LockReleased", type: "event", @@ -376,6 +377,31 @@ const _abi = [ name: "RootUpdated", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "seller", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "state", + type: "bool", + }, + ], + name: "ValidSet", + type: "event", + }, { anonymous: false, inputs: [ @@ -421,6 +447,25 @@ const _abi = [ stateMutability: "pure", type: "function", }, + { + inputs: [ + { + internalType: "uint256", + name: "_key", + type: "uint256", + }, + ], + name: "_castKeyToAddr", + outputs: [ + { + internalType: "address", + name: "_addr", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, { inputs: [ { @@ -440,19 +485,6 @@ const _abi = [ stateMutability: "view", type: "function", }, - { - inputs: [ - { - internalType: "uint256", - name: "depositID", - type: "uint256", - }, - ], - name: "cancelDeposit", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [], name: "defaultLockBlocks", @@ -474,14 +506,19 @@ const _abi = [ type: "address", }, { - internalType: "uint256", + internalType: "uint96", name: "_amount", - type: "uint256", + type: "uint96", }, { - internalType: "string", + internalType: "uint160", name: "_pixTarget", - type: "string", + type: "uint160", + }, + { + internalType: "bool", + name: "_valid", + type: "bool", }, { internalType: "bytes32", @@ -490,23 +527,28 @@ const _abi = [ }, ], name: "deposit", - outputs: [ - { - internalType: "uint256", - name: "depositID", - type: "uint256", - }, - ], + outputs: [], stateMutability: "nonpayable", type: "function", }, { - inputs: [], - name: "depositCount", + inputs: [ + { + internalType: "address", + name: "seller", + type: "address", + }, + { + internalType: "contract ERC20", + name: "token", + type: "address", + }, + ], + name: "getBalance", outputs: [ { internalType: "uint256", - name: "_val", + name: "bal", type: "uint256", }, ], @@ -516,9 +558,62 @@ const _abi = [ { inputs: [ { - internalType: "uint256", - name: "_depositID", - type: "uint256", + internalType: "address", + name: "seller", + type: "address", + }, + { + internalType: "contract ERC20", + name: "token", + type: "address", + }, + ], + name: "getPixTarget", + outputs: [ + { + internalType: "uint160", + name: "pixTarget", + type: "uint160", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "seller", + type: "address", + }, + { + internalType: "contract ERC20", + name: "token", + type: "address", + }, + ], + name: "getValid", + outputs: [ + { + internalType: "bool", + name: "valid", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_seller", + type: "address", + }, + { + internalType: "address", + name: "_token", + type: "address", }, { internalType: "address", @@ -563,41 +658,15 @@ const _abi = [ type: "function", }, { - inputs: [ + inputs: [], + name: "lockCounter", + outputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], - name: "mapDeposits", - outputs: [ - { - internalType: "uint256", - name: "remaining", - type: "uint256", - }, - { - internalType: "string", - name: "pixTarget", - type: "string", - }, - { - internalType: "address", - name: "seller", - type: "address", - }, - { - internalType: "address", - name: "token", - type: "address", - }, - { - internalType: "bool", - name: "valid", - type: "bool", - }, - ], stateMutability: "view", type: "function", }, @@ -613,7 +682,12 @@ const _abi = [ outputs: [ { internalType: "uint256", - name: "depositID", + name: "sellerKey", + type: "uint256", + }, + { + internalType: "uint256", + name: "counter", type: "uint256", }, { @@ -631,6 +705,11 @@ const _abi = [ name: "expirationBlock", type: "uint256", }, + { + internalType: "uint160", + name: "pixTarget", + type: "uint160", + }, { internalType: "address", name: "buyerAddress", @@ -646,6 +725,11 @@ const _abi = [ name: "relayerAddress", type: "address", }, + { + internalType: "address", + name: "token", + type: "address", + }, ], stateMutability: "view", type: "function", @@ -733,6 +817,30 @@ const _abi = [ stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + { + internalType: "contract ERC20", + name: "", + type: "address", + }, + ], + name: "sellerBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [ { @@ -803,6 +911,24 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "contract ERC20", + name: "token", + type: "address", + }, + { + internalType: "bool", + name: "state", + type: "bool", + }, + ], + name: "setValidState", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { @@ -894,9 +1020,9 @@ const _abi = [ { inputs: [ { - internalType: "uint256", - name: "depositID", - type: "uint256", + internalType: "contract ERC20", + name: "token", + type: "address", }, { internalType: "bytes32[]", @@ -905,7 +1031,13 @@ const _abi = [ }, ], name: "withdraw", - outputs: [], + outputs: [ + { + internalType: "uint256", + name: "_sellerBalance", + type: "uint256", + }, + ], stateMutability: "nonpayable", type: "function", }, @@ -923,7 +1055,7 @@ const _abi = [ ]; const _bytecode = - "0x608060405260018055604051620028a1380380620028a18339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600660205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083016020830282015b8083146200037f578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b61227180620006306000396000f3fe6080604052600436106101a55760003560e01c806372fada5c116100e15780638e2749d61161008a57806398a268711161006457806398a268711461056b578063c52164c61461059b578063d6e8b973146105bb578063f7d0e04b146105db57600080fd5b80638e2749d6146105045780638e2a3d36146105245780639872dbfe1461055557600080fd5b80637f94f65d116100bb5780637f94f65d1461048c5780638652b37e146104ac5780638da5cb5b146104cc57600080fd5b806372fada5c1461041f578063758d77d41461043f57806377cd38a41461045f57600080fd5b8063363179721161014e578063574983c811610128578063574983c81461039e5780635fd8c710146103be57806369cc6af4146103d35780636a1460241461040357600080fd5b80633631797214610313578063461f3120146103335780634b2ae9801461037357600080fd5b806316d722401161017f57806316d722401461023357806329cc7d10146102dc5780632dfdf0b5146102fc57600080fd5b806304937320146101b15780630d2a2d44146101f157806313af40351461021357600080fd5b366101ac57005b600080fd5b3480156101bd57600080fd5b506101de6101cc366004611b2c565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004611c39565b6105fb565b005b34801561021f57600080fd5b5061021161022e366004611c76565b6106ec565b34801561023f57600080fd5b5061029861024e366004611b2c565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101e8565b3480156102e857600080fd5b506101de6102f7366004611c93565b61078d565b34801561030857600080fd5b506003546101de9081565b34801561031f57600080fd5b5061021161032e366004611d70565b610978565b34801561033f57600080fd5b5061036361034e366004611b2c565b60096020526000908152604090205460ff1681565b60405190151581526020016101e8565b34801561037f57600080fd5b506101de61038e366004611c76565b600c1b611000600160ac1b031690565b3480156103aa57600080fd5b506102116103b9366004611b2c565b610a38565b3480156103ca57600080fd5b50610211610ab6565b3480156103df57600080fd5b506103636103ee366004611c76565b600b6020526000908152604090205460ff1681565b34801561040f57600080fd5b506101de670de0b6b3a764000081565b34801561042b57600080fd5b5061021161043a366004611b2c565b610b40565b34801561044b57600080fd5b5061021161045a366004611dbc565b610bc8565b34801561046b57600080fd5b506101de61047a366004611b2c565b600a6020526000908152604090205481565b34801561049857600080fd5b506102116104a7366004611e20565b610f9e565b3480156104b857600080fd5b506101de6104c7366004611e4c565b611031565b3480156104d857600080fd5b506000546104ec906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b34801561051057600080fd5b5061021161051f366004611f00565b611211565b34801561053057600080fd5b5061054461053f366004611b2c565b611379565b6040516101e8959493929190611f42565b34801561056157600080fd5b506101de60045481565b34801561057757600080fd5b50610363610586366004611b2c565b60066020526000908152604090205460ff1681565b3480156105a757600080fd5b506002546104ec906001600160a01b031681565b3480156105c757600080fd5b506102116105d6366004611fcf565b611443565b3480156105e757600080fd5b506102116105f6366004611c76565b61151b565b6000546001600160a01b031633146106495760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156106b057600061068984848151811061066e5761066e612099565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff1916600190811790915592909201915061064f565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516106e191906120af565b60405180910390a150565b6000546001600160a01b031633146107355760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff166107c857604051630abc194760e11b815260040160405180910390fd5b6107d06115a2565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a166040820152600160609091015290506108456115b2565b8315610855576108553385610f9e565b6000838152600760209081526040909120825181558183015180518493610883926001850192910190611a93565b5060408201516002820180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff00000000000000000000000000000000000000000090951691909216179290921790915561090d9080546001019055565b6109198233308a6115dd565b61092260018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b6109806115b2565b61098983611674565b6109938282611211565b60008381526007602052604090206003810154600160a01b900460ff161515600114156109c3576109c384610b40565b600381015481546000835560028301546001600160a01b03928316926109ec91849116836116b1565b604080518781526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a2505050610a3360018055565b505050565b6000546001600160a01b03163314610a815760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516106e191815260200190565b6000546001600160a01b03163314610aff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b47610b0a338261173d565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91016106e1565b610b4981611674565b6000818152600760209081526040918290206003810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556002015491518381526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a250565b610bd06115b2565b60008681526008602052604090206002810154610c00576040516331da482760e11b815260040160405180910390fd5b4381600301541015610c25576040516307b7d7dd60e51b815260040160405180910390fd5b8054600090815260076020908152604080832060028501549151909392610c5592600186019290918b9101612137565b604051602081830303815290604052805190602001209050600081604051602001610cac91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff16151560011415610cfa57604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff8816928201929092526060810189905260808101889052610d6e9060019060a0016020604051602081039080840390855afa158015610d52573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526006602052604090205490915060ff16610da057604051632057875960e21b815260040160405180910390fd5b6003840154600286015460018701546001600160a01b0390921691600090610dc890836121f4565b600060028a0181905560038a01819055878152600960205260409020805460ff191660011790556006890154909150336001600160a01b0390911614610e79576001880154611000600160ac1b0333600c1b1660009081526005602052604081208054909190610e3990849061220b565b90915550506006880154600c1b611000600160ac1b031660009081526005602052604081208054849290610e6e90849061220b565b90915550610ebb9050565b818860010154610e89919061220b565b611000600160ac1b0333600c1b1660009081526005602052604081208054909190610eb590849061220b565b90915550505b6004880154610ed59084906001600160a01b0316836116b1565b600188015415610f415760058801546001600160a01b038e8116911614610f325760058801546001808a0154610f1a9286926001600160a01b0390911691901c6116b1565b610f2d838e60018b60010154901c6116b1565b610f41565b610f41838e8a600101546116b1565b60048801546040518f81526001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d9060200160405180910390a25050505050505050610f9660018055565b505050505050565b6001600160a01b03821633141561101857611000600160ac1b03600c83901b166000908152600a602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b600061103b6115b2565b6110458383611211565b60008a81526007602052604090206003810154600160a01b900460ff1661107f57604051635972996f60e11b815260040160405180910390fd5b80548711156110a1576040516308aeed0f60e21b815260040160405180910390fd5b6110ac8b888c611798565b915060006040518060e001604052808d81526020018a8152602001898152602001600454436110db919061220b565b81526001600160a01b03808e1660208301528c1660408201523360609091015290508515611144576002820154600c1b611000600160ac1b03166000908152600a602052604090205461113290889088903361181c565b61113d83828461184e565b50506111fb565b68056bc75e2d631000008160400151116111635761113d83828461184e565b611000600160ac1b0333600c1b166000908152600560205260408120549061119b611196670de0b6b3a764000084612223565b61194c565b90506111af670de0b6b3a764000082612245565b836040015111806111cd575069d3c21bcecceda10000008360400151115b156111eb57604051630e0c7c2360e11b815260040160405180910390fd5b6111f685848661184e565b505050505b61120460018055565b9998505050505050505050565b6000815b8082101561135d5760006008600086868681811061123557611235612099565b905060200201358152602001908152602001600020905061125581611a08565b600281015481546000908152600760205260408120805490919061127a90849061220b565b90915550506000600282018190556006820154600c1b611000600160ac1b031660008181526005602052604090205490915060011c68056bc75e2d6310000081116112de57600082815260056020526040902068056bc75e2d6310000090556112f0565b60008281526005602052604090208190555b60048301546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff88888881811061133157611331612099565b9050602002013560405161134791815260200190565b60405180910390a2846001019450505050611215565b808210156113735763dfb035c96000526004601cfd5b50505050565b6007602052600090815260409020805460018201805491929161139b906120fc565b80601f01602080910402602001604051908101604052809291908181526020018280546113c7906120fc565b80156114145780601f106113e957610100808354040283529160200191611414565b820191906000526020600020905b8154815290600101906020018083116113f757829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1685565b6000546001600160a01b0316331461148c5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b8151806114a15763df9578836000526004601cfd5b815181146114b75763ff633a386000526004601cfd5b60208301602083016020830282015b808314610f96578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a36020830192506020820191506114c6565b6000546001600160a01b031633146115645760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f906020016106e1565b60006115ad60035490565b905090565b600154600214156115d65760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d116001600051141617169150600060605280604052508061166d5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610640565b5050505050565b6000818152600760205260409020600201546001600160a01b031633146116ae576040516342e8fb9360e11b815260040160405180910390fd5b50565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d11600160005114161716915060006060528060405250806113735760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610640565b600080600080600085875af1905080610a335760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610640565b6040805160208101859052908101839052606082811b6bffffffffffffffffffffffff191690820152600090607401604051602081830303815290604052805190602001209050436008600083815260200190815260200160002060030154106118155760405163d0404f8560e01b815260040160405180910390fd5b9392505050565b6118318484846001600160a01b038516611a4f565b61137357604051631dc23a5f60e11b815260040160405180910390fd5b600083815260086020908152604080832085518155918501516001830155840151600282018190556060850151600383015560808501516004830180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199182161790915560a087015160058501805491841691831691909117905560c087015160069094018054949092169316929092179091558254909183916118f49084906121f4565b9091555050608082015182516040808501518151928352602083015285926001600160a01b0316917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a3505050565b600080634d2b179160e01b8360405160240161196a91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826119ff5763e10bf1cc6000526004601cfd5b50505050919050565b4381600301541115611a2d5760405163d0404f8560e01b815260040160405180910390fd5b60028101546116ae576040516331da482760e11b815260040160405180910390fd5b60008315611a8b578360051b8501855b803580851160051b94855260209485185260406000209301818110611a8357611a88565b611a5f565b50505b501492915050565b828054611a9f906120fc565b90600052602060002090601f016020900481019282611ac15760008555611b07565b82601f10611ada57805160ff1916838001178555611b07565b82800160010185558215611b07579182015b82811115611b07578251825591602001919060010190611aec565b50611b13929150611b17565b5090565b5b80821115611b135760008155600101611b18565b600060208284031215611b3e57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611b8457611b84611b45565b604052919050565b600067ffffffffffffffff821115611ba657611ba6611b45565b5060051b60200190565b6001600160a01b03811681146116ae57600080fd5b600082601f830112611bd657600080fd5b81356020611beb611be683611b8c565b611b5b565b82815260059290921b84018101918181019086841115611c0a57600080fd5b8286015b84811015611c2e578035611c2181611bb0565b8352918301918301611c0e565b509695505050505050565b600060208284031215611c4b57600080fd5b813567ffffffffffffffff811115611c6257600080fd5b611c6e84828501611bc5565b949350505050565b600060208284031215611c8857600080fd5b813561181581611bb0565b600080600080600060808688031215611cab57600080fd5b8535611cb681611bb0565b945060208601359350604086013567ffffffffffffffff80821115611cda57600080fd5b818801915088601f830112611cee57600080fd5b813581811115611cfd57600080fd5b896020828501011115611d0f57600080fd5b96999598505060200195606001359392505050565b60008083601f840112611d3657600080fd5b50813567ffffffffffffffff811115611d4e57600080fd5b6020830191508360208260051b8501011115611d6957600080fd5b9250929050565b600080600060408486031215611d8557600080fd5b83359250602084013567ffffffffffffffff811115611da357600080fd5b611daf86828701611d24565b9497909650939450505050565b60008060008060008060c08789031215611dd557600080fd5b863595506020870135611de781611bb0565b945060408701359350606087013592506080870135915060a087013560ff81168114611e1257600080fd5b809150509295509295509295565b60008060408385031215611e3357600080fd5b8235611e3e81611bb0565b946020939093013593505050565b600080600080600080600080600060e08a8c031215611e6a57600080fd5b8935985060208a0135611e7c81611bb0565b975060408a0135611e8c81611bb0565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff80821115611eb757600080fd5b611ec38d838e01611d24565b909650945060c08c0135915080821115611edc57600080fd5b50611ee98c828d01611d24565b915080935050809150509295985092959850929598565b60008060208385031215611f1357600080fd5b823567ffffffffffffffff811115611f2a57600080fd5b611f3685828601611d24565b90969095509350505050565b8581526000602060a08184015286518060a085015260005b81811015611f765788810183015185820160c001528201611f5a565b81811115611f8857600060c083870101525b50601f01601f1916830160c0019150611fae905060408301866001600160a01b03169052565b6001600160a01b038416606083015282151560808301529695505050505050565b60008060408385031215611fe257600080fd5b823567ffffffffffffffff80821115611ffa57600080fd5b61200686838701611bc5565b935060209150818501358181111561201d57600080fd5b85019050601f8101861361203057600080fd5b803561203e611be682611b8c565b81815260059190911b8201830190838101908883111561205d57600080fd5b928401925b8284101561208a578335801515811461207b5760008081fd5b82529284019290840190612062565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156120f05783516001600160a01b0316835292840192918401916001016120cb565b50909695505050505050565b600181811c9082168061211057607f821691505b6020821081141561213157634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c91508083168061215357607f831692505b602080841082141561217357634e487b7160e01b86526022600452602486fd5b8180156121875760018114612198576121c5565b60ff198616895284890196506121c5565b60008c81526020902060005b868110156121bd5781548b8201529085019083016121a4565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052601160045260246000fd5b600082821015612206576122066121de565b500390565b6000821982111561221e5761221e6121de565b500190565b60008261224057634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561225f5761225f6121de565b50029056fea164736f6c6343000809000a"; + "0x60806040526001805560405162002aa438038062002aa48339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b61247480620006306000396000f3fe6080604052600436106101d15760003560e01c80637f94f65d116100f75780639872dbfe11610095578063c52164c611610064578063c52164c6146106cc578063d4fac45d146106ec578063d6e8b9731461074b578063f7d0e04b1461076b57600080fd5b80639872dbfe146105fa57806398a26871146106105780639eee8d4b14610640578063ad8f2eed1461067857600080fd5b806385313e73116100d157806385313e73146105845780638da5cb5b146105a45780638db564c2146105c45780638e2749d6146105da57600080fd5b80637f94f65d146104d757806380e1d302146104f757806384ab1d281461054b57600080fd5b80634b2ae9801161016f5780636a1460241161013e5780636a1460241461044e5780636d82d9e01461046a578063758d77d41461048a57806377cd38a4146104aa57600080fd5b80634b2ae980146103be578063574983c8146103e95780635fd8c7101461040957806369cc6af41461041e57600080fd5b806316d72240116101ab57806316d722401461025f5780632b9f00e91461033e578063328a71811461035e578063461f31201461037e57600080fd5b806304937320146101dd5780630d2a2d441461021d57806313af40351461023f57600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b5061020a6101f8366004611ddb565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561022957600080fd5b5061023d610238366004611ee8565b61078b565b005b34801561024b57600080fd5b5061023d61025a366004611f25565b61087c565b34801561026b57600080fd5b506102df61027a366004611ddb565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009909801549698959794969395946001600160a01b0393841694928416939182169290821691168a565b604080519a8b5260208b019990995297890196909652606088019490945260808701929092526001600160a01b0390811660a087015290811660c086015290811660e08501529081166101008401521661012082015261014001610214565b34801561034a57600080fd5b5061020a610359366004611f8e565b61091d565b34801561036a57600080fd5b5061023d610379366004612074565b610c90565b34801561038a57600080fd5b506103ae610399366004611ddb565b60096020526000908152604090205460ff1681565b6040519015158152602001610214565b3480156103ca57600080fd5b5061020a6103d9366004611f25565b600c1b611000600160ac1b031690565b3480156103f557600080fd5b5061023d610404366004611ddb565b610e4f565b34801561041557600080fd5b5061023d610ecd565b34801561042a57600080fd5b506103ae610439366004611f25565b600a6020526000908152604090205460ff1681565b34801561045a57600080fd5b5061020a670de0b6b3a764000081565b34801561047657600080fd5b5061023d6104853660046120e7565b610f57565b34801561049657600080fd5b5061023d6104a536600461211c565b611045565b3480156104b657600080fd5b5061020a6104c5366004611ddb565b60066020526000908152604090205481565b3480156104e357600080fd5b5061023d6104f2366004612180565b611429565b34801561050357600080fd5b506103ae6105123660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b039094168352929052205460ff1c90565b34801561055757600080fd5b5061056c610566366004611ddb565b600c1c90565b6040516001600160a01b039091168152602001610214565b34801561059057600080fd5b5061020a61059f3660046121e5565b6114bc565b3480156105b057600080fd5b5060005461056c906001600160a01b031681565b3480156105d057600080fd5b5061020a60045481565b3480156105e657600080fd5b5061023d6105f536600461223a565b6115ee565b34801561060657600080fd5b5061020a60035481565b34801561061c57600080fd5b506103ae61062b366004611ddb565b60086020526000908152604090205460ff1681565b34801561064c57600080fd5b5061020a61065b36600461227c565b600b60209081526000928352604080842090915290825290205481565b34801561068457600080fd5b5061056c6106933660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b0390941683529290522054605f1c90565b3480156106d857600080fd5b5060025461056c906001600160a01b031681565b3480156106f857600080fd5b5061020a6107073660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b03909416835292905220546b3fffffffffffffffffffffff1690565b34801561075757600080fd5b5061023d6107663660046122a1565b6117de565b34801561077757600080fd5b5061023d610786366004611f25565b6118b6565b6000546001600160a01b031633146107d95760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156108405760006108198484815181106107fe576107fe612363565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600860205260409020805460ff191660019081179091559290920191506107df565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516108719190612379565b60405180910390a150565b6000546001600160a01b031633146108c55760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061092761193d565b61093183836115ee565b600c8b901b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038e1684529091529020548a9060ff1c61098557604051635972996f60e11b815260040160405180910390fd5b611000600160ac1b03600c8d901b166000908152600b602090815260408083206001600160a01b03851684529091529020546b3fffffffffffffffffffffff16878110156109e6576040516308aeed0f60e21b815260040160405180910390fd5b600454611000600160ac1b03600c8f901b1690600090610a079060016123dc565b90506004548a8e604051602001610a4393929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b60405160208183030381529060405280519060200120945043600560008781526020019081526020016000206004015410610a915760405163d0404f8560e01b815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c815260200160035443610ac591906123dc565b8152602001605f600b60008781526020019081526020016000206000896001600160a01b03166001600160a01b0316815260200190815260200160002054901c6001600160a01b031681526020018f6001600160a01b031681526020018e6001600160a01b03168152602001336001600160a01b03168152602001866001600160a01b0316815250905089899050600014610ba457600083815260066020526040902054610b77908b908b9033611968565b610b85848c8884898861199a565b60048054906000610b95836123f4565b91905055505050505050610c79565b68056bc75e2d63100000816060015111610bc657610b85848c8884898861199a565b611000600160ac1b0333600c1b1660009081526007602052604081205490610bfe610bf9670de0b6b3a76400008461240f565b611b0e565b9050610c12670de0b6b3a764000082612431565b83606001511180610c30575069d3c21bcecceda10000008360600151115b15610c4e57604051630e0c7c2360e11b815260040160405180910390fd5b610c5c868e8a868b8a61199a565b60048054906000610c6c836123f4565b9190505550505050505050505b610c8260018055565b9a9950505050505050505050565b84611000600160ac1b0333600c1b166001600160a01b038516610cc65760405163351de29f60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604090205460ff16610cff57604051630abc194760e11b815260040160405180910390fd5b6000818152600b602090815260408083206001600160a01b03861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610d556bffffffffffffffffffffffff8a16836123dc565b1115610d745760405163f3fb0eb960e01b815260040160405180910390fd5b610d7c61193d565b8415610d8c57610d8c3386611429565b87878760ff81901b605f83901b610da385876123dc565b6000898152600b602090815260408083206001600160a01b038e16845290915290209117919091179055610de78733306bffffffffffffffffffffffff8f16611bca565b610df060018055565b604080516001600160a01b038e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b6000546001600160a01b03163314610e985760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161087191815260200190565b6000546001600160a01b03163314610f165760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b47610f213382611c61565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610871565b611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b03871684529091529020548015611026576000828152600b602090815260408083206001600160a01b038816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a25061103f565b6040516321c4e35760e21b815260040160405180910390fd5b50505050565b61104d61193d565b6000868152600560205260409020600381015461107d576040516331da482760e11b815260040160405180910390fd5b43816004015410156110a2576040516307b7d7dd60e51b815260040160405180910390fd5b6005810154600382015460405160609290921b6bffffffffffffffffffffffff1916602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161113291907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561118057604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526111f49060019060a0016020604051602081039080840390855afa1580156111d8573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526008602052604090205490915060ff1661122657604051632057875960e21b815260040160405180910390fd5b6009840154600385015460028601546001600160a01b039092169160009061124e9083612450565b60006003890181905560048901819055878152600960205260409020805460ff191660011790556008880154909150336001600160a01b03909116146112ff576002870154611000600160ac1b0333600c1b16600090815260076020526040812080549091906112bf9084906123dc565b90915550506008870154600c1b611000600160ac1b0316600090815260076020526040812080548492906112f49084906123dc565b909155506113419050565b81876002015461130f91906123dc565b611000600160ac1b0333600c1b166000908152600760205260408120805490919061133b9084906123dc565b90915550505b600687015461135b9084906001600160a01b031683611cc1565b6002870154156113c75760078701546001600160a01b038d81169116146113b857600787015460028801546113a09185916001600160a01b039091169060011c611cc1565b6113b3838d60018a60020154901c611cc1565b6113c7565b6113c7838d8960020154611cc1565b6006870154604080518f8152602081018590526001600160a01b03909216917f3fd2eee5028b09fa70abe3da4f6023ea41bfde24cfcb9c167f17d6fbe79eece3910160405180910390a25050505050505061142160018055565b505050505050565b6001600160a01b0382163314156114a357611000600160ac1b03600c83901b1660009081526006602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b60006114c661193d565b6114d083836115ee565b33600c1b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038816845290915290205460ff1c15156001141561151957611519846000610f57565b50611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b0388168452909152812080546b3fffffffffffffffffffffff8116939284929161156b908490612450565b90915550508161158e57604051635972996f60e11b815260040160405180910390fd5b611599853384611cc1565b604080516001600160a01b03871681526020810184905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a2506115e760018055565b9392505050565b6000815b808210156117c85760006005600086868681811061161257611612612363565b905060200201358152602001908152602001600020905061163281611d4d565b80546000908152600b6020908152604080832060098501546001600160a01b0316845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e40000009061168890836123dc565b11156116a75760405163f3fb0eb960e01b815260040160405180910390fd5b600382015482546000908152600b6020908152604080832060098701546001600160a01b03168452909152812080549091906116e49084906123dc565b90915550506000600383018190556008830154600c1b611000600160ac1b031660008181526007602052604090205490915060011c68056bc75e2d63100000811161174857600082815260076020526040902068056bc75e2d63100000905561175a565b60008281526007602052604090208190555b60068401546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff89898981811061179b5761179b612363565b905060200201356040516117b191815260200190565b60405180910390a2856001019550505050506115f2565b8082101561103f5763dfb035c96000526004601cfd5b6000546001600160a01b031633146118275760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b81518061183c5763df9578836000526004601cfd5b815181146118525763ff633a386000526004601cfd5b60208301602083018260051b82015b808314611421578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611861565b6000546001600160a01b031633146118ff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610871565b600154600214156119615760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b61197d8484846001600160a01b038516611d97565b61103f57604051631dc23a5f60e11b815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a0850151908201805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b039384161790915560c0860151600684018054831691841691909117905560e086015160078401805483169184169190911790556101008601516008840180548316918416919091179055610120860151600990930180549091169290911691909117905585611a785763ce3a3d376000526004601cfd5b6000818152600b602090815260408083206001600160a01b038616845290915281208054879290611aaa908490612450565b909155505060c08301518351606085015160405187936001600160a01b0316927f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea92611afe92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b83604051602401611b2c91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d9150600051905080945082611bc15763e10bf1cc6000526004601cfd5b50505050919050565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080611c5a5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016107d0565b5050505050565b600080600080600085875af1905080611cbc5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016107d0565b505050565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d116001600051141617169150600060605280604052508061103f5760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016107d0565b4381600401541115611d725760405163d0404f8560e01b815260040160405180910390fd5b6003810154611d94576040516331da482760e11b815260040160405180910390fd5b50565b60008315611dd3578360051b8501855b803580851160051b94855260209485185260406000209301818110611dcb57611dd0565b611da7565b50505b501492915050565b600060208284031215611ded57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611e3357611e33611df4565b604052919050565b600067ffffffffffffffff821115611e5557611e55611df4565b5060051b60200190565b6001600160a01b0381168114611d9457600080fd5b600082601f830112611e8557600080fd5b81356020611e9a611e9583611e3b565b611e0a565b82815260059290921b84018101918181019086841115611eb957600080fd5b8286015b84811015611edd578035611ed081611e5f565b8352918301918301611ebd565b509695505050505050565b600060208284031215611efa57600080fd5b813567ffffffffffffffff811115611f1157600080fd5b611f1d84828501611e74565b949350505050565b600060208284031215611f3757600080fd5b81356115e781611e5f565b60008083601f840112611f5457600080fd5b50813567ffffffffffffffff811115611f6c57600080fd5b6020830191508360208260051b8501011115611f8757600080fd5b9250929050565b6000806000806000806000806000806101008b8d031215611fae57600080fd5b8a35611fb981611e5f565b995060208b0135611fc981611e5f565b985060408b0135611fd981611e5f565b975060608b0135611fe981611e5f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561201457600080fd5b6120208e838f01611f42565b909650945060e08d013591508082111561203957600080fd5b506120468d828e01611f42565b915080935050809150509295989b9194979a5092959850565b8035801515811461206f57600080fd5b919050565b600080600080600060a0868803121561208c57600080fd5b853561209781611e5f565b945060208601356bffffffffffffffffffffffff811681146120b857600080fd5b935060408601356120c881611e5f565b92506120d66060870161205f565b949793965091946080013592915050565b600080604083850312156120fa57600080fd5b823561210581611e5f565b91506121136020840161205f565b90509250929050565b60008060008060008060c0878903121561213557600080fd5b86359550602087013561214781611e5f565b945060408701359350606087013592506080870135915060a087013560ff8116811461217257600080fd5b809150509295509295509295565b6000806040838503121561219357600080fd5b823561219e81611e5f565b946020939093013593505050565b600080604083850312156121bf57600080fd5b82356121ca81611e5f565b915060208301356121da81611e5f565b809150509250929050565b6000806000604084860312156121fa57600080fd5b833561220581611e5f565b9250602084013567ffffffffffffffff81111561222157600080fd5b61222d86828701611f42565b9497909650939450505050565b6000806020838503121561224d57600080fd5b823567ffffffffffffffff81111561226457600080fd5b61227085828601611f42565b90969095509350505050565b6000806040838503121561228f57600080fd5b8235915060208301356121da81611e5f565b600080604083850312156122b457600080fd5b823567ffffffffffffffff808211156122cc57600080fd5b6122d886838701611e74565b93506020915081850135818111156122ef57600080fd5b85019050601f8101861361230257600080fd5b8035612310611e9582611e3b565b81815260059190911b8201830190838101908883111561232f57600080fd5b928401925b82841015612354576123458461205f565b82529284019290840190612334565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156123ba5783516001600160a01b031683529284019291840191600101612395565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156123ef576123ef6123c6565b500190565b6000600019821415612408576124086123c6565b5060010190565b60008261242c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561244b5761244b6123c6565b500290565b600082821015612462576124626123c6565b50039056fea164736f6c6343000809000a"; type P2PIXConstructorParams = | [signer?: Signer] diff --git a/src/types/p2pix.sol/P2PIX.ts b/src/types/p2pix.sol/P2PIX.ts index ecbd971..d732e4e 100644 --- a/src/types/p2pix.sol/P2PIX.ts +++ b/src/types/p2pix.sol/P2PIX.ts @@ -31,29 +31,33 @@ export interface P2PIXInterface extends utils.Interface { functions: { "WAD()": FunctionFragment; "_castAddrToKey(address)": FunctionFragment; + "_castKeyToAddr(uint256)": FunctionFragment; "allowedERC20s(address)": FunctionFragment; - "cancelDeposit(uint256)": FunctionFragment; "defaultLockBlocks()": FunctionFragment; - "deposit(address,uint256,string,bytes32)": FunctionFragment; - "depositCount()": FunctionFragment; - "lock(uint256,address,address,uint256,uint256,bytes32[],bytes32[])": FunctionFragment; - "mapDeposits(uint256)": FunctionFragment; + "deposit(address,uint96,uint160,bool,bytes32)": FunctionFragment; + "getBalance(address,address)": FunctionFragment; + "getPixTarget(address,address)": FunctionFragment; + "getValid(address,address)": FunctionFragment; + "lock(address,address,address,address,uint256,uint256,bytes32[],bytes32[])": FunctionFragment; + "lockCounter()": FunctionFragment; "mapLocks(bytes32)": FunctionFragment; "owner()": FunctionFragment; "release(bytes32,address,bytes32,bytes32,bytes32,uint8)": FunctionFragment; "reputation()": FunctionFragment; "sellerAllowList(uint256)": FunctionFragment; + "sellerBalance(uint256,address)": FunctionFragment; "setDefaultLockBlocks(uint256)": FunctionFragment; "setOwner(address)": FunctionFragment; "setReputation(address)": FunctionFragment; "setRoot(address,bytes32)": FunctionFragment; "setValidSigners(address[])": FunctionFragment; + "setValidState(address,bool)": FunctionFragment; "tokenSettings(address[],bool[])": FunctionFragment; "unlockExpired(bytes32[])": FunctionFragment; "usedTransactions(bytes32)": FunctionFragment; "userRecord(uint256)": FunctionFragment; "validBacenSigners(uint256)": FunctionFragment; - "withdraw(uint256,bytes32[])": FunctionFragment; + "withdraw(address,bytes32[])": FunctionFragment; "withdrawBalance()": FunctionFragment; }; @@ -61,23 +65,27 @@ export interface P2PIXInterface extends utils.Interface { nameOrSignatureOrTopic: | "WAD" | "_castAddrToKey" + | "_castKeyToAddr" | "allowedERC20s" - | "cancelDeposit" | "defaultLockBlocks" | "deposit" - | "depositCount" + | "getBalance" + | "getPixTarget" + | "getValid" | "lock" - | "mapDeposits" + | "lockCounter" | "mapLocks" | "owner" | "release" | "reputation" | "sellerAllowList" + | "sellerBalance" | "setDefaultLockBlocks" | "setOwner" | "setReputation" | "setRoot" | "setValidSigners" + | "setValidState" | "tokenSettings" | "unlockExpired" | "usedTransactions" @@ -93,12 +101,12 @@ export interface P2PIXInterface extends utils.Interface { values: [PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "allowedERC20s", - values: [PromiseOrValue] + functionFragment: "_castKeyToAddr", + values: [PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "cancelDeposit", - values: [PromiseOrValue] + functionFragment: "allowedERC20s", + values: [PromiseOrValue] ): string; encodeFunctionData( functionFragment: "defaultLockBlocks", @@ -109,18 +117,28 @@ export interface P2PIXInterface extends utils.Interface { values: [ PromiseOrValue, PromiseOrValue, - PromiseOrValue, + PromiseOrValue, + PromiseOrValue, PromiseOrValue ] ): string; encodeFunctionData( - functionFragment: "depositCount", - values?: undefined + functionFragment: "getBalance", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "getPixTarget", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "getValid", + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( functionFragment: "lock", values: [ - PromiseOrValue, + PromiseOrValue, + PromiseOrValue, PromiseOrValue, PromiseOrValue, PromiseOrValue, @@ -130,8 +148,8 @@ export interface P2PIXInterface extends utils.Interface { ] ): string; encodeFunctionData( - functionFragment: "mapDeposits", - values: [PromiseOrValue] + functionFragment: "lockCounter", + values?: undefined ): string; encodeFunctionData( functionFragment: "mapLocks", @@ -157,6 +175,10 @@ export interface P2PIXInterface extends utils.Interface { functionFragment: "sellerAllowList", values: [PromiseOrValue] ): string; + encodeFunctionData( + functionFragment: "sellerBalance", + values: [PromiseOrValue, PromiseOrValue] + ): string; encodeFunctionData( functionFragment: "setDefaultLockBlocks", values: [PromiseOrValue] @@ -177,6 +199,10 @@ export interface P2PIXInterface extends utils.Interface { functionFragment: "setValidSigners", values: [PromiseOrValue[]] ): string; + encodeFunctionData( + functionFragment: "setValidState", + values: [PromiseOrValue, PromiseOrValue] + ): string; encodeFunctionData( functionFragment: "tokenSettings", values: [PromiseOrValue[], PromiseOrValue[]] @@ -199,7 +225,7 @@ export interface P2PIXInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "withdraw", - values: [PromiseOrValue, PromiseOrValue[]] + values: [PromiseOrValue, PromiseOrValue[]] ): string; encodeFunctionData( functionFragment: "withdrawBalance", @@ -212,11 +238,11 @@ export interface P2PIXInterface extends utils.Interface { data: BytesLike ): Result; decodeFunctionResult( - functionFragment: "allowedERC20s", + functionFragment: "_castKeyToAddr", data: BytesLike ): Result; decodeFunctionResult( - functionFragment: "cancelDeposit", + functionFragment: "allowedERC20s", data: BytesLike ): Result; decodeFunctionResult( @@ -224,13 +250,15 @@ export interface P2PIXInterface extends utils.Interface { data: BytesLike ): Result; decodeFunctionResult(functionFragment: "deposit", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getBalance", data: BytesLike): Result; decodeFunctionResult( - functionFragment: "depositCount", + functionFragment: "getPixTarget", data: BytesLike ): Result; + decodeFunctionResult(functionFragment: "getValid", data: BytesLike): Result; decodeFunctionResult(functionFragment: "lock", data: BytesLike): Result; decodeFunctionResult( - functionFragment: "mapDeposits", + functionFragment: "lockCounter", data: BytesLike ): Result; decodeFunctionResult(functionFragment: "mapLocks", data: BytesLike): Result; @@ -241,6 +269,10 @@ export interface P2PIXInterface extends utils.Interface { functionFragment: "sellerAllowList", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "sellerBalance", + data: BytesLike + ): Result; decodeFunctionResult( functionFragment: "setDefaultLockBlocks", data: BytesLike @@ -255,6 +287,10 @@ export interface P2PIXInterface extends utils.Interface { functionFragment: "setValidSigners", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "setValidState", + data: BytesLike + ): Result; decodeFunctionResult( functionFragment: "tokenSettings", data: BytesLike @@ -280,23 +316,22 @@ export interface P2PIXInterface extends utils.Interface { events: { "AllowedERC20Updated(address,bool)": EventFragment; - "DepositAdded(address,uint256,address,uint256)": EventFragment; - "DepositClosed(address,uint256)": EventFragment; - "DepositWithdrawn(address,uint256,uint256)": EventFragment; + "DepositAdded(address,address,uint256)": EventFragment; + "DepositWithdrawn(address,address,uint256)": EventFragment; "FundsWithdrawn(address,uint256)": EventFragment; "LockAdded(address,bytes32,uint256,uint256)": EventFragment; "LockBlocksUpdated(uint256)": EventFragment; - "LockReleased(address,bytes32)": EventFragment; + "LockReleased(address,bytes32,uint256)": EventFragment; "LockReturned(address,bytes32)": EventFragment; "OwnerUpdated(address,address)": EventFragment; "ReputationUpdated(address)": EventFragment; "RootUpdated(address,bytes32)": EventFragment; + "ValidSet(address,address,bool)": EventFragment; "ValidSignersUpdated(address[])": EventFragment; }; getEvent(nameOrSignatureOrTopic: "AllowedERC20Updated"): EventFragment; getEvent(nameOrSignatureOrTopic: "DepositAdded"): EventFragment; - getEvent(nameOrSignatureOrTopic: "DepositClosed"): EventFragment; getEvent(nameOrSignatureOrTopic: "DepositWithdrawn"): EventFragment; getEvent(nameOrSignatureOrTopic: "FundsWithdrawn"): EventFragment; getEvent(nameOrSignatureOrTopic: "LockAdded"): EventFragment; @@ -306,6 +341,7 @@ export interface P2PIXInterface extends utils.Interface { getEvent(nameOrSignatureOrTopic: "OwnerUpdated"): EventFragment; getEvent(nameOrSignatureOrTopic: "ReputationUpdated"): EventFragment; getEvent(nameOrSignatureOrTopic: "RootUpdated"): EventFragment; + getEvent(nameOrSignatureOrTopic: "ValidSet"): EventFragment; getEvent(nameOrSignatureOrTopic: "ValidSignersUpdated"): EventFragment; } @@ -323,35 +359,23 @@ export type AllowedERC20UpdatedEventFilter = export interface DepositAddedEventObject { seller: string; - depositID: BigNumber; token: string; amount: BigNumber; } export type DepositAddedEvent = TypedEvent< - [string, BigNumber, string, BigNumber], + [string, string, BigNumber], DepositAddedEventObject >; export type DepositAddedEventFilter = TypedEventFilter; -export interface DepositClosedEventObject { - seller: string; - depositID: BigNumber; -} -export type DepositClosedEvent = TypedEvent< - [string, BigNumber], - DepositClosedEventObject ->; - -export type DepositClosedEventFilter = TypedEventFilter; - export interface DepositWithdrawnEventObject { seller: string; - depositID: BigNumber; + token: string; amount: BigNumber; } export type DepositWithdrawnEvent = TypedEvent< - [string, BigNumber, BigNumber], + [string, string, BigNumber], DepositWithdrawnEventObject >; @@ -372,7 +396,7 @@ export type FundsWithdrawnEventFilter = TypedEventFilter; export interface LockAddedEventObject { buyer: string; lockID: string; - depositID: BigNumber; + seller: BigNumber; amount: BigNumber; } export type LockAddedEvent = TypedEvent< @@ -396,9 +420,10 @@ export type LockBlocksUpdatedEventFilter = export interface LockReleasedEventObject { buyer: string; lockId: string; + amount: BigNumber; } export type LockReleasedEvent = TypedEvent< - [string, string], + [string, string, BigNumber], LockReleasedEventObject >; @@ -448,6 +473,18 @@ export type RootUpdatedEvent = TypedEvent< export type RootUpdatedEventFilter = TypedEventFilter; +export interface ValidSetEventObject { + seller: string; + token: string; + state: boolean; +} +export type ValidSetEvent = TypedEvent< + [string, string, boolean], + ValidSetEventObject +>; + +export type ValidSetEventFilter = TypedEventFilter; + export interface ValidSignersUpdatedEventObject { signers: string[]; } @@ -493,32 +530,48 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise<[BigNumber] & { _key: BigNumber }>; + _castKeyToAddr( + _key: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[string] & { _addr: string }>; + allowedERC20s( arg0: PromiseOrValue, overrides?: CallOverrides ): Promise<[boolean]>; - cancelDeposit( - depositID: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - defaultLockBlocks(overrides?: CallOverrides): Promise<[BigNumber]>; deposit( _token: PromiseOrValue, _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, + _pixTarget: PromiseOrValue, + _valid: PromiseOrValue, allowlistRoot: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - depositCount( + getBalance( + seller: PromiseOrValue, + token: PromiseOrValue, overrides?: CallOverrides - ): Promise<[BigNumber] & { _val: BigNumber }>; + ): Promise<[BigNumber] & { bal: BigNumber }>; + + getPixTarget( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[BigNumber] & { pixTarget: BigNumber }>; + + getValid( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[boolean] & { valid: boolean }>; lock( - _depositID: PromiseOrValue, + _seller: PromiseOrValue, + _token: PromiseOrValue, _buyerAddress: PromiseOrValue, _relayerTarget: PromiseOrValue, _relayerPremium: PromiseOrValue, @@ -528,31 +581,34 @@ export interface P2PIX extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - mapDeposits( - arg0: PromiseOrValue, - overrides?: CallOverrides - ): Promise< - [BigNumber, string, string, string, boolean] & { - remaining: BigNumber; - pixTarget: string; - seller: string; - token: string; - valid: boolean; - } - >; + lockCounter(overrides?: CallOverrides): Promise<[BigNumber]>; mapLocks( arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber, string, string, string] & { - depositID: BigNumber; + [ + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + string, + string, + string, + string + ] & { + sellerKey: BigNumber; + counter: BigNumber; relayerPremium: BigNumber; amount: BigNumber; expirationBlock: BigNumber; + pixTarget: BigNumber; buyerAddress: string; relayerTarget: string; relayerAddress: string; + token: string; } >; @@ -575,6 +631,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise<[string]>; + sellerBalance( + arg0: PromiseOrValue, + arg1: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + setDefaultLockBlocks( _blocks: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -601,6 +663,12 @@ export interface P2PIX extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; + setValidState( + token: PromiseOrValue, + state: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + tokenSettings( _tokens: PromiseOrValue[], _states: PromiseOrValue[], @@ -628,7 +696,7 @@ export interface P2PIX extends BaseContract { ): Promise<[boolean]>; withdraw( - depositID: PromiseOrValue, + token: PromiseOrValue, expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -645,30 +713,48 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + _castKeyToAddr( + _key: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + allowedERC20s( arg0: PromiseOrValue, overrides?: CallOverrides ): Promise; - cancelDeposit( - depositID: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - defaultLockBlocks(overrides?: CallOverrides): Promise; deposit( _token: PromiseOrValue, _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, + _pixTarget: PromiseOrValue, + _valid: PromiseOrValue, allowlistRoot: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - depositCount(overrides?: CallOverrides): Promise; + getBalance( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + getPixTarget( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + getValid( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; lock( - _depositID: PromiseOrValue, + _seller: PromiseOrValue, + _token: PromiseOrValue, _buyerAddress: PromiseOrValue, _relayerTarget: PromiseOrValue, _relayerPremium: PromiseOrValue, @@ -678,31 +764,34 @@ export interface P2PIX extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - mapDeposits( - arg0: PromiseOrValue, - overrides?: CallOverrides - ): Promise< - [BigNumber, string, string, string, boolean] & { - remaining: BigNumber; - pixTarget: string; - seller: string; - token: string; - valid: boolean; - } - >; + lockCounter(overrides?: CallOverrides): Promise; mapLocks( arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber, string, string, string] & { - depositID: BigNumber; + [ + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + string, + string, + string, + string + ] & { + sellerKey: BigNumber; + counter: BigNumber; relayerPremium: BigNumber; amount: BigNumber; expirationBlock: BigNumber; + pixTarget: BigNumber; buyerAddress: string; relayerTarget: string; relayerAddress: string; + token: string; } >; @@ -725,6 +814,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + sellerBalance( + arg0: PromiseOrValue, + arg1: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + setDefaultLockBlocks( _blocks: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -751,6 +846,12 @@ export interface P2PIX extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; + setValidState( + token: PromiseOrValue, + state: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + tokenSettings( _tokens: PromiseOrValue[], _states: PromiseOrValue[], @@ -778,7 +879,7 @@ export interface P2PIX extends BaseContract { ): Promise; withdraw( - depositID: PromiseOrValue, + token: PromiseOrValue, expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -795,30 +896,48 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + _castKeyToAddr( + _key: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + allowedERC20s( arg0: PromiseOrValue, overrides?: CallOverrides ): Promise; - cancelDeposit( - depositID: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - defaultLockBlocks(overrides?: CallOverrides): Promise; deposit( _token: PromiseOrValue, _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, + _pixTarget: PromiseOrValue, + _valid: PromiseOrValue, allowlistRoot: PromiseOrValue, overrides?: CallOverrides + ): Promise; + + getBalance( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides ): Promise; - depositCount(overrides?: CallOverrides): Promise; + getPixTarget( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + getValid( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; lock( - _depositID: PromiseOrValue, + _seller: PromiseOrValue, + _token: PromiseOrValue, _buyerAddress: PromiseOrValue, _relayerTarget: PromiseOrValue, _relayerPremium: PromiseOrValue, @@ -828,31 +947,34 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; - mapDeposits( - arg0: PromiseOrValue, - overrides?: CallOverrides - ): Promise< - [BigNumber, string, string, string, boolean] & { - remaining: BigNumber; - pixTarget: string; - seller: string; - token: string; - valid: boolean; - } - >; + lockCounter(overrides?: CallOverrides): Promise; mapLocks( arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber, string, string, string] & { - depositID: BigNumber; + [ + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + string, + string, + string, + string + ] & { + sellerKey: BigNumber; + counter: BigNumber; relayerPremium: BigNumber; amount: BigNumber; expirationBlock: BigNumber; + pixTarget: BigNumber; buyerAddress: string; relayerTarget: string; relayerAddress: string; + token: string; } >; @@ -875,6 +997,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + sellerBalance( + arg0: PromiseOrValue, + arg1: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + setDefaultLockBlocks( _blocks: PromiseOrValue, overrides?: CallOverrides @@ -901,6 +1029,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + setValidState( + token: PromiseOrValue, + state: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + tokenSettings( _tokens: PromiseOrValue[], _states: PromiseOrValue[], @@ -928,10 +1062,10 @@ export interface P2PIX extends BaseContract { ): Promise; withdraw( - depositID: PromiseOrValue, + token: PromiseOrValue, expiredLocks: PromiseOrValue[], overrides?: CallOverrides - ): Promise; + ): Promise; withdrawBalance(overrides?: CallOverrides): Promise; }; @@ -946,36 +1080,25 @@ export interface P2PIX extends BaseContract { state?: PromiseOrValue | null ): AllowedERC20UpdatedEventFilter; - "DepositAdded(address,uint256,address,uint256)"( + "DepositAdded(address,address,uint256)"( seller?: PromiseOrValue | null, - depositID?: null, token?: null, amount?: null ): DepositAddedEventFilter; DepositAdded( seller?: PromiseOrValue | null, - depositID?: null, token?: null, amount?: null ): DepositAddedEventFilter; - "DepositClosed(address,uint256)"( + "DepositWithdrawn(address,address,uint256)"( seller?: PromiseOrValue | null, - depositID?: null - ): DepositClosedEventFilter; - DepositClosed( - seller?: PromiseOrValue | null, - depositID?: null - ): DepositClosedEventFilter; - - "DepositWithdrawn(address,uint256,uint256)"( - seller?: PromiseOrValue | null, - depositID?: null, + token?: null, amount?: null ): DepositWithdrawnEventFilter; DepositWithdrawn( seller?: PromiseOrValue | null, - depositID?: null, + token?: null, amount?: null ): DepositWithdrawnEventFilter; @@ -988,26 +1111,28 @@ export interface P2PIX extends BaseContract { "LockAdded(address,bytes32,uint256,uint256)"( buyer?: PromiseOrValue | null, lockID?: PromiseOrValue | null, - depositID?: null, + seller?: null, amount?: null ): LockAddedEventFilter; LockAdded( buyer?: PromiseOrValue | null, lockID?: PromiseOrValue | null, - depositID?: null, + seller?: null, amount?: null ): LockAddedEventFilter; "LockBlocksUpdated(uint256)"(blocks?: null): LockBlocksUpdatedEventFilter; LockBlocksUpdated(blocks?: null): LockBlocksUpdatedEventFilter; - "LockReleased(address,bytes32)"( + "LockReleased(address,bytes32,uint256)"( buyer?: PromiseOrValue | null, - lockId?: null + lockId?: null, + amount?: null ): LockReleasedEventFilter; LockReleased( buyer?: PromiseOrValue | null, - lockId?: null + lockId?: null, + amount?: null ): LockReleasedEventFilter; "LockReturned(address,bytes32)"( @@ -1039,6 +1164,17 @@ export interface P2PIX extends BaseContract { ): RootUpdatedEventFilter; RootUpdated(seller?: null, merkleRoot?: null): RootUpdatedEventFilter; + "ValidSet(address,address,bool)"( + seller?: PromiseOrValue | null, + token?: null, + state?: null + ): ValidSetEventFilter; + ValidSet( + seller?: PromiseOrValue | null, + token?: null, + state?: null + ): ValidSetEventFilter; + "ValidSignersUpdated(address[])"( signers?: null ): ValidSignersUpdatedEventFilter; @@ -1053,14 +1189,14 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; - allowedERC20s( - arg0: PromiseOrValue, + _castKeyToAddr( + _key: PromiseOrValue, overrides?: CallOverrides ): Promise; - cancelDeposit( - depositID: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } + allowedERC20s( + arg0: PromiseOrValue, + overrides?: CallOverrides ): Promise; defaultLockBlocks(overrides?: CallOverrides): Promise; @@ -1068,15 +1204,33 @@ export interface P2PIX extends BaseContract { deposit( _token: PromiseOrValue, _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, + _pixTarget: PromiseOrValue, + _valid: PromiseOrValue, allowlistRoot: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - depositCount(overrides?: CallOverrides): Promise; + getBalance( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + getPixTarget( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + getValid( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; lock( - _depositID: PromiseOrValue, + _seller: PromiseOrValue, + _token: PromiseOrValue, _buyerAddress: PromiseOrValue, _relayerTarget: PromiseOrValue, _relayerPremium: PromiseOrValue, @@ -1086,10 +1240,7 @@ export interface P2PIX extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - mapDeposits( - arg0: PromiseOrValue, - overrides?: CallOverrides - ): Promise; + lockCounter(overrides?: CallOverrides): Promise; mapLocks( arg0: PromiseOrValue, @@ -1115,6 +1266,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + sellerBalance( + arg0: PromiseOrValue, + arg1: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + setDefaultLockBlocks( _blocks: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -1141,6 +1298,12 @@ export interface P2PIX extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; + setValidState( + token: PromiseOrValue, + state: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + tokenSettings( _tokens: PromiseOrValue[], _states: PromiseOrValue[], @@ -1168,7 +1331,7 @@ export interface P2PIX extends BaseContract { ): Promise; withdraw( - depositID: PromiseOrValue, + token: PromiseOrValue, expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1186,14 +1349,14 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; - allowedERC20s( - arg0: PromiseOrValue, + _castKeyToAddr( + _key: PromiseOrValue, overrides?: CallOverrides ): Promise; - cancelDeposit( - depositID: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } + allowedERC20s( + arg0: PromiseOrValue, + overrides?: CallOverrides ): Promise; defaultLockBlocks(overrides?: CallOverrides): Promise; @@ -1201,15 +1364,33 @@ export interface P2PIX extends BaseContract { deposit( _token: PromiseOrValue, _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, + _pixTarget: PromiseOrValue, + _valid: PromiseOrValue, allowlistRoot: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - depositCount(overrides?: CallOverrides): Promise; + getBalance( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + getPixTarget( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + getValid( + seller: PromiseOrValue, + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; lock( - _depositID: PromiseOrValue, + _seller: PromiseOrValue, + _token: PromiseOrValue, _buyerAddress: PromiseOrValue, _relayerTarget: PromiseOrValue, _relayerPremium: PromiseOrValue, @@ -1219,10 +1400,7 @@ export interface P2PIX extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - mapDeposits( - arg0: PromiseOrValue, - overrides?: CallOverrides - ): Promise; + lockCounter(overrides?: CallOverrides): Promise; mapLocks( arg0: PromiseOrValue, @@ -1248,6 +1426,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + sellerBalance( + arg0: PromiseOrValue, + arg1: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + setDefaultLockBlocks( _blocks: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -1274,6 +1458,12 @@ export interface P2PIX extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; + setValidState( + token: PromiseOrValue, + state: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + tokenSettings( _tokens: PromiseOrValue[], _states: PromiseOrValue[], @@ -1301,7 +1491,7 @@ export interface P2PIX extends BaseContract { ): Promise; withdraw( - depositID: PromiseOrValue, + token: PromiseOrValue, expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; diff --git a/test/Reputation.test.ts b/test/Reputation.test.ts index 338120b..395ca5c 100644 --- a/test/Reputation.test.ts +++ b/test/Reputation.test.ts @@ -36,8 +36,6 @@ describe("Reputation", () => { expect(tx2).to.eq(curve(500)); expect(tx3).to.eq(curve(444444)); expect(tx4).to.eq(curve(988700)); - - }); }); }); diff --git a/test/p2pix.test.ts b/test/p2pix.test.ts index 7340082..ab7f92e 100644 --- a/test/p2pix.test.ts +++ b/test/p2pix.test.ts @@ -1,1784 +1,1774 @@ -import "@nomicfoundation/hardhat-chai-matchers"; -import { - loadFixture, - mine, -} from "@nomicfoundation/hardhat-network-helpers"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { expect } from "chai"; -import { - BigNumber, - ContractReceipt, - ContractTransaction, - Wallet, -} from "ethers"; -import { - ethers, - network, - /* tracer */ -} from "hardhat"; - -// import keccak256 from "keccak256"; -import { MockToken, P2PIX, Reputation } from "../src/types"; -import { P2PixErrors } from "./utils/errors"; -import { - Deposit, - Lock, - getSignerAddrs, - p2pixFixture, - randomSigners, -} 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 - let merkleRoot: string; // MerkleRoot from seller's allowlist - let proof: string[]; // Owner's proof as whitelisted address - - 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, merkleRoot, proof } = - await loadFixture(p2pixFixture)); - }); - - describe("Init", async () => { - it("P2PIX, Reputation and ERC20 should initialize", async () => { - // tracer.enabled = true; - await p2pix.deployed(); - // tracer.enabled = false; - 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(10); - 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(10) - .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 owner to withdraw contract's balance", async () => { - const oldBal = await p2pix.provider.getBalance( - p2pix.address, - ); - // this call also tests p2pix's receive() fallback mechanism. - 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"], - ) - .and.to.emit(p2pix, "FundsWithdrawn") - .withArgs(owner.address, price); - - await expect( - p2pix.connect(acc01).withdrawBalance(), - ).to.be.revertedWith(P2PixErrors.UNAUTHORIZED); - }); - it("should allow owner to change reputation instance", async () => { - const tx = await p2pix.setReputation(acc03.address); - const newRep = await p2pix.callStatic.reputation(); - const fail = p2pix - .connect(acc02) - .setReputation(owner.address); - - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "ReputationUpdated") - .withArgs(acc03.address); - expect(newRep).to.eq(acc03.address); - await expect(fail).to.be.revertedWith( - P2PixErrors.UNAUTHORIZED, - ); - }); - it("should allow owner to change defaultLockBlocks ", async () => { - const magicVal = 1337; - const tx = await p2pix.setDefaultLockBlocks(magicVal); - const newVal = - await p2pix.callStatic.defaultLockBlocks(); - const fail = p2pix - .connect(acc02) - .setDefaultLockBlocks(0); - - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "LockBlocksUpdated") - .withArgs(magicVal); - expect(newVal).to.eq(magicVal); - await expect(fail).to.be.revertedWith( - P2PixErrors.UNAUTHORIZED, - ); - }); - it("should allow owner to add valid Bacen signers", async () => { - const newSigners = randomSigners(2); - const bob = await newSigners[0].getAddress(); - const alice = await newSigners[1].getAddress(); - const bobCasted = await p2pix._castAddrToKey(bob); - const aliceCasted = await p2pix._castAddrToKey(alice); - const tx = await p2pix.setValidSigners([bob, alice]); - const newSigner1 = - await p2pix.callStatic.validBacenSigners(bobCasted); - const newSigner2 = - await p2pix.callStatic.validBacenSigners(aliceCasted); - const fail = p2pix - .connect(acc03) - .setValidSigners([owner.address, acc02.address]); - - expect(tx).to.be.ok; - expect(newSigner1).to.eq(true); - expect(newSigner2).to.eq(true); - await expect(tx) - .to.emit(p2pix, "ValidSignersUpdated") - .withArgs([bob, alice]); - await expect(fail).to.be.revertedWith( - P2PixErrors.UNAUTHORIZED, - ); - }); - it("should allow owner to adjust tokenSettings", async () => { - const tx = await p2pix.tokenSettings( - [erc20.address, owner.address], - [false, true], - ); - const newTokenState1 = - await p2pix.callStatic.allowedERC20s(erc20.address); - const newTokenState2 = - await p2pix.callStatic.allowedERC20s(owner.address); - const fail = p2pix - .connect(acc01) - .tokenSettings([acc01.address], [false]); - const fail2 = p2pix.tokenSettings([], [true, false]); - const fail3 = p2pix.tokenSettings([zero], [true, true]); - - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "AllowedERC20Updated") - .withArgs(erc20.address, false) - .and.to.emit(p2pix, "AllowedERC20Updated") - .withArgs(owner.address, true); - expect(newTokenState1).to.eq(false); - expect(newTokenState2).to.eq(true); - await expect(fail).to.be.revertedWith( - P2PixErrors.UNAUTHORIZED, - ); - await expect(fail).to.be.revertedWith( - P2PixErrors.UNAUTHORIZED, - ); - await expect(fail2).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.NoTokens, - ); - await expect(fail3).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.LengthMismatch, - ); - }); - }); - describe("Deposit", async () => { - it("should revert if ERC20 is not allowed", async () => { - const pTarget = ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("_pixTarget"), - ); - const root = ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("root"), - ); - const tx = p2pix.deposit( - owner.address, - 1, - pTarget, - root, - ); - - await expect(tx).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.TokenDenied, - ); - }); - it("should create deposit, update storage and emit event", async () => { - const pTarget = ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("_pixTarget"), - ); - // we use `hashZero` to avoid updating seller's allowlist settings - const root = ethers.constants.HashZero; - await erc20.approve(p2pix.address, price); - const tx = await p2pix.deposit( - erc20.address, - price, - pTarget, - root, - ); - const storage: Deposit = await p2pix.mapDeposits(0); - const ownerKey = await p2pix.callStatic._castAddrToKey( - owner.address, - ); - const allowList = await p2pix.sellerAllowList(ownerKey); - - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "DepositAdded") - .withArgs(owner.address, 0, erc20.address, price); - await expect(tx).to.changeTokenBalances( - erc20, - [owner.address, p2pix.address], - ["-100000000000000000000", price], - ); - expect(storage.remaining).to.eq(price); - expect(storage.pixTarget).to.eq(pTarget); - expect(storage.seller).to.eq(owner.address); - expect(storage.token).to.eq(erc20.address); - expect(storage.valid).to.eq(true); - expect(allowList).to.eq(root); - }); - // edge case test - it("should create multiple deposits", async () => { - const ownerKey = await p2pix.callStatic._castAddrToKey( - owner.address, - ); - const acc01Key = await p2pix.callStatic._castAddrToKey( - acc01.address, - ); - const acc02Key = await p2pix.callStatic._castAddrToKey( - acc02.address, - ); - const acc03Key = await p2pix.callStatic._castAddrToKey( - acc03.address, - ); - - const pTarget = ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("_pixTarget"), - ); - const pTarget2 = ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("_pixTarget2"), - ); - const pTarget3 = ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("_pixTarget3"), - ); - // we mock the allowlist root here only to test storage update. In depth - // allowlist test coverage in both "Lock" and "Allowlist Settings" unit tests. - const root = ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("root"), - ); - const nullRoot = ethers.constants.HashZero; - const price2 = price.mul(ethers.BigNumber.from(2)); - const price3 = price.mul(ethers.BigNumber.from(3)); - const price4 = price.mul(ethers.BigNumber.from(4)); - await erc20.mint( - getSignerAddrs(4, await ethers.getSigners()), - price4, - ); - await erc20 - .connect(owner) - .approve(p2pix.address, price); - await erc20 - .connect(acc01) - .approve(p2pix.address, price2); - await erc20 - .connect(acc02) - .approve(p2pix.address, price3); - await erc20 - .connect(acc03) - .approve(p2pix.address, price4); - - const tx = await p2pix - .connect(owner) - .deposit(erc20.address, price, pTarget, root); - const tx2 = await p2pix - .connect(acc01) - .deposit(erc20.address, price2, pTarget2, nullRoot); - const tx3 = await p2pix - .connect(acc02) - .deposit(erc20.address, price3, pTarget3, root); - const tx4 = await p2pix - .connect(acc03) - .deposit(erc20.address, price4, pTarget, nullRoot); - - const storage1: Deposit = await p2pix.mapDeposits(0); - const storage2: Deposit = await p2pix.mapDeposits(1); - const storage3: Deposit = await p2pix.mapDeposits(2); - const storage4: Deposit = await p2pix.mapDeposits(3); - - const allowList1 = await p2pix.sellerAllowList( - ownerKey, - ); - const allowList2 = await p2pix.sellerAllowList( - acc01Key, - ); - const allowList3 = await p2pix.sellerAllowList( - acc02Key, - ); - const allowList4 = await p2pix.sellerAllowList( - acc03Key, - ); - - expect(tx).to.be.ok; - expect(tx2).to.be.ok; - expect(tx3).to.be.ok; - expect(tx4).to.be.ok; - - await expect(tx) - .to.emit(p2pix, "DepositAdded") - .withArgs(owner.address, 0, erc20.address, price); - await expect(tx).to.changeTokenBalances( - erc20, - [owner.address, p2pix.address], - ["-100000000000000000000", price], - ); - - await expect(tx2) - .to.emit(p2pix, "DepositAdded") - .withArgs(acc01.address, 1, erc20.address, price2); - await expect(tx2).to.changeTokenBalances( - erc20, - [acc01.address, p2pix.address], - ["-200000000000000000000", price2], - ); - - await expect(tx3) - .to.emit(p2pix, "DepositAdded") - .withArgs(acc02.address, 2, erc20.address, price3); - await expect(tx3).to.changeTokenBalances( - erc20, - [acc02.address, p2pix.address], - ["-300000000000000000000", price3], - ); - - await expect(tx4) - .to.emit(p2pix, "DepositAdded") - .withArgs(acc03.address, 3, erc20.address, price4); - await expect(tx4).to.changeTokenBalances( - erc20, - [acc03.address, p2pix.address], - ["-400000000000000000000", price4], - ); - - expect(storage1.remaining).to.eq(price); - expect(storage1.pixTarget).to.eq(pTarget); - expect(storage1.seller).to.eq(owner.address); - expect(storage1.token).to.eq(erc20.address); - expect(storage1.valid).to.eq(true); - expect(allowList1).to.eq(root); - - expect(storage2.remaining).to.eq(price2); - expect(storage2.pixTarget).to.eq(pTarget2); - expect(storage2.seller).to.eq(acc01.address); - expect(storage2.token).to.eq(erc20.address); - expect(storage2.valid).to.eq(true); - expect(allowList2).to.eq(nullRoot); - - expect(storage3.remaining).to.eq(price3); - expect(storage3.pixTarget).to.eq(pTarget3); - expect(storage3.seller).to.eq(acc02.address); - expect(storage3.token).to.eq(erc20.address); - expect(storage3.valid).to.eq(true); - expect(allowList3).to.eq(root); - - expect(storage4.remaining).to.eq(price4); - expect(storage4.pixTarget).to.eq(pTarget); - expect(storage4.seller).to.eq(acc03.address); - expect(storage4.token).to.eq(erc20.address); - expect(storage4.valid).to.eq(true); - expect(allowList4).to.eq(nullRoot); - }); - }); - describe("Lock", async () => { - it("should revert if deposit is invalid", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - ethers.constants.HashZero, - ); - await p2pix.cancelDeposit(0); - const fail = p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 0, - price, - [], - [], - ); - const fail2 = p2pix.lock( - 2, - zero, - zero, - 0, - price, - [], - [], - ); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.InvalidDeposit, - ); - await expect(fail2).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.InvalidDeposit, - ); - }); - it("should revert if wished amount is greater than deposit's remaining amount", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - ethers.constants.HashZero, - ); - const fail = p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 0, - price.mul(ethers.BigNumber.from(2)), - [], - [], - ); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.NotEnoughTokens, - ); - }); - it("should revert if a non expired lock has the same ID encoded", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - ethers.constants.HashZero, - ); - await p2pix - .connect(acc03) - .lock(0, acc02.address, acc03.address, 0, 1, [], []); - const fail = p2pix - .connect(acc03) - .lock(0, acc02.address, acc03.address, 0, 1, [], []); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.NotExpired, - ); - }); - it("should revert if an invalid allowlist merkleproof is provided", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - const fail = p2pix - .connect(acc02) - .lock( - 0, - acc02.address, - acc03.address, - 0, - 1000, - [ - ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("wrong"), - ), - ], - [], - ); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.AddressDenied, - ); - }); - it("should revert if msg.sender does not have enough credit in his spend limit", async () => { - await erc20.approve(p2pix.address, price.mul(BigNumber.from('3'))); - await p2pix.deposit( - erc20.address, - price.mul(BigNumber.from('3')), - "pixTarget", - merkleRoot, - ); - const fail = p2pix - .connect(acc02) - .lock( - 0, - acc02.address, - acc03.address, - 0, - price.mul(BigNumber.from('2')), - [], - [], - ); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.AmountNotAllowed, - ); - }); - it("should create a lock, update storage and emit events via the allowlist path", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - const tx = await p2pix - .connect(acc01) - .lock( - 0, - acc02.address, - acc03.address, - 0, - price, - proof, - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, price, acc02.address], - ); - const storage: Lock = await p2pix.callStatic.mapLocks( - lockID, - ); - - const rc: ContractReceipt = await tx.wait(); - const expiration = rc.blockNumber + 10; - - expect(tx).to.be.ok; - expect(storage.depositID).to.eq(0); - expect(storage.relayerPremium).to.eq( - ethers.constants.Zero, - ); - expect(storage.amount).to.eq(price); - expect(storage.expirationBlock).to.eq(expiration); - expect(storage.buyerAddress).to.eq(acc02.address); - expect(storage.relayerTarget).to.eq(acc03.address); - expect(storage.relayerAddress).to.eq(acc01.address); - await expect(tx) - .to.emit(p2pix, "LockAdded") - .withArgs( - acc02.address, - lockID, - storage.depositID, - storage.amount, - ); - }); - it("should create a lock, update storage and emit events via the reputation path", async () => { - const root = ethers.constants.HashZero; - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - root, - ); - const tx = await p2pix - .connect(acc01) - .lock( - 0, - acc02.address, - acc03.address, - 0, - price, - [], - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, price, acc02.address], - ); - const storage: Lock = await p2pix.callStatic.mapLocks( - lockID, - ); - - const rc: ContractReceipt = await tx.wait(); - const expiration = rc.blockNumber + 10; - - expect(tx).to.be.ok; - expect(storage.depositID).to.eq(0); - expect(storage.relayerPremium).to.eq( - ethers.constants.Zero, - ); - expect(storage.amount).to.eq( - price - ); - expect(storage.expirationBlock).to.eq(expiration); - expect(storage.buyerAddress).to.eq(acc02.address); - expect(storage.relayerTarget).to.eq(acc03.address); - expect(storage.relayerAddress).to.eq(acc01.address); - await expect(tx) - .to.emit(p2pix, "LockAdded") - .withArgs( - acc02.address, - lockID, - storage.depositID, - storage.amount, - ); - }); - // edge case test - it("should create multiple locks", async () => { - const newPrice = price.div(ethers.BigNumber.from(2)); - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - const tx1 = await p2pix - .connect(acc01) - .lock( - 0, - acc02.address, - acc03.address, - 0, - newPrice, - proof, - [], - ); - const lockID1 = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, newPrice, acc02.address], - ); - const storage1: Lock = await p2pix.callStatic.mapLocks( - lockID1, - ); - - const rc1: ContractReceipt = await tx1.wait(); - const expiration1 = rc1.blockNumber + 10; - - const tx2 = await p2pix - .connect(acc01) - .lock( - 0, - acc02.address, - acc03.address, - 0, - 100, - [], - [], - ); - const lockID2 = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc02.address], - ); - const storage2: Lock = await p2pix.callStatic.mapLocks( - lockID2, - ); - - const rc2: ContractReceipt = await tx2.wait(); - const expiration2 = rc2.blockNumber + 10; - - const tx3 = await p2pix - .connect(acc03) - .lock( - 0, - acc03.address, - acc03.address, - 0, - 100, - [], - [], - ); - const lockID3 = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc03.address], - ); - const storage3: Lock = await p2pix.callStatic.mapLocks( - lockID3, - ); - - const rc3: ContractReceipt = await tx3.wait(); - const expiration3 = rc3.blockNumber + 10; - - expect(tx1).to.be.ok; - expect(tx2).to.be.ok; - expect(tx3).to.be.ok; - - expect(0) - .to.eq(storage1.depositID) - .and.to.eq(storage2.depositID) - .and.to.eq(storage3.depositID); - - expect(ethers.constants.Zero) - .to.eq(storage1.relayerPremium) - .and.to.eq(storage2.relayerPremium) - .and.to.eq(storage3.relayerPremium); - - expect(storage1.amount).to.eq(newPrice); - expect(ethers.BigNumber.from(100)) - .to.eq(storage2.amount) - .and.to.eq(storage3.amount); - - expect(storage1.expirationBlock).to.eq(expiration1); - expect(storage2.expirationBlock).to.eq(expiration2); - expect(storage3.expirationBlock).to.eq(expiration3); - - expect(acc02.address) - .to.eq(storage1.buyerAddress) - .and.to.eq(storage2.buyerAddress); - expect(storage3.buyerAddress).to.eq(acc03.address); - - expect(acc03.address) - .to.eq(storage1.relayerTarget) - .and.to.eq(storage2.relayerTarget) - .and.to.eq(storage3.relayerTarget); - - expect(acc01.address) - .to.eq(storage1.relayerAddress) - .and.to.eq(storage2.relayerAddress); - expect(storage3.relayerAddress).to.eq(acc03.address); - - await expect(tx1) - .to.emit(p2pix, "LockAdded") - .withArgs( - acc02.address, - lockID1, - storage1.depositID, - storage1.amount, - ); - await expect(tx2) - .to.emit(p2pix, "LockAdded") - .withArgs( - acc02.address, - lockID2, - storage2.depositID, - storage2.amount, - ); - await expect(tx3) - .to.emit(p2pix, "LockAdded") - .withArgs( - acc03.address, - lockID3, - storage3.depositID, - storage3.amount, - ); - }); - }); - describe("Cancel Deposit", async () => { - it("should revert if the msg.sender isn't the deposit's seller", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - const fail = p2pix.connect(acc01).cancelDeposit(0); - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.OnlySeller, - ); - }); - it("should cancel deposit, update storage and emit events", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - const state1: Deposit = - await p2pix.callStatic.mapDeposits(0); - const tx = await p2pix.cancelDeposit(0); - const state2: Deposit = - await p2pix.callStatic.mapDeposits(0); - - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "DepositClosed") - .withArgs(owner.address, 0); - expect(state1.valid).to.be.true; - expect(state2.valid).to.be.false; - }); - it("should cancel multiple deposits", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - ethers.constants.HashZero, - ); - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - ethers.constants.HashZero, - ); - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - ethers.constants.HashZero, - ); - const oldState1: Deposit = - await p2pix.callStatic.mapDeposits(0); - const oldState2: Deposit = - await p2pix.callStatic.mapDeposits(1); - const oldState3: Deposit = - await p2pix.callStatic.mapDeposits(2); - const tx1 = await p2pix.cancelDeposit(0); - const tx2 = await p2pix.cancelDeposit(1); - const tx3 = await p2pix.cancelDeposit(2); - const newState1: Deposit = - await p2pix.callStatic.mapDeposits(0); - const newState2: Deposit = - await p2pix.callStatic.mapDeposits(1); - const newState3: Deposit = - await p2pix.callStatic.mapDeposits(2); - - expect(tx1).to.be.ok; - expect(tx2).to.be.ok; - expect(tx3).to.be.ok; - await expect(tx1) - .to.emit(p2pix, "DepositClosed") - .withArgs(owner.address, 0); - await expect(tx2) - .to.emit(p2pix, "DepositClosed") - .withArgs(owner.address, 1); - await expect(tx3) - .to.emit(p2pix, "DepositClosed") - .withArgs(owner.address, 2); - expect(oldState1.valid).to.be.true; - expect(oldState2.valid).to.be.true; - expect(oldState3.valid).to.be.true; - expect(newState1.valid).to.be.false; - expect(newState2.valid).to.be.false; - expect(newState3.valid).to.be.false; - }); - }); - describe("Release", async () => { - it("should revert if lock has expired", async () => { - const messageToSign = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - ["pixTarget", 100, ethers.constants.HashZero], - ); - const flatSig = await acc01.signMessage( - ethers.utils.arrayify(messageToSign), - ); - const sig = ethers.utils.splitSignature(flatSig); - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 6, - 100, - [], - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc02.address], - ); - await mine(13); - const fail = p2pix.release( - lockID, - acc03.address, - ethers.constants.HashZero, - sig.r, - sig.s, - sig.v, - ); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.LockExpired, - ); - }); - it("should revert if lock has already been released", async () => { - const messageToSign = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - ["pixTarget", 100, ethers.constants.HashZero], - ); - const flatSig = await acc01.signMessage( - ethers.utils.arrayify(messageToSign), - ); - const sig = ethers.utils.splitSignature(flatSig); - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 6, - 100, - [], - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc02.address], - ); - await p2pix.release( - lockID, - acc03.address, - ethers.constants.HashZero, - sig.r, - sig.s, - sig.v, - ); - const fail = p2pix.release( - lockID, - acc03.address, - ethers.constants.HashZero, - sig.r, - sig.s, - sig.v, - ); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.AlreadyReleased, - ); - }); - it("should revert if signed message has already been used", async () => { - const messageToSign = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - ["pixTarget", 100, ethers.constants.HashZero], - ); - const flatSig = await owner.signMessage( - ethers.utils.arrayify(messageToSign), - ); - const sig = ethers.utils.splitSignature(flatSig); - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - ethers.constants.HashZero, - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 6, - 100, - [], - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc02.address], - ); - await p2pix - .connect(acc01) - .release( - lockID, - acc02.address, - ethers.constants.HashZero, - sig.r, - sig.s, - sig.v, - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 6, - 100, - [], - [], - ); - const lockID2 = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc02.address], - ); - const fail = p2pix - .connect(acc01) - .release( - lockID2, - acc02.address, - ethers.constants.HashZero, - sig.r, - sig.s, - sig.v, - ); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.TxAlreadyUsed, - ); - }); - it("should revert if ecrecovered signer is invalid", async () => { - const messageToSign = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - ["pixTarget", 100, ethers.constants.HashZero], - ); - const flatSig = await acc03.signMessage( - ethers.utils.arrayify(messageToSign), - ); - const sig = ethers.utils.splitSignature(flatSig); - - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - ethers.constants.HashZero, - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 6, - 100, - [], - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc02.address], - ); - const fail = p2pix - .connect(acc01) - .release( - lockID, - acc02.address, - ethers.constants.HashZero, - sig.r, - sig.s, - sig.v, - ); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.InvalidSigner, - ); - }); - it("should release lock, update storage and emit events", async () => { - const endtoendID = ethers.constants.HashZero; - const pixTarget = "pixTarget"; - const messageToSign = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - [pixTarget, 100, endtoendID], - ); - // Note: messageToSign is a string, that is 66-bytes long, to sign the - // binary value, we must convert it to the 32 byte Array that - // the string represents - // - // i.e., - // 66-byte string - // "0x592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba" - // ... vs ... - // 32 entry Uint8Array - // [ 89, 47, 167, 67, 136, 159, ... 103, 7, 186] - const messageHashBytes = - ethers.utils.arrayify(messageToSign); - const flatSig = await acc01.signMessage( - messageHashBytes, - ); - const sig = ethers.utils.splitSignature(flatSig); - const root = ethers.constants.HashZero; - - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - pixTarget, - root, - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 6, - 100, - [], - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc02.address], - ); - const acc01Key = await p2pix.callStatic._castAddrToKey( - acc01.address, - ); - const acc03Key = await p2pix.callStatic._castAddrToKey( - acc03.address, - ); - const userRecordA = await p2pix.callStatic.userRecord( - acc01Key, - ); - const userRecord1 = await p2pix.callStatic.userRecord( - acc03Key, - ); - const storage1: Lock = await p2pix.callStatic.mapLocks( - lockID, - ); - const tx = await p2pix - .connect(acc01) - .release( - lockID, - acc02.address, - endtoendID, - sig.r, - sig.s, - sig.v, - ); - const storage2: Lock = await p2pix.callStatic.mapLocks( - lockID, - ); - const userRecordB = await p2pix.callStatic.userRecord( - acc01Key, - ); - const userRecord2 = await p2pix.callStatic.userRecord( - acc03Key, - ); - const used = await p2pix.callStatic.usedTransactions( - messageHashBytes, - ); - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "LockReleased") - .withArgs(acc02.address, lockID); - expect(storage1.expirationBlock).to.eq( - ethers.BigNumber.from(16), - ); - expect(storage1.amount).to.eq( - ethers.BigNumber.from(100), - ); - expect(storage2.expirationBlock).to.eq( - ethers.BigNumber.from(0), - ); - expect(storage2.amount).to.eq(ethers.BigNumber.from(0)); - expect(used).to.eq(true); - expect(userRecordA).to.eq(ethers.constants.Zero); - expect(userRecord1).to.eq(ethers.constants.Zero); - expect(userRecordB).to.eq(ethers.BigNumber.from(6)); - expect(userRecord2).to.eq(ethers.BigNumber.from(100)); - await expect(tx).to.changeTokenBalances( - erc20, - [acc03.address, acc02.address], - [3, 97], - // acc02 is acting both as buyer and relayerTarget - // (i.e., 94 + 3 = 97) - ); - }); - // edge case test - it("should release multiple locks", async () => { - const endtoendID = ethers.constants.HashZero; - const pixTarget = "pixTarget"; - const root = ethers.constants.HashZero; - const acc01Key = - await p2pix.callStatic._castAddrToKey(acc01.address); - const acc03Key = - await p2pix.callStatic._castAddrToKey(acc03.address); - const acc01Record1 = - await p2pix.callStatic.userRecord(acc01Key); - const acc03Record1 = - await p2pix.callStatic.userRecord(acc03Key); - const messageToSign1 = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - [pixTarget, 100, endtoendID]); - const flatSig1 = await owner.signMessage( - ethers.utils.arrayify(messageToSign1)); - const sig1 = ethers.utils.splitSignature(flatSig1); - const messageToSign2 = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - [pixTarget, 50, endtoendID]); - const flatSig2 = await owner.signMessage( - ethers.utils.arrayify(messageToSign2)); - const sig2 = ethers.utils.splitSignature(flatSig2); - const messageToSign3 = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - [pixTarget, 25, endtoendID]); - const flatSig3 = await owner.signMessage( - ethers.utils.arrayify(messageToSign3)); - const sig3 = ethers.utils.splitSignature(flatSig3); - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - pixTarget, - root, - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 0, - 100, - [], - [], - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 6, - 50, - [], - [], - ); - await p2pix - .connect(acc03) - .lock( - 0, - acc02.address, - acc03.address, - 10, - 25, - [], - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 100, acc02.address], - ); - const lockID2 = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 50, acc02.address], - ); - const lockID3 = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 25, acc02.address], - ); - // relayerPremium == 0 - const tx = await p2pix - .connect(acc01) - .release( - lockID, - acc02.address, - endtoendID, - sig1.r, - sig1.s, - sig1.v, - ); - // relayerPremium != 0 && - // lock's msg.sender != release's msg.sender - const tx1 = await p2pix - .connect(acc01) - .release( - lockID2, - acc02.address, - endtoendID, - sig2.r, - sig2.s, - sig2.v, - ); - // relayerPremium != 0 && - // lock's msg.sender == release's msg.sender - const tx2 = await p2pix - .connect(acc03) - .release( - lockID3, - acc02.address, - endtoendID, - sig3.r, - sig3.s, - sig3.v, - ); - const used1 = await p2pix.callStatic.usedTransactions( - ethers.utils.arrayify(messageToSign1), - ); - const used2 = await p2pix.callStatic.usedTransactions( - ethers.utils.arrayify(messageToSign2), - ); - const used3 = await p2pix.callStatic.usedTransactions( - ethers.utils.arrayify(messageToSign3), - ); - const acc01Record2 = - await p2pix.callStatic.userRecord(acc01Key); - const acc03Record2 = - await p2pix.callStatic.userRecord(acc03Key); - - expect(tx).to.be.ok; - expect(tx1).to.be.ok; - expect(tx2).to.be.ok; - await expect(tx) - .to.emit(p2pix, "LockReleased") - .withArgs(acc02.address, lockID); - await expect(tx1) - .to.emit(p2pix, "LockReleased") - .withArgs(acc02.address, lockID2); - await expect(tx2) - .to.emit(p2pix, "LockReleased") - .withArgs(acc02.address, lockID3); - expect(used1).to.eq(true); - expect(used2).to.eq(true); - expect(used3).to.eq(true); - expect(0).to.eq(acc01Record1).and.to.eq(acc03Record1); - expect(acc01Record2).to.eq(6); // 0 + 6 - expect(acc03Record2).to.eq(185); // 100 + 50 + 25 + 10 - await expect(tx).to.changeTokenBalances( - erc20, - [ - acc01.address, - acc02.address, - acc03.address, - p2pix.address - ], - [ - 0, - 100, - 0, - "-100" - ], - ); - await expect(tx1).to.changeTokenBalances( - erc20, - [ - acc01.address, - acc02.address, - acc03.address, - p2pix.address - ], - [ - 0, - 47, - 3, - "-50" - ], - ); - await expect(tx2).to.changeTokenBalances( - erc20, - [ - acc01.address, - acc02.address, - acc03.address, - p2pix.address - ], - [ - 0, - 20, - 5, - "-25" - ], - ); - }); - }); - describe("Unexpire Locks", async () => { - it("should revert if lock isn't expired", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - await p2pix - .connect(acc02) - .lock(0, acc02.address, acc03.address, 0, 1, [], []); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 1, acc02.address], - ); - const fail = p2pix.unlockExpired([lockID]); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.NotExpired, - ); - }); - it("should revert if lock has already been released", async () => { - const endtoendID = ethers.constants.HashZero; - const pixTarget = "pixTarget"; - const messageToSign = ethers.utils.solidityKeccak256( - ["string", "uint256", "bytes32"], - [pixTarget, 1, endtoendID], - ); - const messageHashBytes = - ethers.utils.arrayify(messageToSign); - const flatSig = await acc01.signMessage( - messageHashBytes, - ); - const sig = ethers.utils.splitSignature(flatSig); - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - pixTarget, - merkleRoot, - ); - await p2pix - .connect(acc02) - .lock(0, acc02.address, acc03.address, 0, 1, [], []); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 1, acc02.address], - ); - // await mine(10); - await p2pix.release( - lockID, - acc03.address, - endtoendID, - sig.r, - sig.s, - sig.v, - ); - const fail = p2pix.unlockExpired([lockID]); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.AlreadyReleased, - ); - }); - it("should unlock expired locks, update storage and emit events", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - await p2pix - .connect(acc02) - .lock(0, acc02.address, acc03.address, 0, 1, [], []); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, 1, acc02.address], - ); - await mine(11); - const storage: Lock = await p2pix.callStatic.mapLocks( - lockID, - ); - const userKey = await p2pix.callStatic._castAddrToKey( - acc02.address, - ); - const record1 = await p2pix.callStatic.userRecord( - userKey, - ); - const tx = await p2pix.unlockExpired([lockID]); - const storage2: Lock = await p2pix.callStatic.mapLocks( - lockID, - ); - const record2 = await p2pix.callStatic.userRecord( - userKey, - ); - - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "LockReturned") - .withArgs(acc02.address, lockID); - expect(storage.amount).to.eq(ethers.constants.One); - expect(storage2.amount).to.eq(ethers.constants.Zero); - expect(record1).to.eq(0); - expect(record2).to.eq(price); - }); - it("should unlock expired through lock function", async () => { - // test method through lock fx - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - const lock1: ContractTransaction = await p2pix - .connect(acc01) - .lock( - 0, - acc02.address, - acc03.address, - 0, - price, - proof, - [], - ); - // as return values of non view functions can't be accessed - // outside the evm, we fetch the lockID from the emitted event. - const rc: ContractReceipt = await lock1.wait(); - const event = rc.events?.find( - event => event.event === "LockAdded", - ); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const emittedLockID = event?.args!["lockID"]; - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, price, acc02.address], - ); - - // mine blocks to expire lock - await mine(12); - // const blocknum = await p2pix.provider.getBlockNumber(); - // console.log("bn = 6 + 12 ( i.e., %s )", blocknum); - // console.log( - // "\n", - // " 2 blocks past the expiration block", - // ); - // const struct2: Lock = await p2pix.callStatic.mapLocks( - // emittedLockID, - // ); - // console.log( - // "\n", - // "Current state of the lock:", - // "\n", - // struct2, - // ); - - expect(emittedLockID).to.eq(lockID); - - // create another lock by freeing the price value - // back to `l.remamining` and lock 100 again. - const tx1 = await p2pix.lock( - 0, - acc02.address, - acc03.address, - 0, - 100, - [], - [lockID], - ); - const dep: Deposit = await p2pix.callStatic.mapDeposits( - 0, - ); - - expect(tx1).to.be.ok; - await expect(tx1) - .to.emit(p2pix, "LockReturned") - .withArgs(acc02.address, lockID); - expect(dep.remaining).to.eq( - price.sub(ethers.BigNumber.from(100)), - ); - }); - it("should unlock expired through withdraw function", async () => { - // test method through withdraw fx - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - await p2pix - .connect(acc01) - .lock( - 0, - acc02.address, - acc03.address, - 0, - price, - proof, - [], - ); - const lockID = ethers.utils.solidityKeccak256( - ["uint256", "uint256", "address"], - [0, price, acc02.address], - ); - // mine blocks to expire lock - await mine(11); - const tx = await p2pix.withdraw(0, [lockID]); - const dep: Deposit = await p2pix.callStatic.mapDeposits( - 0, - ); - - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "LockReturned") - .withArgs(acc02.address, lockID); - expect(dep.remaining).to.eq(0); - }); - }); - describe("Seller Withdraw", async () => { - it("should revert if the msg.sender isn't the deposit's seller", async () => { - await erc20.approve(p2pix.address, price); - await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - const fail = p2pix.connect(acc02).withdraw(0, []); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.OnlySeller, - ); - }); - it("should withdraw remaining funds from deposit, update storage and emit event", async () => { - await erc20.approve(p2pix.address, price); - const dep = await p2pix.deposit( - erc20.address, - price, - "pixTarget", - merkleRoot, - ); - const tx = await p2pix.withdraw(0, []); - - expect(tx).to.be.ok; - await expect(dep) - .to.changeTokenBalance( - erc20, - owner.address, - "-100000000000000000000", - ) - .and.to.changeTokenBalance( - erc20, - p2pix.address, - price, - ); - await expect(tx) - .to.changeTokenBalance(erc20, owner.address, price) - .and.to.changeTokenBalance( - erc20, - p2pix.address, - "-100000000000000000000", - ); - - await expect(tx) - .to.emit(p2pix, "DepositWithdrawn") - .withArgs(owner.address, 0, price); - }); - }); - describe("Allowlist Settings", async () => { - it("should revert if the msg.sender differs from deposit's seller", async () => { - const root = ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("root"), - ); - const fail = p2pix - .connect(acc02) - .setRoot(owner.address, root); - - await expect(fail).to.be.revertedWithCustomError( - p2pix, - P2PixErrors.OnlySeller, - ); - }); - it("should set root of seller's allowlist, update storage and emit event", async () => { - const ownerKey = await p2pix.callStatic._castAddrToKey( - owner.address, - ); - const oldState = await p2pix.callStatic.sellerAllowList( - ownerKey, - ); - const tx = await p2pix - .connect(owner) - .setRoot(owner.address, merkleRoot); - const newState = await p2pix.callStatic.sellerAllowList( - ownerKey, - ); - - expect(tx).to.be.ok; - await expect(tx) - .to.emit(p2pix, "RootUpdated") - .withArgs(owner.address, merkleRoot); - expect(oldState).to.eq(ethers.constants.HashZero); - expect(newState).to.eq(merkleRoot); - }); - }); -}); +// import "@nomicfoundation/hardhat-chai-matchers"; +// import { +// loadFixture, +// mine, +// } from "@nomicfoundation/hardhat-network-helpers"; +// import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +// import { expect } from "chai"; +// import { +// BigNumber, +// ContractReceipt, +// ContractTransaction, +// Wallet, +// } from "ethers"; +// import { +// ethers, +// network, +// /* tracer */ +// } from "hardhat"; + +// // import keccak256 from "keccak256"; +// import { MockToken, P2PIX, Reputation } from "../src/types"; +// import { P2PixErrors } from "./utils/errors"; +// import { +// Deposit, +// Lock, +// getSignerAddrs, +// p2pixFixture, +// randomSigners, +// } 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 +// let merkleRoot: string; // MerkleRoot from seller's allowlist +// let proof: string[]; // Owner's proof as whitelisted address + +// 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, merkleRoot, proof } = +// await loadFixture(p2pixFixture)); +// }); + +// describe("Init", async () => { +// it("P2PIX, Reputation and ERC20 should initialize", async () => { +// // tracer.enabled = true; +// await p2pix.deployed(); +// // tracer.enabled = false; +// 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(10); +// 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(10) +// .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 owner to withdraw contract's balance", async () => { +// const oldBal = await p2pix.provider.getBalance( +// p2pix.address, +// ); +// // this call also tests p2pix's receive() fallback mechanism. +// 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"], +// ) +// .and.to.emit(p2pix, "FundsWithdrawn") +// .withArgs(owner.address, price); + +// await expect( +// p2pix.connect(acc01).withdrawBalance(), +// ).to.be.revertedWith(P2PixErrors.UNAUTHORIZED); +// }); +// it("should allow owner to change reputation instance", async () => { +// const tx = await p2pix.setReputation(acc03.address); +// const newRep = await p2pix.callStatic.reputation(); +// const fail = p2pix +// .connect(acc02) +// .setReputation(owner.address); + +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "ReputationUpdated") +// .withArgs(acc03.address); +// expect(newRep).to.eq(acc03.address); +// await expect(fail).to.be.revertedWith( +// P2PixErrors.UNAUTHORIZED, +// ); +// }); +// it("should allow owner to change defaultLockBlocks ", async () => { +// const magicVal = 1337; +// const tx = await p2pix.setDefaultLockBlocks(magicVal); +// const newVal = +// await p2pix.callStatic.defaultLockBlocks(); +// const fail = p2pix +// .connect(acc02) +// .setDefaultLockBlocks(0); + +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "LockBlocksUpdated") +// .withArgs(magicVal); +// expect(newVal).to.eq(magicVal); +// await expect(fail).to.be.revertedWith( +// P2PixErrors.UNAUTHORIZED, +// ); +// }); +// it("should allow owner to add valid Bacen signers", async () => { +// const newSigners = randomSigners(2); +// const bob = await newSigners[0].getAddress(); +// const alice = await newSigners[1].getAddress(); +// const bobCasted = await p2pix._castAddrToKey(bob); +// const aliceCasted = await p2pix._castAddrToKey(alice); +// const tx = await p2pix.setValidSigners([bob, alice]); +// const newSigner1 = +// await p2pix.callStatic.validBacenSigners(bobCasted); +// const newSigner2 = +// await p2pix.callStatic.validBacenSigners(aliceCasted); +// const fail = p2pix +// .connect(acc03) +// .setValidSigners([owner.address, acc02.address]); + +// expect(tx).to.be.ok; +// expect(newSigner1).to.eq(true); +// expect(newSigner2).to.eq(true); +// await expect(tx) +// .to.emit(p2pix, "ValidSignersUpdated") +// .withArgs([bob, alice]); +// await expect(fail).to.be.revertedWith( +// P2PixErrors.UNAUTHORIZED, +// ); +// }); +// it("should allow owner to adjust tokenSettings", async () => { +// const tx = await p2pix.tokenSettings( +// [erc20.address, owner.address], +// [false, true], +// ); +// const newTokenState1 = +// await p2pix.callStatic.allowedERC20s(erc20.address); +// const newTokenState2 = +// await p2pix.callStatic.allowedERC20s(owner.address); +// const fail = p2pix +// .connect(acc01) +// .tokenSettings([acc01.address], [false]); +// const fail2 = p2pix.tokenSettings([], [true, false]); +// const fail3 = p2pix.tokenSettings([zero], [true, true]); + +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "AllowedERC20Updated") +// .withArgs(erc20.address, false) +// .and.to.emit(p2pix, "AllowedERC20Updated") +// .withArgs(owner.address, true); +// expect(newTokenState1).to.eq(false); +// expect(newTokenState2).to.eq(true); +// await expect(fail).to.be.revertedWith( +// P2PixErrors.UNAUTHORIZED, +// ); +// await expect(fail).to.be.revertedWith( +// P2PixErrors.UNAUTHORIZED, +// ); +// await expect(fail2).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.NoTokens, +// ); +// await expect(fail3).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.LengthMismatch, +// ); +// }); +// }); +// describe("Deposit", async () => { +// it("should revert if ERC20 is not allowed", async () => { +// const pTarget = ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("_pixTarget"), +// ); +// const root = ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("root"), +// ); +// const tx = p2pix.deposit( +// owner.address, +// 1, +// pTarget, +// root, +// ); + +// await expect(tx).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.TokenDenied, +// ); +// }); +// it("should create deposit, update storage and emit event", async () => { +// const pTarget = ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("_pixTarget"), +// ); +// // we use `hashZero` to avoid updating seller's allowlist settings +// const root = ethers.constants.HashZero; +// await erc20.approve(p2pix.address, price); +// const tx = await p2pix.deposit( +// erc20.address, +// price, +// pTarget, +// root, +// ); +// const storage: Deposit = await p2pix.mapDeposits(0); +// const ownerKey = await p2pix.callStatic._castAddrToKey( +// owner.address, +// ); +// const allowList = await p2pix.sellerAllowList(ownerKey); + +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "DepositAdded") +// .withArgs(owner.address, 0, erc20.address, price); +// await expect(tx).to.changeTokenBalances( +// erc20, +// [owner.address, p2pix.address], +// ["-100000000000000000000", price], +// ); +// expect(storage.remaining).to.eq(price); +// expect(storage.pixTarget).to.eq(pTarget); +// expect(storage.seller).to.eq(owner.address); +// expect(storage.token).to.eq(erc20.address); +// expect(storage.valid).to.eq(true); +// expect(allowList).to.eq(root); +// }); +// // edge case test +// it("should create multiple deposits", async () => { +// const ownerKey = await p2pix.callStatic._castAddrToKey( +// owner.address, +// ); +// const acc01Key = await p2pix.callStatic._castAddrToKey( +// acc01.address, +// ); +// const acc02Key = await p2pix.callStatic._castAddrToKey( +// acc02.address, +// ); +// const acc03Key = await p2pix.callStatic._castAddrToKey( +// acc03.address, +// ); + +// const pTarget = ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("_pixTarget"), +// ); +// const pTarget2 = ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("_pixTarget2"), +// ); +// const pTarget3 = ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("_pixTarget3"), +// ); +// // we mock the allowlist root here only to test storage update. In depth +// // allowlist test coverage in both "Lock" and "Allowlist Settings" unit tests. +// const root = ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("root"), +// ); +// const nullRoot = ethers.constants.HashZero; +// const price2 = price.mul(ethers.BigNumber.from(2)); +// const price3 = price.mul(ethers.BigNumber.from(3)); +// const price4 = price.mul(ethers.BigNumber.from(4)); +// await erc20.mint( +// getSignerAddrs(4, await ethers.getSigners()), +// price4, +// ); +// await erc20 +// .connect(owner) +// .approve(p2pix.address, price); +// await erc20 +// .connect(acc01) +// .approve(p2pix.address, price2); +// await erc20 +// .connect(acc02) +// .approve(p2pix.address, price3); +// await erc20 +// .connect(acc03) +// .approve(p2pix.address, price4); + +// const tx = await p2pix +// .connect(owner) +// .deposit(erc20.address, price, pTarget, root); +// const tx2 = await p2pix +// .connect(acc01) +// .deposit(erc20.address, price2, pTarget2, nullRoot); +// const tx3 = await p2pix +// .connect(acc02) +// .deposit(erc20.address, price3, pTarget3, root); +// const tx4 = await p2pix +// .connect(acc03) +// .deposit(erc20.address, price4, pTarget, nullRoot); + +// const storage1: Deposit = await p2pix.mapDeposits(0); +// const storage2: Deposit = await p2pix.mapDeposits(1); +// const storage3: Deposit = await p2pix.mapDeposits(2); +// const storage4: Deposit = await p2pix.mapDeposits(3); + +// const allowList1 = await p2pix.sellerAllowList( +// ownerKey, +// ); +// const allowList2 = await p2pix.sellerAllowList( +// acc01Key, +// ); +// const allowList3 = await p2pix.sellerAllowList( +// acc02Key, +// ); +// const allowList4 = await p2pix.sellerAllowList( +// acc03Key, +// ); + +// expect(tx).to.be.ok; +// expect(tx2).to.be.ok; +// expect(tx3).to.be.ok; +// expect(tx4).to.be.ok; + +// await expect(tx) +// .to.emit(p2pix, "DepositAdded") +// .withArgs(owner.address, 0, erc20.address, price); +// await expect(tx).to.changeTokenBalances( +// erc20, +// [owner.address, p2pix.address], +// ["-100000000000000000000", price], +// ); + +// await expect(tx2) +// .to.emit(p2pix, "DepositAdded") +// .withArgs(acc01.address, 1, erc20.address, price2); +// await expect(tx2).to.changeTokenBalances( +// erc20, +// [acc01.address, p2pix.address], +// ["-200000000000000000000", price2], +// ); + +// await expect(tx3) +// .to.emit(p2pix, "DepositAdded") +// .withArgs(acc02.address, 2, erc20.address, price3); +// await expect(tx3).to.changeTokenBalances( +// erc20, +// [acc02.address, p2pix.address], +// ["-300000000000000000000", price3], +// ); + +// await expect(tx4) +// .to.emit(p2pix, "DepositAdded") +// .withArgs(acc03.address, 3, erc20.address, price4); +// await expect(tx4).to.changeTokenBalances( +// erc20, +// [acc03.address, p2pix.address], +// ["-400000000000000000000", price4], +// ); + +// expect(storage1.remaining).to.eq(price); +// expect(storage1.pixTarget).to.eq(pTarget); +// expect(storage1.seller).to.eq(owner.address); +// expect(storage1.token).to.eq(erc20.address); +// expect(storage1.valid).to.eq(true); +// expect(allowList1).to.eq(root); + +// expect(storage2.remaining).to.eq(price2); +// expect(storage2.pixTarget).to.eq(pTarget2); +// expect(storage2.seller).to.eq(acc01.address); +// expect(storage2.token).to.eq(erc20.address); +// expect(storage2.valid).to.eq(true); +// expect(allowList2).to.eq(nullRoot); + +// expect(storage3.remaining).to.eq(price3); +// expect(storage3.pixTarget).to.eq(pTarget3); +// expect(storage3.seller).to.eq(acc02.address); +// expect(storage3.token).to.eq(erc20.address); +// expect(storage3.valid).to.eq(true); +// expect(allowList3).to.eq(root); + +// expect(storage4.remaining).to.eq(price4); +// expect(storage4.pixTarget).to.eq(pTarget); +// expect(storage4.seller).to.eq(acc03.address); +// expect(storage4.token).to.eq(erc20.address); +// expect(storage4.valid).to.eq(true); +// expect(allowList4).to.eq(nullRoot); +// }); +// }); +// describe("Lock", async () => { +// it("should revert if deposit is invalid", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// ethers.constants.HashZero, +// ); +// await p2pix.cancelDeposit(0); +// const fail = p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// price, +// [], +// [], +// ); +// const fail2 = p2pix.lock( +// 2, +// zero, +// zero, +// 0, +// price, +// [], +// [], +// ); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.InvalidDeposit, +// ); +// await expect(fail2).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.InvalidDeposit, +// ); +// }); +// it("should revert if wished amount is greater than deposit's remaining amount", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// ethers.constants.HashZero, +// ); +// const fail = p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// price.mul(ethers.BigNumber.from(2)), +// [], +// [], +// ); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.NotEnoughTokens, +// ); +// }); +// it("should revert if a non expired lock has the same ID encoded", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// ethers.constants.HashZero, +// ); +// await p2pix +// .connect(acc03) +// .lock(0, acc02.address, acc03.address, 0, 1, [], []); +// const fail = p2pix +// .connect(acc03) +// .lock(0, acc02.address, acc03.address, 0, 1, [], []); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.NotExpired, +// ); +// }); +// it("should revert if an invalid allowlist merkleproof is provided", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// const fail = p2pix +// .connect(acc02) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// 1000, +// [ +// ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("wrong"), +// ), +// ], +// [], +// ); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.AddressDenied, +// ); +// }); +// it("should revert if msg.sender does not have enough credit in his spend limit", async () => { +// await erc20.approve( +// p2pix.address, +// price.mul(BigNumber.from("3")), +// ); +// await p2pix.deposit( +// erc20.address, +// price.mul(BigNumber.from("3")), +// "pixTarget", +// merkleRoot, +// ); +// const fail = p2pix +// .connect(acc02) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// price.mul(BigNumber.from("2")), +// [], +// [], +// ); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.AmountNotAllowed, +// ); +// }); +// it("should create a lock, update storage and emit events via the allowlist path", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// const tx = await p2pix +// .connect(acc01) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// price, +// proof, +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, price, acc02.address], +// ); +// const storage: Lock = await p2pix.callStatic.mapLocks( +// lockID, +// ); + +// const rc: ContractReceipt = await tx.wait(); +// const expiration = rc.blockNumber + 10; + +// expect(tx).to.be.ok; +// expect(storage.depositID).to.eq(0); +// expect(storage.relayerPremium).to.eq( +// ethers.constants.Zero, +// ); +// expect(storage.amount).to.eq(price); +// expect(storage.expirationBlock).to.eq(expiration); +// expect(storage.buyerAddress).to.eq(acc02.address); +// expect(storage.relayerTarget).to.eq(acc03.address); +// expect(storage.relayerAddress).to.eq(acc01.address); +// await expect(tx) +// .to.emit(p2pix, "LockAdded") +// .withArgs( +// acc02.address, +// lockID, +// storage.depositID, +// storage.amount, +// ); +// }); +// it("should create a lock, update storage and emit events via the reputation path", async () => { +// const root = ethers.constants.HashZero; +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// root, +// ); +// const tx = await p2pix +// .connect(acc01) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// price, +// [], +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, price, acc02.address], +// ); +// const storage: Lock = await p2pix.callStatic.mapLocks( +// lockID, +// ); + +// const rc: ContractReceipt = await tx.wait(); +// const expiration = rc.blockNumber + 10; + +// expect(tx).to.be.ok; +// expect(storage.depositID).to.eq(0); +// expect(storage.relayerPremium).to.eq( +// ethers.constants.Zero, +// ); +// expect(storage.amount).to.eq(price); +// expect(storage.expirationBlock).to.eq(expiration); +// expect(storage.buyerAddress).to.eq(acc02.address); +// expect(storage.relayerTarget).to.eq(acc03.address); +// expect(storage.relayerAddress).to.eq(acc01.address); +// await expect(tx) +// .to.emit(p2pix, "LockAdded") +// .withArgs( +// acc02.address, +// lockID, +// storage.depositID, +// storage.amount, +// ); +// }); +// // edge case test +// it("should create multiple locks", async () => { +// const newPrice = price.div(ethers.BigNumber.from(2)); +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// const tx1 = await p2pix +// .connect(acc01) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// newPrice, +// proof, +// [], +// ); +// const lockID1 = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, newPrice, acc02.address], +// ); +// const storage1: Lock = await p2pix.callStatic.mapLocks( +// lockID1, +// ); + +// const rc1: ContractReceipt = await tx1.wait(); +// const expiration1 = rc1.blockNumber + 10; + +// const tx2 = await p2pix +// .connect(acc01) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// 100, +// [], +// [], +// ); +// const lockID2 = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc02.address], +// ); +// const storage2: Lock = await p2pix.callStatic.mapLocks( +// lockID2, +// ); + +// const rc2: ContractReceipt = await tx2.wait(); +// const expiration2 = rc2.blockNumber + 10; + +// const tx3 = await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc03.address, +// acc03.address, +// 0, +// 100, +// [], +// [], +// ); +// const lockID3 = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc03.address], +// ); +// const storage3: Lock = await p2pix.callStatic.mapLocks( +// lockID3, +// ); + +// const rc3: ContractReceipt = await tx3.wait(); +// const expiration3 = rc3.blockNumber + 10; + +// expect(tx1).to.be.ok; +// expect(tx2).to.be.ok; +// expect(tx3).to.be.ok; + +// expect(0) +// .to.eq(storage1.depositID) +// .and.to.eq(storage2.depositID) +// .and.to.eq(storage3.depositID); + +// expect(ethers.constants.Zero) +// .to.eq(storage1.relayerPremium) +// .and.to.eq(storage2.relayerPremium) +// .and.to.eq(storage3.relayerPremium); + +// expect(storage1.amount).to.eq(newPrice); +// expect(ethers.BigNumber.from(100)) +// .to.eq(storage2.amount) +// .and.to.eq(storage3.amount); + +// expect(storage1.expirationBlock).to.eq(expiration1); +// expect(storage2.expirationBlock).to.eq(expiration2); +// expect(storage3.expirationBlock).to.eq(expiration3); + +// expect(acc02.address) +// .to.eq(storage1.buyerAddress) +// .and.to.eq(storage2.buyerAddress); +// expect(storage3.buyerAddress).to.eq(acc03.address); + +// expect(acc03.address) +// .to.eq(storage1.relayerTarget) +// .and.to.eq(storage2.relayerTarget) +// .and.to.eq(storage3.relayerTarget); + +// expect(acc01.address) +// .to.eq(storage1.relayerAddress) +// .and.to.eq(storage2.relayerAddress); +// expect(storage3.relayerAddress).to.eq(acc03.address); + +// await expect(tx1) +// .to.emit(p2pix, "LockAdded") +// .withArgs( +// acc02.address, +// lockID1, +// storage1.depositID, +// storage1.amount, +// ); +// await expect(tx2) +// .to.emit(p2pix, "LockAdded") +// .withArgs( +// acc02.address, +// lockID2, +// storage2.depositID, +// storage2.amount, +// ); +// await expect(tx3) +// .to.emit(p2pix, "LockAdded") +// .withArgs( +// acc03.address, +// lockID3, +// storage3.depositID, +// storage3.amount, +// ); +// }); +// }); +// describe("Cancel Deposit", async () => { +// it("should revert if the msg.sender isn't the deposit's seller", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// const fail = p2pix.connect(acc01).cancelDeposit(0); +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.OnlySeller, +// ); +// }); +// it("should cancel deposit, update storage and emit events", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// const state1: Deposit = +// await p2pix.callStatic.mapDeposits(0); +// const tx = await p2pix.cancelDeposit(0); +// const state2: Deposit = +// await p2pix.callStatic.mapDeposits(0); + +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "DepositClosed") +// .withArgs(owner.address, 0); +// expect(state1.valid).to.be.true; +// expect(state2.valid).to.be.false; +// }); +// it("should cancel multiple deposits", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// ethers.constants.HashZero, +// ); +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// ethers.constants.HashZero, +// ); +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// ethers.constants.HashZero, +// ); +// const oldState1: Deposit = +// await p2pix.callStatic.mapDeposits(0); +// const oldState2: Deposit = +// await p2pix.callStatic.mapDeposits(1); +// const oldState3: Deposit = +// await p2pix.callStatic.mapDeposits(2); +// const tx1 = await p2pix.cancelDeposit(0); +// const tx2 = await p2pix.cancelDeposit(1); +// const tx3 = await p2pix.cancelDeposit(2); +// const newState1: Deposit = +// await p2pix.callStatic.mapDeposits(0); +// const newState2: Deposit = +// await p2pix.callStatic.mapDeposits(1); +// const newState3: Deposit = +// await p2pix.callStatic.mapDeposits(2); + +// expect(tx1).to.be.ok; +// expect(tx2).to.be.ok; +// expect(tx3).to.be.ok; +// await expect(tx1) +// .to.emit(p2pix, "DepositClosed") +// .withArgs(owner.address, 0); +// await expect(tx2) +// .to.emit(p2pix, "DepositClosed") +// .withArgs(owner.address, 1); +// await expect(tx3) +// .to.emit(p2pix, "DepositClosed") +// .withArgs(owner.address, 2); +// expect(oldState1.valid).to.be.true; +// expect(oldState2.valid).to.be.true; +// expect(oldState3.valid).to.be.true; +// expect(newState1.valid).to.be.false; +// expect(newState2.valid).to.be.false; +// expect(newState3.valid).to.be.false; +// }); +// }); +// describe("Release", async () => { +// it("should revert if lock has expired", async () => { +// const messageToSign = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// ["pixTarget", 100, ethers.constants.HashZero], +// ); +// const flatSig = await acc01.signMessage( +// ethers.utils.arrayify(messageToSign), +// ); +// const sig = ethers.utils.splitSignature(flatSig); +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 6, +// 100, +// [], +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc02.address], +// ); +// await mine(13); +// const fail = p2pix.release( +// lockID, +// acc03.address, +// ethers.constants.HashZero, +// sig.r, +// sig.s, +// sig.v, +// ); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.LockExpired, +// ); +// }); +// it("should revert if lock has already been released", async () => { +// const messageToSign = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// ["pixTarget", 100, ethers.constants.HashZero], +// ); +// const flatSig = await acc01.signMessage( +// ethers.utils.arrayify(messageToSign), +// ); +// const sig = ethers.utils.splitSignature(flatSig); +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 6, +// 100, +// [], +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc02.address], +// ); +// await p2pix.release( +// lockID, +// acc03.address, +// ethers.constants.HashZero, +// sig.r, +// sig.s, +// sig.v, +// ); +// const fail = p2pix.release( +// lockID, +// acc03.address, +// ethers.constants.HashZero, +// sig.r, +// sig.s, +// sig.v, +// ); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.AlreadyReleased, +// ); +// }); +// it("should revert if signed message has already been used", async () => { +// const messageToSign = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// ["pixTarget", 100, ethers.constants.HashZero], +// ); +// const flatSig = await owner.signMessage( +// ethers.utils.arrayify(messageToSign), +// ); +// const sig = ethers.utils.splitSignature(flatSig); +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// ethers.constants.HashZero, +// ); +// await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 6, +// 100, +// [], +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc02.address], +// ); +// await p2pix +// .connect(acc01) +// .release( +// lockID, +// acc02.address, +// ethers.constants.HashZero, +// sig.r, +// sig.s, +// sig.v, +// ); +// await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 6, +// 100, +// [], +// [], +// ); +// const lockID2 = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc02.address], +// ); +// const fail = p2pix +// .connect(acc01) +// .release( +// lockID2, +// acc02.address, +// ethers.constants.HashZero, +// sig.r, +// sig.s, +// sig.v, +// ); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.TxAlreadyUsed, +// ); +// }); +// it("should revert if ecrecovered signer is invalid", async () => { +// const messageToSign = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// ["pixTarget", 100, ethers.constants.HashZero], +// ); +// const flatSig = await acc03.signMessage( +// ethers.utils.arrayify(messageToSign), +// ); +// const sig = ethers.utils.splitSignature(flatSig); + +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// ethers.constants.HashZero, +// ); +// await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 6, +// 100, +// [], +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc02.address], +// ); +// const fail = p2pix +// .connect(acc01) +// .release( +// lockID, +// acc02.address, +// ethers.constants.HashZero, +// sig.r, +// sig.s, +// sig.v, +// ); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.InvalidSigner, +// ); +// }); +// it("should release lock, update storage and emit events", async () => { +// const endtoendID = ethers.constants.HashZero; +// const pixTarget = "pixTarget"; +// const messageToSign = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// [pixTarget, 100, endtoendID], +// ); +// // Note: messageToSign is a string, that is 66-bytes long, to sign the +// // binary value, we must convert it to the 32 byte Array that +// // the string represents +// // +// // i.e., +// // 66-byte string +// // "0x592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba" +// // ... vs ... +// // 32 entry Uint8Array +// // [ 89, 47, 167, 67, 136, 159, ... 103, 7, 186] +// const messageHashBytes = +// ethers.utils.arrayify(messageToSign); +// const flatSig = await acc01.signMessage( +// messageHashBytes, +// ); +// const sig = ethers.utils.splitSignature(flatSig); +// const root = ethers.constants.HashZero; + +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// pixTarget, +// root, +// ); +// await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 6, +// 100, +// [], +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc02.address], +// ); +// const acc01Key = await p2pix.callStatic._castAddrToKey( +// acc01.address, +// ); +// const acc03Key = await p2pix.callStatic._castAddrToKey( +// acc03.address, +// ); +// const userRecordA = await p2pix.callStatic.userRecord( +// acc01Key, +// ); +// const userRecord1 = await p2pix.callStatic.userRecord( +// acc03Key, +// ); +// const storage1: Lock = await p2pix.callStatic.mapLocks( +// lockID, +// ); +// const tx = await p2pix +// .connect(acc01) +// .release( +// lockID, +// acc02.address, +// endtoendID, +// sig.r, +// sig.s, +// sig.v, +// ); +// const storage2: Lock = await p2pix.callStatic.mapLocks( +// lockID, +// ); +// const userRecordB = await p2pix.callStatic.userRecord( +// acc01Key, +// ); +// const userRecord2 = await p2pix.callStatic.userRecord( +// acc03Key, +// ); +// const used = await p2pix.callStatic.usedTransactions( +// messageHashBytes, +// ); +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "LockReleased") +// .withArgs(acc02.address, lockID); +// expect(storage1.expirationBlock).to.eq( +// ethers.BigNumber.from(16), +// ); +// expect(storage1.amount).to.eq( +// ethers.BigNumber.from(100), +// ); +// expect(storage2.expirationBlock).to.eq( +// ethers.BigNumber.from(0), +// ); +// expect(storage2.amount).to.eq(ethers.BigNumber.from(0)); +// expect(used).to.eq(true); +// expect(userRecordA).to.eq(ethers.constants.Zero); +// expect(userRecord1).to.eq(ethers.constants.Zero); +// expect(userRecordB).to.eq(ethers.BigNumber.from(6)); +// expect(userRecord2).to.eq(ethers.BigNumber.from(100)); +// await expect(tx).to.changeTokenBalances( +// erc20, +// [acc03.address, acc02.address], +// [3, 97], +// // acc02 is acting both as buyer and relayerTarget +// // (i.e., 94 + 3 = 97) +// ); +// }); +// // edge case test +// it("should release multiple locks", async () => { +// const endtoendID = ethers.constants.HashZero; +// const pixTarget = "pixTarget"; +// const root = ethers.constants.HashZero; +// const acc01Key = await p2pix.callStatic._castAddrToKey( +// acc01.address, +// ); +// const acc03Key = await p2pix.callStatic._castAddrToKey( +// acc03.address, +// ); +// const acc01Record1 = await p2pix.callStatic.userRecord( +// acc01Key, +// ); +// const acc03Record1 = await p2pix.callStatic.userRecord( +// acc03Key, +// ); +// const messageToSign1 = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// [pixTarget, 100, endtoendID], +// ); +// const flatSig1 = await owner.signMessage( +// ethers.utils.arrayify(messageToSign1), +// ); +// const sig1 = ethers.utils.splitSignature(flatSig1); +// const messageToSign2 = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// [pixTarget, 50, endtoendID], +// ); +// const flatSig2 = await owner.signMessage( +// ethers.utils.arrayify(messageToSign2), +// ); +// const sig2 = ethers.utils.splitSignature(flatSig2); +// const messageToSign3 = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// [pixTarget, 25, endtoendID], +// ); +// const flatSig3 = await owner.signMessage( +// ethers.utils.arrayify(messageToSign3), +// ); +// const sig3 = ethers.utils.splitSignature(flatSig3); +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// pixTarget, +// root, +// ); +// await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// 100, +// [], +// [], +// ); +// await p2pix +// .connect(acc03) +// .lock(0, acc02.address, acc03.address, 6, 50, [], []); +// await p2pix +// .connect(acc03) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 10, +// 25, +// [], +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 100, acc02.address], +// ); +// const lockID2 = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 50, acc02.address], +// ); +// const lockID3 = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 25, acc02.address], +// ); +// // relayerPremium == 0 +// const tx = await p2pix +// .connect(acc01) +// .release( +// lockID, +// acc02.address, +// endtoendID, +// sig1.r, +// sig1.s, +// sig1.v, +// ); +// // relayerPremium != 0 && +// // lock's msg.sender != release's msg.sender +// const tx1 = await p2pix +// .connect(acc01) +// .release( +// lockID2, +// acc02.address, +// endtoendID, +// sig2.r, +// sig2.s, +// sig2.v, +// ); +// // relayerPremium != 0 && +// // lock's msg.sender == release's msg.sender +// const tx2 = await p2pix +// .connect(acc03) +// .release( +// lockID3, +// acc02.address, +// endtoendID, +// sig3.r, +// sig3.s, +// sig3.v, +// ); +// const used1 = await p2pix.callStatic.usedTransactions( +// ethers.utils.arrayify(messageToSign1), +// ); +// const used2 = await p2pix.callStatic.usedTransactions( +// ethers.utils.arrayify(messageToSign2), +// ); +// const used3 = await p2pix.callStatic.usedTransactions( +// ethers.utils.arrayify(messageToSign3), +// ); +// const acc01Record2 = await p2pix.callStatic.userRecord( +// acc01Key, +// ); +// const acc03Record2 = await p2pix.callStatic.userRecord( +// acc03Key, +// ); + +// expect(tx).to.be.ok; +// expect(tx1).to.be.ok; +// expect(tx2).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "LockReleased") +// .withArgs(acc02.address, lockID); +// await expect(tx1) +// .to.emit(p2pix, "LockReleased") +// .withArgs(acc02.address, lockID2); +// await expect(tx2) +// .to.emit(p2pix, "LockReleased") +// .withArgs(acc02.address, lockID3); +// expect(used1).to.eq(true); +// expect(used2).to.eq(true); +// expect(used3).to.eq(true); +// expect(0).to.eq(acc01Record1).and.to.eq(acc03Record1); +// expect(acc01Record2).to.eq(6); // 0 + 6 +// expect(acc03Record2).to.eq(185); // 100 + 50 + 25 + 10 +// await expect(tx).to.changeTokenBalances( +// erc20, +// [ +// acc01.address, +// acc02.address, +// acc03.address, +// p2pix.address, +// ], +// [0, 100, 0, "-100"], +// ); +// await expect(tx1).to.changeTokenBalances( +// erc20, +// [ +// acc01.address, +// acc02.address, +// acc03.address, +// p2pix.address, +// ], +// [0, 47, 3, "-50"], +// ); +// await expect(tx2).to.changeTokenBalances( +// erc20, +// [ +// acc01.address, +// acc02.address, +// acc03.address, +// p2pix.address, +// ], +// [0, 20, 5, "-25"], +// ); +// }); +// }); +// describe("Unexpire Locks", async () => { +// it("should revert if lock isn't expired", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// await p2pix +// .connect(acc02) +// .lock(0, acc02.address, acc03.address, 0, 1, [], []); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 1, acc02.address], +// ); +// const fail = p2pix.unlockExpired([lockID]); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.NotExpired, +// ); +// }); +// it("should revert if lock has already been released", async () => { +// const endtoendID = ethers.constants.HashZero; +// const pixTarget = "pixTarget"; +// const messageToSign = ethers.utils.solidityKeccak256( +// ["string", "uint256", "bytes32"], +// [pixTarget, 1, endtoendID], +// ); +// const messageHashBytes = +// ethers.utils.arrayify(messageToSign); +// const flatSig = await acc01.signMessage( +// messageHashBytes, +// ); +// const sig = ethers.utils.splitSignature(flatSig); +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// pixTarget, +// merkleRoot, +// ); +// await p2pix +// .connect(acc02) +// .lock(0, acc02.address, acc03.address, 0, 1, [], []); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 1, acc02.address], +// ); +// // await mine(10); +// await p2pix.release( +// lockID, +// acc03.address, +// endtoendID, +// sig.r, +// sig.s, +// sig.v, +// ); +// const fail = p2pix.unlockExpired([lockID]); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.AlreadyReleased, +// ); +// }); +// it("should unlock expired locks, update storage and emit events", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// await p2pix +// .connect(acc02) +// .lock(0, acc02.address, acc03.address, 0, 1, [], []); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, 1, acc02.address], +// ); +// await mine(11); +// const storage: Lock = await p2pix.callStatic.mapLocks( +// lockID, +// ); +// const userKey = await p2pix.callStatic._castAddrToKey( +// acc02.address, +// ); +// const record1 = await p2pix.callStatic.userRecord( +// userKey, +// ); +// const tx = await p2pix.unlockExpired([lockID]); +// const storage2: Lock = await p2pix.callStatic.mapLocks( +// lockID, +// ); +// const record2 = await p2pix.callStatic.userRecord( +// userKey, +// ); + +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "LockReturned") +// .withArgs(acc02.address, lockID); +// expect(storage.amount).to.eq(ethers.constants.One); +// expect(storage2.amount).to.eq(ethers.constants.Zero); +// expect(record1).to.eq(0); +// expect(record2).to.eq(price); +// }); +// it("should unlock expired through lock function", async () => { +// // test method through lock fx +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// const lock1: ContractTransaction = await p2pix +// .connect(acc01) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// price, +// proof, +// [], +// ); +// // as return values of non view functions can't be accessed +// // outside the evm, we fetch the lockID from the emitted event. +// const rc: ContractReceipt = await lock1.wait(); +// const event = rc.events?.find( +// event => event.event === "LockAdded", +// ); +// // eslint-disable-next-line @typescript-eslint/no-non-null-assertion +// const emittedLockID = event?.args!["lockID"]; +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, price, acc02.address], +// ); + +// // mine blocks to expire lock +// await mine(12); +// // const blocknum = await p2pix.provider.getBlockNumber(); +// // console.log("bn = 6 + 12 ( i.e., %s )", blocknum); +// // console.log( +// // "\n", +// // " 2 blocks past the expiration block", +// // ); +// // const struct2: Lock = await p2pix.callStatic.mapLocks( +// // emittedLockID, +// // ); +// // console.log( +// // "\n", +// // "Current state of the lock:", +// // "\n", +// // struct2, +// // ); + +// expect(emittedLockID).to.eq(lockID); + +// // create another lock by freeing the price value +// // back to `l.remamining` and lock 100 again. +// const tx1 = await p2pix.lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// 100, +// [], +// [lockID], +// ); +// const dep: Deposit = await p2pix.callStatic.mapDeposits( +// 0, +// ); + +// expect(tx1).to.be.ok; +// await expect(tx1) +// .to.emit(p2pix, "LockReturned") +// .withArgs(acc02.address, lockID); +// expect(dep.remaining).to.eq( +// price.sub(ethers.BigNumber.from(100)), +// ); +// }); +// it("should unlock expired through withdraw function", async () => { +// // test method through withdraw fx +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// await p2pix +// .connect(acc01) +// .lock( +// 0, +// acc02.address, +// acc03.address, +// 0, +// price, +// proof, +// [], +// ); +// const lockID = ethers.utils.solidityKeccak256( +// ["uint256", "uint256", "address"], +// [0, price, acc02.address], +// ); +// // mine blocks to expire lock +// await mine(11); +// const tx = await p2pix.withdraw(0, [lockID]); +// const dep: Deposit = await p2pix.callStatic.mapDeposits( +// 0, +// ); + +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "LockReturned") +// .withArgs(acc02.address, lockID); +// expect(dep.remaining).to.eq(0); +// }); +// }); +// describe("Seller Withdraw", async () => { +// it("should revert if the msg.sender isn't the deposit's seller", async () => { +// await erc20.approve(p2pix.address, price); +// await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// const fail = p2pix.connect(acc02).withdraw(0, []); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.OnlySeller, +// ); +// }); +// it("should withdraw remaining funds from deposit, update storage and emit event", async () => { +// await erc20.approve(p2pix.address, price); +// const dep = await p2pix.deposit( +// erc20.address, +// price, +// "pixTarget", +// merkleRoot, +// ); +// const tx = await p2pix.withdraw(0, []); + +// expect(tx).to.be.ok; +// await expect(dep) +// .to.changeTokenBalance( +// erc20, +// owner.address, +// "-100000000000000000000", +// ) +// .and.to.changeTokenBalance( +// erc20, +// p2pix.address, +// price, +// ); +// await expect(tx) +// .to.changeTokenBalance(erc20, owner.address, price) +// .and.to.changeTokenBalance( +// erc20, +// p2pix.address, +// "-100000000000000000000", +// ); + +// await expect(tx) +// .to.emit(p2pix, "DepositWithdrawn") +// .withArgs(owner.address, 0, price); +// }); +// }); +// describe("Allowlist Settings", async () => { +// it("should revert if the msg.sender differs from deposit's seller", async () => { +// const root = ethers.utils.keccak256( +// ethers.utils.toUtf8Bytes("root"), +// ); +// const fail = p2pix +// .connect(acc02) +// .setRoot(owner.address, root); + +// await expect(fail).to.be.revertedWithCustomError( +// p2pix, +// P2PixErrors.OnlySeller, +// ); +// }); +// it("should set root of seller's allowlist, update storage and emit event", async () => { +// const ownerKey = await p2pix.callStatic._castAddrToKey( +// owner.address, +// ); +// const oldState = await p2pix.callStatic.sellerAllowList( +// ownerKey, +// ); +// const tx = await p2pix +// .connect(owner) +// .setRoot(owner.address, merkleRoot); +// const newState = await p2pix.callStatic.sellerAllowList( +// ownerKey, +// ); + +// expect(tx).to.be.ok; +// await expect(tx) +// .to.emit(p2pix, "RootUpdated") +// .withArgs(owner.address, merkleRoot); +// expect(oldState).to.eq(ethers.constants.HashZero); +// expect(newState).to.eq(merkleRoot); +// }); +// }); +// }); From 6fe1e794d02400402aeab1b2ed13fecc5e1f199f Mon Sep 17 00:00:00 2001 From: PedroCailleret Date: Thu, 26 Jan 2023 21:40:17 -0300 Subject: [PATCH 2/3] :sparkles: V2 Release --- .env.example | 7 +- README.md | 49 +- .../DataTypes.sol/DataTypes.dbg.json | 2 +- .../EventAndErrors.dbg.json | 2 +- .../EventAndErrors.sol/EventAndErrors.json | 12 +- .../Reputation.sol/Reputation.dbg.json | 2 +- .../contracts/Reputation.sol/Reputation.json | 4 +- .../lib/auth/Owned.sol/Owned.dbg.json | 2 +- .../IReputation.sol/IReputation.dbg.json | 2 +- .../lib/mock/mockToken.sol/MockToken.dbg.json | 2 +- .../lib/mock/mockToken.sol/MockToken.json | 4 +- .../lib/tokens/ERC20.sol/ERC20.dbg.json | 2 +- .../lib/utils/Counters.sol/Counters.dbg.json | 4 - .../lib/utils/Counters.sol/Counters.json | 16 - .../MerkleProofLib.dbg.json | 2 +- .../ReentrancyGuard.dbg.json | 2 +- .../SafeTransferLib.dbg.json | 2 +- artifacts/contracts/p2pix.sol/P2PIX.dbg.json | 2 +- artifacts/contracts/p2pix.sol/P2PIX.json | 79 +- contracts/EventAndErrors.sol | 10 +- contracts/lib/utils/Counters.sol | 52 - contracts/p2pix.sol | 604 +-- deploys/goerli.json | 8 + deploys/localhost.json | 6 +- deploys/polygon-mumbai.json | 8 + docs/callgraph.svg | 1021 +++-- hardhat.config.ts | 29 +- package.json | 6 +- scripts/1-deploy-mockToken.ts | 17 +- scripts/2-deploy-p2pix.ts | 26 +- src/types/EventAndErrors.ts | 36 +- .../factories/EventAndErrors__factory.ts | 12 +- src/types/factories/Reputation__factory.ts | 2 +- .../mock/mockToken.sol/MockToken__factory.ts | 2 +- .../factories/lib/utils/Counters__factory.ts | 65 - src/types/factories/lib/utils/index.ts | 1 - .../factories/p2pix.sol/P2PIX__factory.ts | 77 +- src/types/hardhat.d.ts | 9 - src/types/index.ts | 2 - src/types/lib/utils/Counters.ts | 56 - src/types/lib/utils/index.ts | 1 - src/types/p2pix.sol/P2PIX.ts | 151 +- test/p2pix.test.ts | 3640 +++++++++-------- test/utils/errors.ts | 4 + test/utils/fixtures.ts | 19 +- 45 files changed, 3195 insertions(+), 2866 deletions(-) delete mode 100644 artifacts/contracts/lib/utils/Counters.sol/Counters.dbg.json delete mode 100644 artifacts/contracts/lib/utils/Counters.sol/Counters.json delete mode 100644 contracts/lib/utils/Counters.sol create mode 100644 deploys/goerli.json create mode 100644 deploys/polygon-mumbai.json delete mode 100644 src/types/factories/lib/utils/Counters__factory.ts delete mode 100644 src/types/lib/utils/Counters.ts diff --git a/.env.example b/.env.example index 0b02a76..d972d67 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,12 @@ -INFURA_API_KEY="{INSERT_API_KEY}" MNEMONIC="{INSERT_12_WORD_MNEMONIC}" +INFURA_API_KEY="{INSERT_API_KEY}" +ALCHEMY_API_KEY="{INSERT_API_KEY}" + # Block explorer API keys ETHERSCAN_API_KEY="{INSERT_API_KEY}" +POLYGONSCAN_API_KEY="{INSERT_API_KEY}" GASPRICE_API_ENDPOINT="https://api.etherscan.io/api?module=proxy&action=eth_gasPrice" COINMARKETCAP_API_KEY="{INSERT_API_KEY}" -REPORT_GAS="true" +REPORT_GAS="true" \ No newline at end of file diff --git a/README.md b/README.md index 79d3271..ec6daf7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ │ ├── tokens │ │ └── ERC20.sol │ └── utils -│ ├── Counters.sol │ ├── MerkleProofLib.sol │ ├── ReentrancyGuard.sol │ └── SafeTransferLib.sol @@ -30,6 +29,37 @@ ![Callgraph](docs/callgraph.svg) +## Current Deployment addresses + +### V1 +| Testnet | Token Address | P2pix Address | +|--------- |-------------------------------------------- |-------------------------------------------- | +| Goerli | 0x294003F602c321627152c6b7DED3EAb5bEa853Ee | 0x5f3EFA9A90532914545CEf527C530658af87e196 | +| Mumbai | 0x294003F602c321627152c6b7DED3EAb5bEa853Ee | 0x5f3EFA9A90532914545CEf527C530658af87e196 | + + + + + + + + + + + +### V2 +| Testnet | Token Address | P2pix Address | Reputation Address | +|--------- |-------------------------------------------- |-------------------------------------------- |-------------------------------------------- | +| Goerli | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0x2a54667b566B1Aa3779828720E6696AC18ae3f1b | 0x7c4010CFe2B5446f0c9dcc5e9B596534b2D2eB44 | +| Mumbai | 0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29 | 0x7F4680D114B43c4434FB604c7Bc6306125D32f28 | 0xD38D6367f452D097ccBfDe4490b7de570B6A72Db | + + + + + + + + ## Usage ### Pre Requisites @@ -103,3 +133,20 @@ yarn deploy2:localhost **_NOTE_:** The second script transfers 2M tokens to the first wallet of the node. To use the P2Pix smart contract first transfer some of the tokens to other wallets. + + +## Deploying to testnets + +Deploy to Ethereum's Goerli testnet: + +```sh +yarn deploy1:goerli +yarn deploy2:goerli +``` + +Deploy to Polygon's Mumbai testnet: + +```sh +yarn deploy1:mumbai +yarn deploy2:mumbai +``` \ No newline at end of file diff --git a/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json b/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json index e79a018..c296519 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/f807a312b7619f2547c334c76d81a8da.json" + "buildInfo": "../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json index e79a018..c296519 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/f807a312b7619f2547c334c76d81a8da.json" + "buildInfo": "../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json index a2428ef..4451430 100644 --- a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json +++ b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.json @@ -202,9 +202,9 @@ }, { "indexed": true, - "internalType": "bytes32", + "internalType": "uint256", "name": "lockID", - "type": "bytes32" + "type": "uint256" }, { "indexed": false, @@ -246,9 +246,9 @@ }, { "indexed": false, - "internalType": "bytes32", + "internalType": "uint256", "name": "lockId", - "type": "bytes32" + "type": "uint256" }, { "indexed": false, @@ -271,9 +271,9 @@ }, { "indexed": false, - "internalType": "bytes32", + "internalType": "uint256", "name": "lockId", - "type": "bytes32" + "type": "uint256" } ], "name": "LockReturned", diff --git a/artifacts/contracts/Reputation.sol/Reputation.dbg.json b/artifacts/contracts/Reputation.sol/Reputation.dbg.json index 24373ca..c296519 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/916d546d680bb337e1c490eb628d93df.json" + "buildInfo": "../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/Reputation.sol/Reputation.json b/artifacts/contracts/Reputation.sol/Reputation.json index 0aa879f..1d452b0 100644 --- a/artifacts/contracts/Reputation.sol/Reputation.json +++ b/artifacts/contracts/Reputation.sol/Reputation.json @@ -99,8 +99,8 @@ "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a35061036b806100616000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634d2b1791116100505780634d2b17911461009e5780638da5cb5b146100b1578063a4b34557146100dc57600080fd5b806313af40351461006c5780631a861d2614610081575b600080fd5b61007f61007a3660046102a6565b6100e8565b005b61008b620f424081565b6040519081526020015b60405180910390f35b61008b6100ac3660046102d6565b6101a9565b6000546100c4906001600160a01b031681565b6040516001600160a01b039091168152602001610095565b61008b643a3529440081565b6000546001600160a01b031633146101465760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015260640160405180910390fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b60006101cc6101b88380610305565b6101c790643a35294400610324565b6101f4565b6101d983620f4240610305565b6101e3919061033c565b6101ee906001610324565b92915050565b60b58171010000000000000000000000000000000000811061021b5760409190911b9060801c5b690100000000000000000081106102375760209190911b9060401c5b65010000000000811061024f5760109190911b9060201c5b630100000081106102655760089190911b9060101c5b62010000010260121c80820401600190811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900390565b6000602082840312156102b857600080fd5b81356001600160a01b03811681146102cf57600080fd5b9392505050565b6000602082840312156102e857600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561031f5761031f6102ef565b500290565b60008219821115610337576103376102ef565b500190565b60008261035957634e487b7160e01b600052601260045260246000fd5b50049056fea164736f6c6343000809000a", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80634d2b1791116100505780634d2b17911461009e5780638da5cb5b146100b1578063a4b34557146100dc57600080fd5b806313af40351461006c5780631a861d2614610081575b600080fd5b61007f61007a3660046102a6565b6100e8565b005b61008b620f424081565b6040519081526020015b60405180910390f35b61008b6100ac3660046102d6565b6101a9565b6000546100c4906001600160a01b031681565b6040516001600160a01b039091168152602001610095565b61008b643a3529440081565b6000546001600160a01b031633146101465760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015260640160405180910390fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b60006101cc6101b88380610305565b6101c790643a35294400610324565b6101f4565b6101d983620f4240610305565b6101e3919061033c565b6101ee906001610324565b92915050565b60b58171010000000000000000000000000000000000811061021b5760409190911b9060801c5b690100000000000000000081106102375760209190911b9060401c5b65010000000000811061024f5760109190911b9060201c5b630100000081106102655760089190911b9060101c5b62010000010260121c80820401600190811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900390565b6000602082840312156102b857600080fd5b81356001600160a01b03811681146102cf57600080fd5b9392505050565b6000602082840312156102e857600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561031f5761031f6102ef565b500290565b60008219821115610337576103376102ef565b500190565b60008261035957634e487b7160e01b600052601260045260246000fd5b50049056fea164736f6c6343000809000a", + "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a350610416806100616000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634d2b1791116100505780634d2b17911461009e5780638da5cb5b146100b1578063a4b34557146100f657600080fd5b806313af40351461006c5780631a861d2614610081575b600080fd5b61007f61007a3660046102f4565b610102565b005b61008b620f424081565b6040519081526020015b60405180910390f35b61008b6100ac366004610331565b6101f7565b6000546100d19073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610095565b61008b643a3529440081565b60005473ffffffffffffffffffffffffffffffffffffffff163314610187576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015260640160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061021a6102068380610379565b61021590643a352944006103b6565b610242565b61022783620f4240610379565b61023191906103ce565b61023c9060016103b6565b92915050565b60b5817101000000000000000000000000000000000081106102695760409190911b9060801c5b690100000000000000000081106102855760209190911b9060401c5b65010000000000811061029d5760109190911b9060201c5b630100000081106102b35760089190911b9060101c5b62010000010260121c80820401600190811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900390565b60006020828403121561030657600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461032a57600080fd5b9392505050565b60006020828403121561034357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156103b1576103b161034a565b500290565b600082198211156103c9576103c961034a565b500190565b600082610404577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50049056fea164736f6c6343000809000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80634d2b1791116100505780634d2b17911461009e5780638da5cb5b146100b1578063a4b34557146100f657600080fd5b806313af40351461006c5780631a861d2614610081575b600080fd5b61007f61007a3660046102f4565b610102565b005b61008b620f424081565b6040519081526020015b60405180910390f35b61008b6100ac366004610331565b6101f7565b6000546100d19073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610095565b61008b643a3529440081565b60005473ffffffffffffffffffffffffffffffffffffffff163314610187576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015260640160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061021a6102068380610379565b61021590643a352944006103b6565b610242565b61022783620f4240610379565b61023191906103ce565b61023c9060016103b6565b92915050565b60b5817101000000000000000000000000000000000081106102695760409190911b9060801c5b690100000000000000000081106102855760209190911b9060401c5b65010000000000811061029d5760109190911b9060201c5b630100000081106102b35760089190911b9060101c5b62010000010260121c80820401600190811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900390565b60006020828403121561030657600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461032a57600080fd5b9392505050565b60006020828403121561034357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156103b1576103b161034a565b500290565b600082198211156103c9576103c961034a565b500190565b600082610404577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50049056fea164736f6c6343000809000a", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json b/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json index 5d925c7..ff1ed99 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json b/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json index 5d925c7..ff1ed99 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json index 5d925c7..ff1ed99 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.json b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.json index c3da5c1..8b17455 100644 --- a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.json +++ b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.json @@ -330,8 +330,8 @@ "type": "function" } ], - "bytecode": "0x60e06040523480156200001157600080fd5b506040516200105238038062001052833981016040819052620000349162000279565b6040805180820182526007815266135bd8dad0949360ca1b6020808301918252835180850190945260048452631350949360e21b908401528151919291601291620000839160009190620001d3565b50815162000099906001906020850190620001d3565b5060ff81166080524660a052620000af620000ca565b60c05250620000c391503390508262000166565b506200039b565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620000fe9190620002d0565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546200017a919062000374565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b828054620001e19062000293565b90600052602060002090601f01602090048101928262000205576000855562000250565b82601f106200022057805160ff191683800117855562000250565b8280016001018555821562000250579182015b828111156200025057825182559160200191906001019062000233565b506200025e92915062000262565b5090565b5b808211156200025e576000815560010162000263565b6000602082840312156200028c57600080fd5b5051919050565b600181811c90821680620002a857607f821691505b60208210811415620002ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c915080831680620002ed57607f831692505b60208084108214156200030e57634e487b7160e01b86526022600452602486fd5b818015620003255760018114620003375762000366565b60ff1986168952848901965062000366565b60008a81526020902060005b868110156200035e5781548b82015290850190830162000343565b505084890196505b509498975050505050505050565b600082198211156200039657634e487b7160e01b600052601160045260246000fd5b500190565b60805160a05160c051610c87620003cb60003960006104630152600061042e015260006101540152610c876000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906108ad565b60405180910390f35b61011561011036600461091e565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610948565b610338565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e61042a565b61012e61019e366004610984565b60036020526000908152604090205481565b61012e6101be366004610984565b60056020526000908152604090205481565b6100ec610485565b6101156101e636600461091e565b610492565b6101fe6101f93660046109a6565b61050a565b005b61012e61020e366004610a19565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610a62565b610762565b6000805461024b90610b2d565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610b2d565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103279086815260200190565b60405180910390a350600192915050565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146103945761036f8382610b7e565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906103bc908490610b7e565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104179087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104605761045b6107a8565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610b2d565b336000908152600360205260408120805483919083906104b3908490610b7e565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103279086815260200190565b4284101561055f5760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b6000600161056b61042a565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610677573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906106ad5750876001600160a01b0316816001600160a01b0316145b6106f95760405162461bcd60e51b815260206004820152600e60248201527f494e56414c49445f5349474e45520000000000000000000000000000000000006044820152606401610556565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b815160005b818110156107a25761079284828151811061078457610784610b95565b602002602001015184610842565b61079b81610bab565b9050610767565b50505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516107da9190610bc6565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546108549190610c62565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b818110156108da578581018301518582016040015282016108be565b818111156108ec576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461091957600080fd5b919050565b6000806040838503121561093157600080fd5b61093a83610902565b946020939093013593505050565b60008060006060848603121561095d57600080fd5b61096684610902565b925061097460208501610902565b9150604084013590509250925092565b60006020828403121561099657600080fd5b61099f82610902565b9392505050565b600080600080600080600060e0888a0312156109c157600080fd5b6109ca88610902565b96506109d860208901610902565b95506040880135945060608801359350608088013560ff811681146109fc57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610a2c57600080fd5b610a3583610902565b9150610a4360208401610902565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610a7557600080fd5b823567ffffffffffffffff80821115610a8d57600080fd5b818501915085601f830112610aa157600080fd5b8135602082821115610ab557610ab5610a4c565b8160051b604051601f19603f83011681018181108682111715610ada57610ada610a4c565b604052928352818301935084810182019289841115610af857600080fd5b948201945b83861015610b1d57610b0e86610902565b85529482019493820193610afd565b9997909101359750505050505050565b600181811c90821680610b4157607f821691505b60208210811415610b6257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610b9057610b90610b68565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610bbf57610bbf610b68565b5060010190565b600080835481600182811c915080831680610be257607f831692505b6020808410821415610c0257634e487b7160e01b86526022600452602486fd5b818015610c165760018114610c2757610c54565b60ff19861689528489019650610c54565b60008a81526020902060005b86811015610c4c5781548b820152908501908301610c33565b505084890196505b509498975050505050505050565b60008219821115610c7557610c75610b68565b50019056fea164736f6c6343000809000a", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906108ad565b60405180910390f35b61011561011036600461091e565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610948565b610338565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e61042a565b61012e61019e366004610984565b60036020526000908152604090205481565b61012e6101be366004610984565b60056020526000908152604090205481565b6100ec610485565b6101156101e636600461091e565b610492565b6101fe6101f93660046109a6565b61050a565b005b61012e61020e366004610a19565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610a62565b610762565b6000805461024b90610b2d565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610b2d565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103279086815260200190565b60405180910390a350600192915050565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146103945761036f8382610b7e565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906103bc908490610b7e565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104179087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104605761045b6107a8565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610b2d565b336000908152600360205260408120805483919083906104b3908490610b7e565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103279086815260200190565b4284101561055f5760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b6000600161056b61042a565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610677573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906106ad5750876001600160a01b0316816001600160a01b0316145b6106f95760405162461bcd60e51b815260206004820152600e60248201527f494e56414c49445f5349474e45520000000000000000000000000000000000006044820152606401610556565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b815160005b818110156107a25761079284828151811061078457610784610b95565b602002602001015184610842565b61079b81610bab565b9050610767565b50505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516107da9190610bc6565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546108549190610c62565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b818110156108da578581018301518582016040015282016108be565b818111156108ec576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461091957600080fd5b919050565b6000806040838503121561093157600080fd5b61093a83610902565b946020939093013593505050565b60008060006060848603121561095d57600080fd5b61096684610902565b925061097460208501610902565b9150604084013590509250925092565b60006020828403121561099657600080fd5b61099f82610902565b9392505050565b600080600080600080600060e0888a0312156109c157600080fd5b6109ca88610902565b96506109d860208901610902565b95506040880135945060608801359350608088013560ff811681146109fc57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610a2c57600080fd5b610a3583610902565b9150610a4360208401610902565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610a7557600080fd5b823567ffffffffffffffff80821115610a8d57600080fd5b818501915085601f830112610aa157600080fd5b8135602082821115610ab557610ab5610a4c565b8160051b604051601f19603f83011681018181108682111715610ada57610ada610a4c565b604052928352818301935084810182019289841115610af857600080fd5b948201945b83861015610b1d57610b0e86610902565b85529482019493820193610afd565b9997909101359750505050505050565b600181811c90821680610b4157607f821691505b60208210811415610b6257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610b9057610b90610b68565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610bbf57610bbf610b68565b5060010190565b600080835481600182811c915080831680610be257607f831692505b6020808410821415610c0257634e487b7160e01b86526022600452602486fd5b818015610c165760018114610c2757610c54565b60ff19861689528489019650610c54565b60008a81526020902060005b86811015610c4c5781548b820152908501908301610c33565b505084890196505b509498975050505050505050565b60008219821115610c7557610c75610b68565b50019056fea164736f6c6343000809000a", + "bytecode": "0x60e06040523480156200001157600080fd5b506040516200129938038062001299833981016040819052620000349162000279565b6040805180820182526007815266135bd8dad0949360ca1b6020808301918252835180850190945260048452631350949360e21b908401528151919291601291620000839160009190620001d3565b50815162000099906001906020850190620001d3565b5060ff81166080524660a052620000af620000ca565b60c05250620000c391503390508262000166565b506200039b565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620000fe9190620002d0565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546200017a919062000374565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b828054620001e19062000293565b90600052602060002090601f01602090048101928262000205576000855562000250565b82601f106200022057805160ff191683800117855562000250565b8280016001018555821562000250579182015b828111156200025057825182559160200191906001019062000233565b506200025e92915062000262565b5090565b5b808211156200025e576000815560010162000263565b6000602082840312156200028c57600080fd5b5051919050565b600181811c90821680620002a857607f821691505b60208210811415620002ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c915080831680620002ed57607f831692505b60208084108214156200030e57634e487b7160e01b86526022600452602486fd5b818015620003255760018114620003375762000366565b60ff1986168952848901965062000366565b60008a81526020902060005b868110156200035e5781548b82015290850190830162000343565b505084890196505b509498975050505050505050565b600082198211156200039657634e487b7160e01b600052601160045260246000fd5b500190565b60805160a05160c051610ece620003cb60003960006104c20152600061048d015260006101540152610ece6000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906109f2565b60405180910390f35b610115610110366004610a8e565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610ab8565b610345565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e610489565b61012e61019e366004610af4565b60036020526000908152604090205481565b61012e6101be366004610af4565b60056020526000908152604090205481565b6100ec6104e4565b6101156101e6366004610a8e565b6104f1565b6101fe6101f9366004610b16565b610576565b005b61012e61020e366004610b89565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610beb565b61089a565b6000805461024b90610cd4565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610cd4565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103349086815260200190565b60405180910390a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103d9576103a78382610d57565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff85166000908152600360205260408120805485929061040e908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104769087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104bf576104ba6108e0565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610cd4565b33600090815260036020526040812080548391908390610512908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103349086815260200190565b428410156105e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b600060016105f1610489565b73ffffffffffffffffffffffffffffffffffffffff8a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000061010083015261010282019290925261012281019190915261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610743573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116158015906107be57508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e455200000000000000000000000000000000000060448201526064016105dc565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b815160005b818110156108da576108ca8482815181106108bc576108bc610d6e565b60200260200101518461097a565b6108d381610d9d565b905061089f565b50505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516109129190610dd6565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b806002600082825461098c9190610ea9565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b81811015610a1f57858101830151858201604001528201610a03565b81811115610a31576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a8957600080fd5b919050565b60008060408385031215610aa157600080fd5b610aaa83610a65565b946020939093013593505050565b600080600060608486031215610acd57600080fd5b610ad684610a65565b9250610ae460208501610a65565b9150604084013590509250925092565b600060208284031215610b0657600080fd5b610b0f82610a65565b9392505050565b600080600080600080600060e0888a031215610b3157600080fd5b610b3a88610a65565b9650610b4860208901610a65565b95506040880135945060608801359350608088013560ff81168114610b6c57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610b9c57600080fd5b610ba583610a65565b9150610bb360208401610a65565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610bfe57600080fd5b823567ffffffffffffffff80821115610c1657600080fd5b818501915085601f830112610c2a57600080fd5b8135602082821115610c3e57610c3e610bbc565b8160051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108682111715610c8157610c81610bbc565b604052928352818301935084810182019289841115610c9f57600080fd5b948201945b83861015610cc457610cb586610a65565b85529482019493820193610ca4565b9997909101359750505050505050565b600181811c90821680610ce857607f821691505b60208210811415610d22577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015610d6957610d69610d28565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610dcf57610dcf610d28565b5060010190565b600080835481600182811c915080831680610df257607f831692505b6020808410821415610e2b577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015610e3f5760018114610e6e57610e9b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650610e9b565b60008a81526020902060005b86811015610e935781548b820152908501908301610e7a565b505084890196505b509498975050505050505050565b60008219821115610ebc57610ebc610d28565b50019056fea164736f6c6343000809000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906109f2565b60405180910390f35b610115610110366004610a8e565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610ab8565b610345565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e610489565b61012e61019e366004610af4565b60036020526000908152604090205481565b61012e6101be366004610af4565b60056020526000908152604090205481565b6100ec6104e4565b6101156101e6366004610a8e565b6104f1565b6101fe6101f9366004610b16565b610576565b005b61012e61020e366004610b89565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610beb565b61089a565b6000805461024b90610cd4565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610cd4565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103349086815260200190565b60405180910390a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103d9576103a78382610d57565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff85166000908152600360205260408120805485929061040e908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104769087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104bf576104ba6108e0565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610cd4565b33600090815260036020526040812080548391908390610512908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103349086815260200190565b428410156105e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b600060016105f1610489565b73ffffffffffffffffffffffffffffffffffffffff8a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000061010083015261010282019290925261012281019190915261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610743573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116158015906107be57508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e455200000000000000000000000000000000000060448201526064016105dc565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b815160005b818110156108da576108ca8482815181106108bc576108bc610d6e565b60200260200101518461097a565b6108d381610d9d565b905061089f565b50505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516109129190610dd6565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b806002600082825461098c9190610ea9565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b81811015610a1f57858101830151858201604001528201610a03565b81811115610a31576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a8957600080fd5b919050565b60008060408385031215610aa157600080fd5b610aaa83610a65565b946020939093013593505050565b600080600060608486031215610acd57600080fd5b610ad684610a65565b9250610ae460208501610a65565b9150604084013590509250925092565b600060208284031215610b0657600080fd5b610b0f82610a65565b9392505050565b600080600080600080600060e0888a031215610b3157600080fd5b610b3a88610a65565b9650610b4860208901610a65565b95506040880135945060608801359350608088013560ff81168114610b6c57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610b9c57600080fd5b610ba583610a65565b9150610bb360208401610a65565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610bfe57600080fd5b823567ffffffffffffffff80821115610c1657600080fd5b818501915085601f830112610c2a57600080fd5b8135602082821115610c3e57610c3e610bbc565b8160051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108682111715610c8157610c81610bbc565b604052928352818301935084810182019289841115610c9f57600080fd5b948201945b83861015610cc457610cb586610a65565b85529482019493820193610ca4565b9997909101359750505050505050565b600181811c90821680610ce857607f821691505b60208210811415610d22577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015610d6957610d69610d28565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610dcf57610dcf610d28565b5060010190565b600080835481600182811c915080831680610df257607f831692505b6020808410821415610e2b577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015610e3f5760018114610e6e57610e9b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650610e9b565b60008a81526020902060005b86811015610e935781548b820152908501908301610e7a565b505084890196505b509498975050505050505050565b60008219821115610ebc57610ebc610d28565b50019056fea164736f6c6343000809000a", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json b/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json index 5d925c7..ff1ed99 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/lib/utils/Counters.sol/Counters.dbg.json b/artifacts/contracts/lib/utils/Counters.sol/Counters.dbg.json deleted file mode 100644 index 5d925c7..0000000 --- a/artifacts/contracts/lib/utils/Counters.sol/Counters.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/0043b38db58c3ff291cf622f3b61e1a3.json" -} diff --git a/artifacts/contracts/lib/utils/Counters.sol/Counters.json b/artifacts/contracts/lib/utils/Counters.sol/Counters.json deleted file mode 100644 index 586b482..0000000 --- a/artifacts/contracts/lib/utils/Counters.sol/Counters.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Counters", - "sourceName": "contracts/lib/utils/Counters.sol", - "abi": [ - { - "inputs": [], - "name": "DecOverflow", - "type": "error" - } - ], - "bytecode": "0x602d6037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c6343000809000a", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c6343000809000a", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json b/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json index 5d925c7..ff1ed99 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json b/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json index 5d925c7..ff1ed99 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json b/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json index 5d925c7..ff1ed99 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/0043b38db58c3ff291cf622f3b61e1a3.json" + "buildInfo": "../../../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.dbg.json b/artifacts/contracts/p2pix.sol/P2PIX.dbg.json index 0df3fc6..c296519 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/a89635dd94b1e537327e1582c6d97eb3.json" + "buildInfo": "../../build-info/6801f23dfb2a9667d9e89d4173ae1ee7.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.json b/artifacts/contracts/p2pix.sol/P2PIX.json index 1c83664..e4946d4 100644 --- a/artifacts/contracts/p2pix.sol/P2PIX.json +++ b/artifacts/contracts/p2pix.sol/P2PIX.json @@ -238,9 +238,9 @@ }, { "indexed": true, - "internalType": "bytes32", + "internalType": "uint256", "name": "lockID", - "type": "bytes32" + "type": "uint256" }, { "indexed": false, @@ -282,9 +282,9 @@ }, { "indexed": false, - "internalType": "bytes32", + "internalType": "uint256", "name": "lockId", - "type": "bytes32" + "type": "uint256" }, { "indexed": false, @@ -307,9 +307,9 @@ }, { "indexed": false, - "internalType": "bytes32", + "internalType": "uint256", "name": "lockId", - "type": "bytes32" + "type": "uint256" } ], "name": "LockReturned", @@ -544,6 +544,30 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "sellers", + "type": "address[]" + }, + { + "internalType": "contract ERC20", + "name": "token", + "type": "address" + } + ], + "name": "getBalances", + "outputs": [ + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -630,17 +654,17 @@ "type": "bytes32[]" }, { - "internalType": "bytes32[]", + "internalType": "uint256[]", "name": "expiredLocks", - "type": "bytes32[]" + "type": "uint256[]" } ], "name": "lock", "outputs": [ { - "internalType": "bytes32", - "name": "lockID", - "type": "bytes32" + "internalType": "uint256", + "name": "", + "type": "uint256" } ], "stateMutability": "nonpayable", @@ -662,9 +686,9 @@ { "inputs": [ { - "internalType": "bytes32", + "internalType": "uint256", "name": "", - "type": "bytes32" + "type": "uint256" } ], "name": "mapLocks", @@ -739,9 +763,9 @@ { "inputs": [ { - "internalType": "bytes32", + "internalType": "uint256", "name": "lockID", - "type": "bytes32" + "type": "uint256" }, { "internalType": "address", @@ -939,9 +963,9 @@ { "inputs": [ { - "internalType": "bytes32[]", + "internalType": "uint256[]", "name": "lockIDs", - "type": "bytes32[]" + "type": "uint256[]" } ], "name": "unlockExpired", @@ -1014,19 +1038,18 @@ "type": "address" }, { - "internalType": "bytes32[]", + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256[]", "name": "expiredLocks", - "type": "bytes32[]" + "type": "uint256[]" } ], "name": "withdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "_sellerBalance", - "type": "uint256" - } - ], + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, @@ -1042,8 +1065,8 @@ "type": "receive" } ], - "bytecode": "0x60806040526001805560405162002aa438038062002aa48339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b61247480620006306000396000f3fe6080604052600436106101d15760003560e01c80637f94f65d116100f75780639872dbfe11610095578063c52164c611610064578063c52164c6146106cc578063d4fac45d146106ec578063d6e8b9731461074b578063f7d0e04b1461076b57600080fd5b80639872dbfe146105fa57806398a26871146106105780639eee8d4b14610640578063ad8f2eed1461067857600080fd5b806385313e73116100d157806385313e73146105845780638da5cb5b146105a45780638db564c2146105c45780638e2749d6146105da57600080fd5b80637f94f65d146104d757806380e1d302146104f757806384ab1d281461054b57600080fd5b80634b2ae9801161016f5780636a1460241161013e5780636a1460241461044e5780636d82d9e01461046a578063758d77d41461048a57806377cd38a4146104aa57600080fd5b80634b2ae980146103be578063574983c8146103e95780635fd8c7101461040957806369cc6af41461041e57600080fd5b806316d72240116101ab57806316d722401461025f5780632b9f00e91461033e578063328a71811461035e578063461f31201461037e57600080fd5b806304937320146101dd5780630d2a2d441461021d57806313af40351461023f57600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b5061020a6101f8366004611ddb565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561022957600080fd5b5061023d610238366004611ee8565b61078b565b005b34801561024b57600080fd5b5061023d61025a366004611f25565b61087c565b34801561026b57600080fd5b506102df61027a366004611ddb565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009909801549698959794969395946001600160a01b0393841694928416939182169290821691168a565b604080519a8b5260208b019990995297890196909652606088019490945260808701929092526001600160a01b0390811660a087015290811660c086015290811660e08501529081166101008401521661012082015261014001610214565b34801561034a57600080fd5b5061020a610359366004611f8e565b61091d565b34801561036a57600080fd5b5061023d610379366004612074565b610c90565b34801561038a57600080fd5b506103ae610399366004611ddb565b60096020526000908152604090205460ff1681565b6040519015158152602001610214565b3480156103ca57600080fd5b5061020a6103d9366004611f25565b600c1b611000600160ac1b031690565b3480156103f557600080fd5b5061023d610404366004611ddb565b610e4f565b34801561041557600080fd5b5061023d610ecd565b34801561042a57600080fd5b506103ae610439366004611f25565b600a6020526000908152604090205460ff1681565b34801561045a57600080fd5b5061020a670de0b6b3a764000081565b34801561047657600080fd5b5061023d6104853660046120e7565b610f57565b34801561049657600080fd5b5061023d6104a536600461211c565b611045565b3480156104b657600080fd5b5061020a6104c5366004611ddb565b60066020526000908152604090205481565b3480156104e357600080fd5b5061023d6104f2366004612180565b611429565b34801561050357600080fd5b506103ae6105123660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b039094168352929052205460ff1c90565b34801561055757600080fd5b5061056c610566366004611ddb565b600c1c90565b6040516001600160a01b039091168152602001610214565b34801561059057600080fd5b5061020a61059f3660046121e5565b6114bc565b3480156105b057600080fd5b5060005461056c906001600160a01b031681565b3480156105d057600080fd5b5061020a60045481565b3480156105e657600080fd5b5061023d6105f536600461223a565b6115ee565b34801561060657600080fd5b5061020a60035481565b34801561061c57600080fd5b506103ae61062b366004611ddb565b60086020526000908152604090205460ff1681565b34801561064c57600080fd5b5061020a61065b36600461227c565b600b60209081526000928352604080842090915290825290205481565b34801561068457600080fd5b5061056c6106933660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b0390941683529290522054605f1c90565b3480156106d857600080fd5b5060025461056c906001600160a01b031681565b3480156106f857600080fd5b5061020a6107073660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b03909416835292905220546b3fffffffffffffffffffffff1690565b34801561075757600080fd5b5061023d6107663660046122a1565b6117de565b34801561077757600080fd5b5061023d610786366004611f25565b6118b6565b6000546001600160a01b031633146107d95760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156108405760006108198484815181106107fe576107fe612363565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600860205260409020805460ff191660019081179091559290920191506107df565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516108719190612379565b60405180910390a150565b6000546001600160a01b031633146108c55760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061092761193d565b61093183836115ee565b600c8b901b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038e1684529091529020548a9060ff1c61098557604051635972996f60e11b815260040160405180910390fd5b611000600160ac1b03600c8d901b166000908152600b602090815260408083206001600160a01b03851684529091529020546b3fffffffffffffffffffffff16878110156109e6576040516308aeed0f60e21b815260040160405180910390fd5b600454611000600160ac1b03600c8f901b1690600090610a079060016123dc565b90506004548a8e604051602001610a4393929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b60405160208183030381529060405280519060200120945043600560008781526020019081526020016000206004015410610a915760405163d0404f8560e01b815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c815260200160035443610ac591906123dc565b8152602001605f600b60008781526020019081526020016000206000896001600160a01b03166001600160a01b0316815260200190815260200160002054901c6001600160a01b031681526020018f6001600160a01b031681526020018e6001600160a01b03168152602001336001600160a01b03168152602001866001600160a01b0316815250905089899050600014610ba457600083815260066020526040902054610b77908b908b9033611968565b610b85848c8884898861199a565b60048054906000610b95836123f4565b91905055505050505050610c79565b68056bc75e2d63100000816060015111610bc657610b85848c8884898861199a565b611000600160ac1b0333600c1b1660009081526007602052604081205490610bfe610bf9670de0b6b3a76400008461240f565b611b0e565b9050610c12670de0b6b3a764000082612431565b83606001511180610c30575069d3c21bcecceda10000008360600151115b15610c4e57604051630e0c7c2360e11b815260040160405180910390fd5b610c5c868e8a868b8a61199a565b60048054906000610c6c836123f4565b9190505550505050505050505b610c8260018055565b9a9950505050505050505050565b84611000600160ac1b0333600c1b166001600160a01b038516610cc65760405163351de29f60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604090205460ff16610cff57604051630abc194760e11b815260040160405180910390fd5b6000818152600b602090815260408083206001600160a01b03861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610d556bffffffffffffffffffffffff8a16836123dc565b1115610d745760405163f3fb0eb960e01b815260040160405180910390fd5b610d7c61193d565b8415610d8c57610d8c3386611429565b87878760ff81901b605f83901b610da385876123dc565b6000898152600b602090815260408083206001600160a01b038e16845290915290209117919091179055610de78733306bffffffffffffffffffffffff8f16611bca565b610df060018055565b604080516001600160a01b038e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b6000546001600160a01b03163314610e985760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161087191815260200190565b6000546001600160a01b03163314610f165760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b47610f213382611c61565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610871565b611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b03871684529091529020548015611026576000828152600b602090815260408083206001600160a01b038816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a25061103f565b6040516321c4e35760e21b815260040160405180910390fd5b50505050565b61104d61193d565b6000868152600560205260409020600381015461107d576040516331da482760e11b815260040160405180910390fd5b43816004015410156110a2576040516307b7d7dd60e51b815260040160405180910390fd5b6005810154600382015460405160609290921b6bffffffffffffffffffffffff1916602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161113291907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561118057604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526111f49060019060a0016020604051602081039080840390855afa1580156111d8573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526008602052604090205490915060ff1661122657604051632057875960e21b815260040160405180910390fd5b6009840154600385015460028601546001600160a01b039092169160009061124e9083612450565b60006003890181905560048901819055878152600960205260409020805460ff191660011790556008880154909150336001600160a01b03909116146112ff576002870154611000600160ac1b0333600c1b16600090815260076020526040812080549091906112bf9084906123dc565b90915550506008870154600c1b611000600160ac1b0316600090815260076020526040812080548492906112f49084906123dc565b909155506113419050565b81876002015461130f91906123dc565b611000600160ac1b0333600c1b166000908152600760205260408120805490919061133b9084906123dc565b90915550505b600687015461135b9084906001600160a01b031683611cc1565b6002870154156113c75760078701546001600160a01b038d81169116146113b857600787015460028801546113a09185916001600160a01b039091169060011c611cc1565b6113b3838d60018a60020154901c611cc1565b6113c7565b6113c7838d8960020154611cc1565b6006870154604080518f8152602081018590526001600160a01b03909216917f3fd2eee5028b09fa70abe3da4f6023ea41bfde24cfcb9c167f17d6fbe79eece3910160405180910390a25050505050505061142160018055565b505050505050565b6001600160a01b0382163314156114a357611000600160ac1b03600c83901b1660009081526006602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b60006114c661193d565b6114d083836115ee565b33600c1b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038816845290915290205460ff1c15156001141561151957611519846000610f57565b50611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b0388168452909152812080546b3fffffffffffffffffffffff8116939284929161156b908490612450565b90915550508161158e57604051635972996f60e11b815260040160405180910390fd5b611599853384611cc1565b604080516001600160a01b03871681526020810184905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a2506115e760018055565b9392505050565b6000815b808210156117c85760006005600086868681811061161257611612612363565b905060200201358152602001908152602001600020905061163281611d4d565b80546000908152600b6020908152604080832060098501546001600160a01b0316845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e40000009061168890836123dc565b11156116a75760405163f3fb0eb960e01b815260040160405180910390fd5b600382015482546000908152600b6020908152604080832060098701546001600160a01b03168452909152812080549091906116e49084906123dc565b90915550506000600383018190556008830154600c1b611000600160ac1b031660008181526007602052604090205490915060011c68056bc75e2d63100000811161174857600082815260076020526040902068056bc75e2d63100000905561175a565b60008281526007602052604090208190555b60068401546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff89898981811061179b5761179b612363565b905060200201356040516117b191815260200190565b60405180910390a2856001019550505050506115f2565b8082101561103f5763dfb035c96000526004601cfd5b6000546001600160a01b031633146118275760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b81518061183c5763df9578836000526004601cfd5b815181146118525763ff633a386000526004601cfd5b60208301602083018260051b82015b808314611421578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611861565b6000546001600160a01b031633146118ff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610871565b600154600214156119615760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b61197d8484846001600160a01b038516611d97565b61103f57604051631dc23a5f60e11b815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a0850151908201805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b039384161790915560c0860151600684018054831691841691909117905560e086015160078401805483169184169190911790556101008601516008840180548316918416919091179055610120860151600990930180549091169290911691909117905585611a785763ce3a3d376000526004601cfd5b6000818152600b602090815260408083206001600160a01b038616845290915281208054879290611aaa908490612450565b909155505060c08301518351606085015160405187936001600160a01b0316927f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea92611afe92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b83604051602401611b2c91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d9150600051905080945082611bc15763e10bf1cc6000526004601cfd5b50505050919050565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080611c5a5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016107d0565b5050505050565b600080600080600085875af1905080611cbc5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016107d0565b505050565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d116001600051141617169150600060605280604052508061103f5760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016107d0565b4381600401541115611d725760405163d0404f8560e01b815260040160405180910390fd5b6003810154611d94576040516331da482760e11b815260040160405180910390fd5b50565b60008315611dd3578360051b8501855b803580851160051b94855260209485185260406000209301818110611dcb57611dd0565b611da7565b50505b501492915050565b600060208284031215611ded57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611e3357611e33611df4565b604052919050565b600067ffffffffffffffff821115611e5557611e55611df4565b5060051b60200190565b6001600160a01b0381168114611d9457600080fd5b600082601f830112611e8557600080fd5b81356020611e9a611e9583611e3b565b611e0a565b82815260059290921b84018101918181019086841115611eb957600080fd5b8286015b84811015611edd578035611ed081611e5f565b8352918301918301611ebd565b509695505050505050565b600060208284031215611efa57600080fd5b813567ffffffffffffffff811115611f1157600080fd5b611f1d84828501611e74565b949350505050565b600060208284031215611f3757600080fd5b81356115e781611e5f565b60008083601f840112611f5457600080fd5b50813567ffffffffffffffff811115611f6c57600080fd5b6020830191508360208260051b8501011115611f8757600080fd5b9250929050565b6000806000806000806000806000806101008b8d031215611fae57600080fd5b8a35611fb981611e5f565b995060208b0135611fc981611e5f565b985060408b0135611fd981611e5f565b975060608b0135611fe981611e5f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561201457600080fd5b6120208e838f01611f42565b909650945060e08d013591508082111561203957600080fd5b506120468d828e01611f42565b915080935050809150509295989b9194979a5092959850565b8035801515811461206f57600080fd5b919050565b600080600080600060a0868803121561208c57600080fd5b853561209781611e5f565b945060208601356bffffffffffffffffffffffff811681146120b857600080fd5b935060408601356120c881611e5f565b92506120d66060870161205f565b949793965091946080013592915050565b600080604083850312156120fa57600080fd5b823561210581611e5f565b91506121136020840161205f565b90509250929050565b60008060008060008060c0878903121561213557600080fd5b86359550602087013561214781611e5f565b945060408701359350606087013592506080870135915060a087013560ff8116811461217257600080fd5b809150509295509295509295565b6000806040838503121561219357600080fd5b823561219e81611e5f565b946020939093013593505050565b600080604083850312156121bf57600080fd5b82356121ca81611e5f565b915060208301356121da81611e5f565b809150509250929050565b6000806000604084860312156121fa57600080fd5b833561220581611e5f565b9250602084013567ffffffffffffffff81111561222157600080fd5b61222d86828701611f42565b9497909650939450505050565b6000806020838503121561224d57600080fd5b823567ffffffffffffffff81111561226457600080fd5b61227085828601611f42565b90969095509350505050565b6000806040838503121561228f57600080fd5b8235915060208301356121da81611e5f565b600080604083850312156122b457600080fd5b823567ffffffffffffffff808211156122cc57600080fd5b6122d886838701611e74565b93506020915081850135818111156122ef57600080fd5b85019050601f8101861361230257600080fd5b8035612310611e9582611e3b565b81815260059190911b8201830190838101908883111561232f57600080fd5b928401925b82841015612354576123458461205f565b82529284019290840190612334565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156123ba5783516001600160a01b031683529284019291840191600101612395565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156123ef576123ef6123c6565b500190565b6000600019821415612408576124086123c6565b5060010190565b60008261242c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561244b5761244b6123c6565b500290565b600082821015612462576124626123c6565b50039056fea164736f6c6343000809000a", - "deployedBytecode": "0x6080604052600436106101d15760003560e01c80637f94f65d116100f75780639872dbfe11610095578063c52164c611610064578063c52164c6146106cc578063d4fac45d146106ec578063d6e8b9731461074b578063f7d0e04b1461076b57600080fd5b80639872dbfe146105fa57806398a26871146106105780639eee8d4b14610640578063ad8f2eed1461067857600080fd5b806385313e73116100d157806385313e73146105845780638da5cb5b146105a45780638db564c2146105c45780638e2749d6146105da57600080fd5b80637f94f65d146104d757806380e1d302146104f757806384ab1d281461054b57600080fd5b80634b2ae9801161016f5780636a1460241161013e5780636a1460241461044e5780636d82d9e01461046a578063758d77d41461048a57806377cd38a4146104aa57600080fd5b80634b2ae980146103be578063574983c8146103e95780635fd8c7101461040957806369cc6af41461041e57600080fd5b806316d72240116101ab57806316d722401461025f5780632b9f00e91461033e578063328a71811461035e578063461f31201461037e57600080fd5b806304937320146101dd5780630d2a2d441461021d57806313af40351461023f57600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b5061020a6101f8366004611ddb565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561022957600080fd5b5061023d610238366004611ee8565b61078b565b005b34801561024b57600080fd5b5061023d61025a366004611f25565b61087c565b34801561026b57600080fd5b506102df61027a366004611ddb565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009909801549698959794969395946001600160a01b0393841694928416939182169290821691168a565b604080519a8b5260208b019990995297890196909652606088019490945260808701929092526001600160a01b0390811660a087015290811660c086015290811660e08501529081166101008401521661012082015261014001610214565b34801561034a57600080fd5b5061020a610359366004611f8e565b61091d565b34801561036a57600080fd5b5061023d610379366004612074565b610c90565b34801561038a57600080fd5b506103ae610399366004611ddb565b60096020526000908152604090205460ff1681565b6040519015158152602001610214565b3480156103ca57600080fd5b5061020a6103d9366004611f25565b600c1b611000600160ac1b031690565b3480156103f557600080fd5b5061023d610404366004611ddb565b610e4f565b34801561041557600080fd5b5061023d610ecd565b34801561042a57600080fd5b506103ae610439366004611f25565b600a6020526000908152604090205460ff1681565b34801561045a57600080fd5b5061020a670de0b6b3a764000081565b34801561047657600080fd5b5061023d6104853660046120e7565b610f57565b34801561049657600080fd5b5061023d6104a536600461211c565b611045565b3480156104b657600080fd5b5061020a6104c5366004611ddb565b60066020526000908152604090205481565b3480156104e357600080fd5b5061023d6104f2366004612180565b611429565b34801561050357600080fd5b506103ae6105123660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b039094168352929052205460ff1c90565b34801561055757600080fd5b5061056c610566366004611ddb565b600c1c90565b6040516001600160a01b039091168152602001610214565b34801561059057600080fd5b5061020a61059f3660046121e5565b6114bc565b3480156105b057600080fd5b5060005461056c906001600160a01b031681565b3480156105d057600080fd5b5061020a60045481565b3480156105e657600080fd5b5061023d6105f536600461223a565b6115ee565b34801561060657600080fd5b5061020a60035481565b34801561061c57600080fd5b506103ae61062b366004611ddb565b60086020526000908152604090205460ff1681565b34801561064c57600080fd5b5061020a61065b36600461227c565b600b60209081526000928352604080842090915290825290205481565b34801561068457600080fd5b5061056c6106933660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b0390941683529290522054605f1c90565b3480156106d857600080fd5b5060025461056c906001600160a01b031681565b3480156106f857600080fd5b5061020a6107073660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b03909416835292905220546b3fffffffffffffffffffffff1690565b34801561075757600080fd5b5061023d6107663660046122a1565b6117de565b34801561077757600080fd5b5061023d610786366004611f25565b6118b6565b6000546001600160a01b031633146107d95760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156108405760006108198484815181106107fe576107fe612363565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600860205260409020805460ff191660019081179091559290920191506107df565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516108719190612379565b60405180910390a150565b6000546001600160a01b031633146108c55760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061092761193d565b61093183836115ee565b600c8b901b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038e1684529091529020548a9060ff1c61098557604051635972996f60e11b815260040160405180910390fd5b611000600160ac1b03600c8d901b166000908152600b602090815260408083206001600160a01b03851684529091529020546b3fffffffffffffffffffffff16878110156109e6576040516308aeed0f60e21b815260040160405180910390fd5b600454611000600160ac1b03600c8f901b1690600090610a079060016123dc565b90506004548a8e604051602001610a4393929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b60405160208183030381529060405280519060200120945043600560008781526020019081526020016000206004015410610a915760405163d0404f8560e01b815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c815260200160035443610ac591906123dc565b8152602001605f600b60008781526020019081526020016000206000896001600160a01b03166001600160a01b0316815260200190815260200160002054901c6001600160a01b031681526020018f6001600160a01b031681526020018e6001600160a01b03168152602001336001600160a01b03168152602001866001600160a01b0316815250905089899050600014610ba457600083815260066020526040902054610b77908b908b9033611968565b610b85848c8884898861199a565b60048054906000610b95836123f4565b91905055505050505050610c79565b68056bc75e2d63100000816060015111610bc657610b85848c8884898861199a565b611000600160ac1b0333600c1b1660009081526007602052604081205490610bfe610bf9670de0b6b3a76400008461240f565b611b0e565b9050610c12670de0b6b3a764000082612431565b83606001511180610c30575069d3c21bcecceda10000008360600151115b15610c4e57604051630e0c7c2360e11b815260040160405180910390fd5b610c5c868e8a868b8a61199a565b60048054906000610c6c836123f4565b9190505550505050505050505b610c8260018055565b9a9950505050505050505050565b84611000600160ac1b0333600c1b166001600160a01b038516610cc65760405163351de29f60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604090205460ff16610cff57604051630abc194760e11b815260040160405180910390fd5b6000818152600b602090815260408083206001600160a01b03861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610d556bffffffffffffffffffffffff8a16836123dc565b1115610d745760405163f3fb0eb960e01b815260040160405180910390fd5b610d7c61193d565b8415610d8c57610d8c3386611429565b87878760ff81901b605f83901b610da385876123dc565b6000898152600b602090815260408083206001600160a01b038e16845290915290209117919091179055610de78733306bffffffffffffffffffffffff8f16611bca565b610df060018055565b604080516001600160a01b038e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b6000546001600160a01b03163314610e985760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161087191815260200190565b6000546001600160a01b03163314610f165760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b47610f213382611c61565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610871565b611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b03871684529091529020548015611026576000828152600b602090815260408083206001600160a01b038816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a25061103f565b6040516321c4e35760e21b815260040160405180910390fd5b50505050565b61104d61193d565b6000868152600560205260409020600381015461107d576040516331da482760e11b815260040160405180910390fd5b43816004015410156110a2576040516307b7d7dd60e51b815260040160405180910390fd5b6005810154600382015460405160609290921b6bffffffffffffffffffffffff1916602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161113291907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561118057604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526111f49060019060a0016020604051602081039080840390855afa1580156111d8573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526008602052604090205490915060ff1661122657604051632057875960e21b815260040160405180910390fd5b6009840154600385015460028601546001600160a01b039092169160009061124e9083612450565b60006003890181905560048901819055878152600960205260409020805460ff191660011790556008880154909150336001600160a01b03909116146112ff576002870154611000600160ac1b0333600c1b16600090815260076020526040812080549091906112bf9084906123dc565b90915550506008870154600c1b611000600160ac1b0316600090815260076020526040812080548492906112f49084906123dc565b909155506113419050565b81876002015461130f91906123dc565b611000600160ac1b0333600c1b166000908152600760205260408120805490919061133b9084906123dc565b90915550505b600687015461135b9084906001600160a01b031683611cc1565b6002870154156113c75760078701546001600160a01b038d81169116146113b857600787015460028801546113a09185916001600160a01b039091169060011c611cc1565b6113b3838d60018a60020154901c611cc1565b6113c7565b6113c7838d8960020154611cc1565b6006870154604080518f8152602081018590526001600160a01b03909216917f3fd2eee5028b09fa70abe3da4f6023ea41bfde24cfcb9c167f17d6fbe79eece3910160405180910390a25050505050505061142160018055565b505050505050565b6001600160a01b0382163314156114a357611000600160ac1b03600c83901b1660009081526006602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b60006114c661193d565b6114d083836115ee565b33600c1b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038816845290915290205460ff1c15156001141561151957611519846000610f57565b50611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b0388168452909152812080546b3fffffffffffffffffffffff8116939284929161156b908490612450565b90915550508161158e57604051635972996f60e11b815260040160405180910390fd5b611599853384611cc1565b604080516001600160a01b03871681526020810184905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a2506115e760018055565b9392505050565b6000815b808210156117c85760006005600086868681811061161257611612612363565b905060200201358152602001908152602001600020905061163281611d4d565b80546000908152600b6020908152604080832060098501546001600160a01b0316845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e40000009061168890836123dc565b11156116a75760405163f3fb0eb960e01b815260040160405180910390fd5b600382015482546000908152600b6020908152604080832060098701546001600160a01b03168452909152812080549091906116e49084906123dc565b90915550506000600383018190556008830154600c1b611000600160ac1b031660008181526007602052604090205490915060011c68056bc75e2d63100000811161174857600082815260076020526040902068056bc75e2d63100000905561175a565b60008281526007602052604090208190555b60068401546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff89898981811061179b5761179b612363565b905060200201356040516117b191815260200190565b60405180910390a2856001019550505050506115f2565b8082101561103f5763dfb035c96000526004601cfd5b6000546001600160a01b031633146118275760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b81518061183c5763df9578836000526004601cfd5b815181146118525763ff633a386000526004601cfd5b60208301602083018260051b82015b808314611421578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611861565b6000546001600160a01b031633146118ff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610871565b600154600214156119615760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b61197d8484846001600160a01b038516611d97565b61103f57604051631dc23a5f60e11b815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a0850151908201805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b039384161790915560c0860151600684018054831691841691909117905560e086015160078401805483169184169190911790556101008601516008840180548316918416919091179055610120860151600990930180549091169290911691909117905585611a785763ce3a3d376000526004601cfd5b6000818152600b602090815260408083206001600160a01b038616845290915281208054879290611aaa908490612450565b909155505060c08301518351606085015160405187936001600160a01b0316927f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea92611afe92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b83604051602401611b2c91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d9150600051905080945082611bc15763e10bf1cc6000526004601cfd5b50505050919050565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080611c5a5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016107d0565b5050505050565b600080600080600085875af1905080611cbc5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016107d0565b505050565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d116001600051141617169150600060605280604052508061103f5760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016107d0565b4381600401541115611d725760405163d0404f8560e01b815260040160405180910390fd5b6003810154611d94576040516331da482760e11b815260040160405180910390fd5b50565b60008315611dd3578360051b8501855b803580851160051b94855260209485185260406000209301818110611dcb57611dd0565b611da7565b50505b501492915050565b600060208284031215611ded57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611e3357611e33611df4565b604052919050565b600067ffffffffffffffff821115611e5557611e55611df4565b5060051b60200190565b6001600160a01b0381168114611d9457600080fd5b600082601f830112611e8557600080fd5b81356020611e9a611e9583611e3b565b611e0a565b82815260059290921b84018101918181019086841115611eb957600080fd5b8286015b84811015611edd578035611ed081611e5f565b8352918301918301611ebd565b509695505050505050565b600060208284031215611efa57600080fd5b813567ffffffffffffffff811115611f1157600080fd5b611f1d84828501611e74565b949350505050565b600060208284031215611f3757600080fd5b81356115e781611e5f565b60008083601f840112611f5457600080fd5b50813567ffffffffffffffff811115611f6c57600080fd5b6020830191508360208260051b8501011115611f8757600080fd5b9250929050565b6000806000806000806000806000806101008b8d031215611fae57600080fd5b8a35611fb981611e5f565b995060208b0135611fc981611e5f565b985060408b0135611fd981611e5f565b975060608b0135611fe981611e5f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561201457600080fd5b6120208e838f01611f42565b909650945060e08d013591508082111561203957600080fd5b506120468d828e01611f42565b915080935050809150509295989b9194979a5092959850565b8035801515811461206f57600080fd5b919050565b600080600080600060a0868803121561208c57600080fd5b853561209781611e5f565b945060208601356bffffffffffffffffffffffff811681146120b857600080fd5b935060408601356120c881611e5f565b92506120d66060870161205f565b949793965091946080013592915050565b600080604083850312156120fa57600080fd5b823561210581611e5f565b91506121136020840161205f565b90509250929050565b60008060008060008060c0878903121561213557600080fd5b86359550602087013561214781611e5f565b945060408701359350606087013592506080870135915060a087013560ff8116811461217257600080fd5b809150509295509295509295565b6000806040838503121561219357600080fd5b823561219e81611e5f565b946020939093013593505050565b600080604083850312156121bf57600080fd5b82356121ca81611e5f565b915060208301356121da81611e5f565b809150509250929050565b6000806000604084860312156121fa57600080fd5b833561220581611e5f565b9250602084013567ffffffffffffffff81111561222157600080fd5b61222d86828701611f42565b9497909650939450505050565b6000806020838503121561224d57600080fd5b823567ffffffffffffffff81111561226457600080fd5b61227085828601611f42565b90969095509350505050565b6000806040838503121561228f57600080fd5b8235915060208301356121da81611e5f565b600080604083850312156122b457600080fd5b823567ffffffffffffffff808211156122cc57600080fd5b6122d886838701611e74565b93506020915081850135818111156122ef57600080fd5b85019050601f8101861361230257600080fd5b8035612310611e9582611e3b565b81815260059190911b8201830190838101908883111561232f57600080fd5b928401925b82841015612354576123458461205f565b82529284019290840190612334565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156123ba5783516001600160a01b031683529284019291840191600101612395565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156123ef576123ef6123c6565b500190565b6000600019821415612408576124086123c6565b5060010190565b60008261242c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561244b5761244b6123c6565b500290565b600082821015612462576124626123c6565b50039056fea164736f6c6343000809000a", + "bytecode": "0x6080604052600180556040516200322a3803806200322a8339810160408190526200002a9162000493565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000616565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005b1565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005c7565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b90565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003ce57620003ce6200038d565b604052919050565b60006001600160401b03821115620003f257620003f26200038d565b5060051b60200190565b6001600160a01b03811681146200041257600080fd5b50565b600082601f8301126200042757600080fd5b81516020620004406200043a83620003d6565b620003a3565b82815260059290921b840181019181810190868411156200046057600080fd5b8286015b84811015620004885780516200047a81620003fc565b835291830191830162000464565b509695505050505050565b600080600080600060a08688031215620004ac57600080fd5b8551602080880151919650906001600160401b0380821115620004ce57600080fd5b620004dc8a838b0162000415565b965060408901519150620004f082620003fc565b6060890151919550808211156200050657600080fd5b620005148a838b0162000415565b945060808901519150808211156200052b57600080fd5b508701601f810189136200053e57600080fd5b80516200054f6200043a82620003d6565b81815260059190911b8201830190838101908b8311156200056f57600080fd5b928401925b828410156200059f57835180151581146200058f5760008081fd5b8252928401929084019062000574565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156200060a5783516001600160a01b031683529284019291840191600101620005e3565b50909695505050505050565b612c0480620006266000396000f3fe6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610215610203366004612406565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461248d565b6107be565b34801561025457600080fd5b50610268610263366004612674565b610b6d565b005b34801561027657600080fd5b506102686102853660046126b1565b610ca7565b34801561029657600080fd5b506102686102a53660046126ea565b610d98565b3480156102b657600080fd5b506103376102c5366004612406565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be366004612406565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe3660046126b1565b600c1b90565b34801561041057600080fd5b5061026861041f366004612406565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d36104543660046126b1565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461275d565b611151565b3480156104b157600080fd5b506102686104c0366004612792565b611268565b3480156104d157600080fd5b506102156104e0366004612406565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127f6565b611747565b34801561051e57600080fd5b506103d361052d366004612822565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d366004612406565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c366004612406565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461285b565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b50610573610674366004612822565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b4366004612880565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b506107066107013660046128c2565b611a50565b60405161021f9190612909565b34801561071f57600080fd5b5061021561072e366004612822565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461294d565b611b5b565b34801561078a57600080fd5b506102686107993660046126b1565b611c6b565b3480156107aa57600080fd5b506102686107b9366004612a0f565b611d37565b60006107c8611e33565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a9a565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a9a565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e77565b610a4e848c84848988611ecf565b60048054906000610a5e83612ab2565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611ecf565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aeb565b61202a565b9050610ad4670de0b6b3a764000082612b26565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611ecf565b60048054906000610b4783612ab2565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b63565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b92565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a9a565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e33565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a9a565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120e6565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b33826121b0565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e33565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612be0565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a9a565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a9a565b9091555061162b9050565b8187600201546116039190612a9a565b33600c1b60009081526007602052604081208054909190611625908490612a9a565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff168361222a565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c61222a565b6116c4838d60018a60020154901c61222a565b6116d8565b6116d8838d896002015461222a565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b63565b9050602002013581526020019081526020016000209050611851816122e9565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a9a565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a9a565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b63565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b606073ffffffffffffffffffffffffffffffffffffffff8216611a9f576040517fdf95788300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8251611ad7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82516000905b80821015611b5357611b30858381518110611afa57611afa612b63565b602090810291909101810151600c1b6000908152600b8252604080822088835290925220546b3fffffffffffffffffffffff1690565b838381518110611b4257611b42612b63565b602002602001018181525050611add565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bf15763df9578836000526004601cfd5b81518114611c075763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611c16565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d3f611e33565b611d49828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d7f57611d7f846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611dcd906b3fffffffffffffffffffffff16858784612365565b611dd885338661222a565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e70576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e9984848473ffffffffffffffffffffffffffffffffffffffff85166123c2565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611fbe86868484612365565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea659261201a92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161204891815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120dd5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806121a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af1905080612225576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b4381600401541115612327576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612362576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123785763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152812080548592906123b7908490612be0565b909155505050505050565b600083156123fe578360051b8501855b803580851160051b948552602094851852604060002093018181106123f6576123fb565b6123d2565b50505b501492915050565b60006020828403121561241857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461236257600080fd5b60008083601f84011261245357600080fd5b50813567ffffffffffffffff81111561246b57600080fd5b6020830191508360208260051b850101111561248657600080fd5b9250929050565b6000806000806000806000806000806101008b8d0312156124ad57600080fd5b8a356124b88161241f565b995060208b01356124c88161241f565b985060408b01356124d88161241f565b975060608b01356124e88161241f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561251357600080fd5b61251f8e838f01612441565b909650945060e08d013591508082111561253857600080fd5b506125458d828e01612441565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125d4576125d461255e565b604052919050565b600067ffffffffffffffff8211156125f6576125f661255e565b5060051b60200190565b600082601f83011261261157600080fd5b81356020612626612621836125dc565b61258d565b82815260059290921b8401810191818101908684111561264557600080fd5b8286015b8481101561266957803561265c8161241f565b8352918301918301612649565b509695505050505050565b60006020828403121561268657600080fd5b813567ffffffffffffffff81111561269d57600080fd5b6126a984828501612600565b949350505050565b6000602082840312156126c357600080fd5b81356126ce8161241f565b9392505050565b803580151581146126e557600080fd5b919050565b600080600080600060a0868803121561270257600080fd5b853561270d8161241f565b945060208601356bffffffffffffffffffffffff8116811461272e57600080fd5b9350604086013561273e8161241f565b925061274c606087016126d5565b949793965091946080013592915050565b6000806040838503121561277057600080fd5b823561277b8161241f565b9150612789602084016126d5565b90509250929050565b60008060008060008060c087890312156127ab57600080fd5b8635955060208701356127bd8161241f565b945060408701359350606087013592506080870135915060a087013560ff811681146127e857600080fd5b809150509295509295509295565b6000806040838503121561280957600080fd5b82356128148161241f565b946020939093013593505050565b6000806040838503121561283557600080fd5b82356128408161241f565b915060208301356128508161241f565b809150509250929050565b6000806040838503121561286e57600080fd5b8235915060208301356128508161241f565b6000806020838503121561289357600080fd5b823567ffffffffffffffff8111156128aa57600080fd5b6128b685828601612441565b90969095509350505050565b600080604083850312156128d557600080fd5b823567ffffffffffffffff8111156128ec57600080fd5b6128f885828601612600565b92505060208301356128508161241f565b6020808252825182820181905260009190848201906040850190845b8181101561294157835183529284019291840191600101612925565b50909695505050505050565b6000806040838503121561296057600080fd5b823567ffffffffffffffff8082111561297857600080fd5b61298486838701612600565b935060209150818501358181111561299b57600080fd5b85019050601f810186136129ae57600080fd5b80356129bc612621826125dc565b81815260059190911b820183019083810190888311156129db57600080fd5b928401925b82841015612a00576129f1846126d5565b825292840192908401906129e0565b80955050505050509250929050565b60008060008060608587031215612a2557600080fd5b8435612a308161241f565b935060208501359250604085013567ffffffffffffffff811115612a5357600080fd5b612a5f87828801612441565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612aad57612aad612a6b565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ae457612ae4612a6b565b5060010190565b600082612b21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b5e57612b5e612a6b565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561294157835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612bae565b600082821015612bf257612bf2612a6b565b50039056fea164736f6c6343000809000a", + "deployedBytecode": "0x6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610215610203366004612406565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461248d565b6107be565b34801561025457600080fd5b50610268610263366004612674565b610b6d565b005b34801561027657600080fd5b506102686102853660046126b1565b610ca7565b34801561029657600080fd5b506102686102a53660046126ea565b610d98565b3480156102b657600080fd5b506103376102c5366004612406565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be366004612406565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe3660046126b1565b600c1b90565b34801561041057600080fd5b5061026861041f366004612406565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d36104543660046126b1565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461275d565b611151565b3480156104b157600080fd5b506102686104c0366004612792565b611268565b3480156104d157600080fd5b506102156104e0366004612406565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127f6565b611747565b34801561051e57600080fd5b506103d361052d366004612822565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d366004612406565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c366004612406565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461285b565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b50610573610674366004612822565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b4366004612880565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b506107066107013660046128c2565b611a50565b60405161021f9190612909565b34801561071f57600080fd5b5061021561072e366004612822565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461294d565b611b5b565b34801561078a57600080fd5b506102686107993660046126b1565b611c6b565b3480156107aa57600080fd5b506102686107b9366004612a0f565b611d37565b60006107c8611e33565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a9a565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a9a565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e77565b610a4e848c84848988611ecf565b60048054906000610a5e83612ab2565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611ecf565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aeb565b61202a565b9050610ad4670de0b6b3a764000082612b26565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611ecf565b60048054906000610b4783612ab2565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b63565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b92565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a9a565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e33565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a9a565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120e6565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b33826121b0565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e33565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612be0565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a9a565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a9a565b9091555061162b9050565b8187600201546116039190612a9a565b33600c1b60009081526007602052604081208054909190611625908490612a9a565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff168361222a565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c61222a565b6116c4838d60018a60020154901c61222a565b6116d8565b6116d8838d896002015461222a565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b63565b9050602002013581526020019081526020016000209050611851816122e9565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a9a565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a9a565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b63565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b606073ffffffffffffffffffffffffffffffffffffffff8216611a9f576040517fdf95788300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8251611ad7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82516000905b80821015611b5357611b30858381518110611afa57611afa612b63565b602090810291909101810151600c1b6000908152600b8252604080822088835290925220546b3fffffffffffffffffffffff1690565b838381518110611b4257611b42612b63565b602002602001018181525050611add565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bf15763df9578836000526004601cfd5b81518114611c075763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611c16565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d3f611e33565b611d49828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d7f57611d7f846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611dcd906b3fffffffffffffffffffffff16858784612365565b611dd885338661222a565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e70576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e9984848473ffffffffffffffffffffffffffffffffffffffff85166123c2565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611fbe86868484612365565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea659261201a92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161204891815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120dd5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806121a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af1905080612225576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b4381600401541115612327576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612362576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123785763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152812080548592906123b7908490612be0565b909155505050505050565b600083156123fe578360051b8501855b803580851160051b948552602094851852604060002093018181106123f6576123fb565b6123d2565b50505b501492915050565b60006020828403121561241857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461236257600080fd5b60008083601f84011261245357600080fd5b50813567ffffffffffffffff81111561246b57600080fd5b6020830191508360208260051b850101111561248657600080fd5b9250929050565b6000806000806000806000806000806101008b8d0312156124ad57600080fd5b8a356124b88161241f565b995060208b01356124c88161241f565b985060408b01356124d88161241f565b975060608b01356124e88161241f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561251357600080fd5b61251f8e838f01612441565b909650945060e08d013591508082111561253857600080fd5b506125458d828e01612441565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125d4576125d461255e565b604052919050565b600067ffffffffffffffff8211156125f6576125f661255e565b5060051b60200190565b600082601f83011261261157600080fd5b81356020612626612621836125dc565b61258d565b82815260059290921b8401810191818101908684111561264557600080fd5b8286015b8481101561266957803561265c8161241f565b8352918301918301612649565b509695505050505050565b60006020828403121561268657600080fd5b813567ffffffffffffffff81111561269d57600080fd5b6126a984828501612600565b949350505050565b6000602082840312156126c357600080fd5b81356126ce8161241f565b9392505050565b803580151581146126e557600080fd5b919050565b600080600080600060a0868803121561270257600080fd5b853561270d8161241f565b945060208601356bffffffffffffffffffffffff8116811461272e57600080fd5b9350604086013561273e8161241f565b925061274c606087016126d5565b949793965091946080013592915050565b6000806040838503121561277057600080fd5b823561277b8161241f565b9150612789602084016126d5565b90509250929050565b60008060008060008060c087890312156127ab57600080fd5b8635955060208701356127bd8161241f565b945060408701359350606087013592506080870135915060a087013560ff811681146127e857600080fd5b809150509295509295509295565b6000806040838503121561280957600080fd5b82356128148161241f565b946020939093013593505050565b6000806040838503121561283557600080fd5b82356128408161241f565b915060208301356128508161241f565b809150509250929050565b6000806040838503121561286e57600080fd5b8235915060208301356128508161241f565b6000806020838503121561289357600080fd5b823567ffffffffffffffff8111156128aa57600080fd5b6128b685828601612441565b90969095509350505050565b600080604083850312156128d557600080fd5b823567ffffffffffffffff8111156128ec57600080fd5b6128f885828601612600565b92505060208301356128508161241f565b6020808252825182820181905260009190848201906040850190845b8181101561294157835183529284019291840191600101612925565b50909695505050505050565b6000806040838503121561296057600080fd5b823567ffffffffffffffff8082111561297857600080fd5b61298486838701612600565b935060209150818501358181111561299b57600080fd5b85019050601f810186136129ae57600080fd5b80356129bc612621826125dc565b81815260059190911b820183019083810190888311156129db57600080fd5b928401925b82841015612a00576129f1846126d5565b825292840192908401906129e0565b80955050505050509250929050565b60008060008060608587031215612a2557600080fd5b8435612a308161241f565b935060208501359250604085013567ffffffffffffffff811115612a5357600080fd5b612a5f87828801612441565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612aad57612aad612a6b565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ae457612ae4612a6b565b5060010190565b600082612b21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b5e57612b5e612a6b565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561294157835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612bae565b600082821015612bf257612bf2612a6b565b50039056fea164736f6c6343000809000a", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/contracts/EventAndErrors.sol b/contracts/EventAndErrors.sol index 606c451..a59062d 100644 --- a/contracts/EventAndErrors.sol +++ b/contracts/EventAndErrors.sol @@ -23,18 +23,18 @@ interface EventAndErrors { ); event LockAdded( address indexed buyer, - bytes32 indexed lockID, + uint256 indexed lockID, uint256 seller, uint256 amount ); event LockReleased( address indexed buyer, - bytes32 lockId, + uint256 lockId, uint256 amount ); event LockReturned( address indexed buyer, - bytes32 lockId + uint256 lockId ); event FundsWithdrawn( address owner, @@ -108,8 +108,10 @@ interface EventAndErrors { /// @dev 0xce3a3d37 error DecOverflow(); - /// @dev 0x + /// @dev 0xf3fb0eb9 error MaxBalExceeded(); + /// @dev 0x6a3bc53e error EmptyPixTarget(); + /// @dev 0x87138d5c error NotInitialized(); } diff --git a/contracts/lib/utils/Counters.sol b/contracts/lib/utils/Counters.sol deleted file mode 100644 index 8039093..0000000 --- a/contracts/lib/utils/Counters.sol +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.8.4; - -/// @title Counters -/// @author buf0t9 -/// @author Modified from OpenZeppelin Contracts -/// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol) -/// @notice Provides counters that can only be incremented, decrementedor reset. -/// @dev Include with `using Counters for Counters.Counter;` -library Counters { - // solhint-disable no-inline-assembly - struct Counter { - /// @dev Interactions must be restricted to the library's function. - uint256 _val; // := 0 - } - - /// @dev 0xce3a3d37 - error DecOverflow(); - - function current( - Counter storage counter - ) internal view returns (uint256 _val) { - assembly { - _val := sload(counter.slot) - } - } - - function increment(Counter storage counter) internal { - assembly { - let _val := sload(counter.slot) - sstore(counter.slot, add(_val, 0x01)) - } - } - - function decrement(Counter storage counter) internal { - assembly { - let _val := sload(counter.slot) - if or(iszero(_val), lt(_val, 0x00)) { - mstore(0x00, 0xce3a3d37) - revert(0x1c, 0x04) - } - sstore(counter.slot, sub(_val, 0x01)) - } - } - - function reset(Counter storage counter) internal { - assembly { - sstore(counter.slot, 0) - } - } -} diff --git a/contracts/p2pix.sol b/contracts/p2pix.sol index 11121ba..fb50051 100644 --- a/contracts/p2pix.sol +++ b/contracts/p2pix.sol @@ -9,7 +9,6 @@ pragma solidity 0.8.9; /// import { Owned } from "./lib/auth/Owned.sol"; -// import { Counters } from "./lib/utils/Counters.sol"; import { ERC20, SafeTransferLib } from "./lib/utils/SafeTransferLib.sol"; import { IReputation } from "./lib/interfaces/IReputation.sol"; import { MerkleProofLib as Merkle } from "./lib/utils/MerkleProofLib.sol"; @@ -24,22 +23,22 @@ contract P2PIX is { // solhint-disable use-forbidden-name // solhint-disable no-inline-assembly + // solhint-disable no-empty-blocks - // using Counters for Counters.Counter; using DT for DT.Lock; /// ███ Constants ██████████████████████████████████████████████████████████ - /// @dev The bitmask of `sellerBalance` entry. - uint256 constant private BITMASK_SB_ENTRY = (1 << 94) - 1; + /// @dev The bitmask of `sellerBalance` entry. + uint256 private constant BITMASK_SB_ENTRY = (1 << 94) - 1; /// @dev The bit position of `pixTarget` in `sellerBalance`. - uint256 constant private BITPOS_PIXTARGET = 95; + uint256 private constant BITPOS_PIXTARGET = 95; /// @dev The bit position of `valid` in `sellerBalance`. - uint256 constant private BITPOS_VALID = 255; + uint256 private constant BITPOS_VALID = 255; /// @dev The bitmask of all 256 bits of `sellerBalance` except for the last one. - uint256 constant private BITMASK_VALID = (1 << 255) - 1; + uint256 private constant BITMASK_VALID = (1 << 255) - 1; /// @dev The scalar of BRZ token. - uint256 constant public WAD = 1e18; + uint256 public constant WAD = 1e18; /// ███ Storage ████████████████████████████████████████████████████████████ @@ -51,7 +50,7 @@ contract P2PIX is uint256 public lockCounter; /// @dev List of Locks. - mapping(bytes32 => DT.Lock) public mapLocks; + mapping(uint256 => DT.Lock) public mapLocks; /// @dev Seller casted to key => Seller's allowlist merkleroot. mapping(uint256 => bytes32) public sellerAllowList; /// @dev Stores an relayer's last computed credit. @@ -66,11 +65,12 @@ contract P2PIX is // BITS LAYOUT // `uint96` [0...94] := balance // `uint160` [95...254] := pixTarget - // `bool` [255] := valid - + // `bool` [255] := valid + /// @dev `balance` max. value = 10**26. /// @dev `pixTarget` keys are restricted to 160 bits. - mapping(uint256 => mapping(ERC20 => uint256)) public sellerBalance; + mapping(uint256 => mapping(ERC20 => uint256)) + public sellerBalance; /// ███ Constructor ████████████████████████████████████████████████████████ @@ -105,17 +105,17 @@ contract P2PIX is ) public { ERC20 t = ERC20(_token); uint256 k = _castAddrToKey(msg.sender); - - if(_pixTarget == 0) + + if (_pixTarget == 0) revert EmptyPixTarget(); if (!allowedERC20s[t]) revert TokenDenied(); uint256 _sellerBalance = sellerBalance[k][t]; - + uint256 currBal = - _sellerBalance & BITMASK_SB_ENTRY; - if ((currBal + _amount) > 1e8 ether) + _sellerBalance & BITMASK_SB_ENTRY; + if ((currBal + _amount) > 1e8 ether) revert MaxBalExceeded(); setReentrancyGuard(); @@ -123,17 +123,25 @@ contract P2PIX is if (allowlistRoot != 0) { setRoot(msg.sender, allowlistRoot); } - + uint256 amountCasted; uint256 pixTargetCasted; uint256 validCasted; - (amountCasted, pixTargetCasted, validCasted) = - _castToUint(_amount, _pixTarget, _valid); - sellerBalance[k][t] = - (currBal + amountCasted) | - (pixTargetCasted << BITPOS_PIXTARGET) | - (validCasted << BITPOS_VALID); + ( + amountCasted, + pixTargetCasted, + validCasted + ) = _castToUint( + _amount, + _pixTarget, + _valid + ); + sellerBalance[k][t] = + (currBal + amountCasted) | + (pixTargetCasted << BITPOS_PIXTARGET) | + (validCasted << BITPOS_VALID); + SafeTransferLib.safeTransferFrom( t, msg.sender, @@ -144,8 +152,8 @@ contract P2PIX is clearReentrancyGuard(); emit DepositAdded( - msg.sender, - _token, + msg.sender, + _token, _amount ); } @@ -155,23 +163,27 @@ contract P2PIX is /// @dev This function does not affect any ongoing active locks. /// @dev Function sighash: 0x72fada5c. function setValidState(ERC20 token, bool state) public { - uint256 key = _castAddrToKey(msg.sender); + uint256 key = + _castAddrToKey(msg.sender); uint256 _sellerBalance = sellerBalance[key][token]; + if (_sellerBalance != 0) { uint256 _valid; - assembly { - _valid := state - } - _sellerBalance = (_sellerBalance & BITMASK_VALID) | - (_valid << BITPOS_VALID); - sellerBalance[key][token] = _sellerBalance; + assembly { _valid := state } - emit ValidSet( - msg.sender, - address(token), - state - ); + _sellerBalance = + (_sellerBalance & BITMASK_VALID) | + (_valid << BITPOS_VALID); + + sellerBalance[key][token] = + _sellerBalance; + + emit ValidSet( + msg.sender, + address(token), + state + ); } else revert NotInitialized(); } @@ -203,39 +215,38 @@ contract P2PIX is uint256 _relayerPremium, uint256 _amount, bytes32[] calldata merkleProof, - bytes32[] calldata expiredLocks - ) public nonReentrant returns (bytes32 lockID) { + uint256[] calldata expiredLocks + ) public nonReentrant returns (uint256) { unlockExpired(expiredLocks); + ERC20 t = ERC20(_token); if (!getValid(_seller, t)) revert InvalidDeposit(); - uint256 bal = getBalance(_seller, t); + + uint256 bal = + getBalance(_seller, t); if (bal < _amount) revert NotEnoughTokens(); uint256 k = _castAddrToKey(_seller); - uint256 cachedCounter = - lockCounter + 1; + uint256 cCounter = + lockCounter + 1; - lockID = keccak256( - abi.encodePacked( - lockCounter, - _amount, - _buyerAddress - ) - ); - if (mapLocks[lockID].expirationBlock >= block.number) - revert NotExpired(); + if (mapLocks[cCounter].expirationBlock + >= block.number) + revert NotExpired(); DT.Lock memory l = DT.Lock( k, - cachedCounter, + cCounter, _relayerPremium, _amount, - (block.number + defaultLockBlocks), - uint160(sellerBalance[k][t] >> BITPOS_PIXTARGET), + (block.number + + defaultLockBlocks), + uint160(sellerBalance[k][t] + >> BITPOS_PIXTARGET), _buyerAddress, _relayerTarget, msg.sender, @@ -250,56 +261,62 @@ contract P2PIX is ); _addLock( - bal, - _amount, - lockID, + bal, + _amount, + cCounter, l, t, - k); - + k + ); + lockCounter++; // Halt execution and output `lockID`. - return lockID; + return cCounter; } else { if (l.amount <= 1e2 ether) { _addLock( - bal, - _amount, - lockID, - l, - t, - k); - - lockCounter++; + bal, + _amount, + cCounter, + l, + t, + k + ); - // Halt execution and output `lockID`. - return lockID; + lockCounter++; + + // Halt execution and output `lockID`. + return cCounter; } else { uint256 userCredit = userRecord[ _castAddrToKey(msg.sender) ]; + uint256 spendLimit; - (spendLimit) = _limiter(userCredit / WAD); + (spendLimit) = + _limiter(userCredit / WAD); - if (l.amount > (spendLimit * WAD) || - l.amount > 1e6 ether) - revert AmountNotAllowed(); + if ( + l.amount > (spendLimit * WAD) || + l.amount > 1e6 ether + ) revert AmountNotAllowed(); - _addLock( - bal, - _amount, - lockID, - l, - t, - k); - - lockCounter++; + _addLock( + bal, + _amount, + cCounter, + l, + t, + k + ); - // Halt execution and output `lockID`. - return lockID; + lockCounter++; + + // Halt execution and output `lockID`. + return cCounter; } } } @@ -318,7 +335,7 @@ contract P2PIX is /// @param _relayerTarget Target address entitled to the `relayerPremim`. /// @dev Function sighash: 0x4e1389ed. function release( - bytes32 lockID, + uint256 lockID, address _relayerTarget, bytes32 pixTimestamp, bytes32 r, @@ -358,22 +375,25 @@ contract P2PIX is ERC20 t = ERC20(l.token); // We cache values before zeroing them out. - uint256 lockAmount = l.amount; - uint256 totalAmount = (lockAmount - l.relayerPremium); + uint256 lockAmount = + l.amount; + uint256 totalAmount = + (lockAmount - l.relayerPremium); l.amount = 0; l.expirationBlock = 0; usedTransactions[message] = true; if (msg.sender != l.relayerAddress) { - userRecord[_castAddrToKey(msg.sender)] += l - .relayerPremium; + userRecord[ + _castAddrToKey(msg.sender) + ] += l.relayerPremium; userRecord[ _castAddrToKey(l.relayerAddress) ] += lockAmount; } else { - userRecord[_castAddrToKey(msg.sender)] += (l - .relayerPremium + lockAmount); + userRecord[_castAddrToKey(msg.sender)] + += (l.relayerPremium + lockAmount); } SafeTransferLib.safeTransfer( @@ -404,7 +424,11 @@ contract P2PIX is } } - emit LockReleased(l.buyerAddress, lockID, lockAmount); + emit LockReleased( + l.buyerAddress, + lockID, + lockAmount + ); } /// @notice Unlocks expired locks. @@ -413,38 +437,49 @@ contract P2PIX is /// @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(uint256[] calldata lockIDs) + public + { uint256 i; uint256 locksSize = lockIDs.length; for (i; i < locksSize; ) { - DT.Lock storage l = mapLocks[lockIDs[i]]; + DT.Lock storage l = + mapLocks[lockIDs[i]]; _notExpired(l); uint256 _sellerBalance = - sellerBalance[l.sellerKey][ERC20(l.token)] & BITMASK_SB_ENTRY; - if((_sellerBalance + l.amount) > 1e8 ether) + sellerBalance[ + l.sellerKey][ERC20(l.token) + ] & BITMASK_SB_ENTRY; + + if ( + (_sellerBalance + l.amount) + > 1e8 ether + ) revert MaxBalExceeded(); - sellerBalance[l.sellerKey][ERC20(l.token)] += l.amount; + sellerBalance[ + l.sellerKey][ERC20(l.token) + ] += 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 <= 1e2 ether) { userRecord[userKey] = 1e2 ether; } else { userRecord[userKey] = _newUserRecord; } - emit LockReturned(l.buyerAddress, lockIDs[i]); + emit LockReturned( + l.buyerAddress, + lockIDs[i] + ); unchecked { ++i; @@ -466,11 +501,11 @@ contract P2PIX is /// @dev Function sighash: 0x36317972. function withdraw( ERC20 token, - bytes32[] calldata expiredLocks - ) - public - nonReentrant - returns(uint256 _sellerBalance) + uint256 amount, + uint256[] calldata expiredLocks + ) + public + nonReentrant { unlockExpired(expiredLocks); @@ -478,37 +513,35 @@ contract P2PIX is == true ) { setValidState(token, false); - } + } uint256 key = _castAddrToKey(msg.sender); + _decBal( + (sellerBalance[key][token] + & BITMASK_SB_ENTRY), + amount, + token, + key + ); - sellerBalance[key][token] -= - (_sellerBalance = - sellerBalance[key][token] - & BITMASK_SB_ENTRY); - - if(_sellerBalance == 0) - revert InvalidDeposit(); + // safeTransfer tokens to seller + SafeTransferLib.safeTransfer( + token, + msg.sender, + amount + ); - // safeTransfer tokens to seller - SafeTransferLib.safeTransfer( - token, - msg.sender, - _sellerBalance - ); - - emit DepositWithdrawn( - msg.sender, - address(token), - _sellerBalance - ); + emit DepositWithdrawn( + msg.sender, + address(token), + amount + ); } - function setRoot( - address addr, - bytes32 merkleroot - ) public { + function setRoot(address addr, bytes32 merkleroot) + public + { if (addr == msg.sender) { sellerAllowList[ _castAddrToKey(addr) @@ -527,27 +560,30 @@ 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; @@ -623,33 +659,14 @@ contract P2PIX is function _addLock( uint256 _bal, uint256 _amount, - bytes32 _lockID, + uint256 _lockID, DT.Lock memory _l, ERC20 _t, uint256 _k ) internal { - mapLocks[_lockID] = _l; - - assembly { - if iszero( - iszero( - or( - iszero(_bal), - lt( - sub( - _bal, - _amount), - 0x0 - )))) { - // DecOverflow() - mstore(0x00, 0xce3a3d37) - revert(0x1c, 0x04) - } - } - - // we can directly dec from packed uint entry value - sellerBalance[_k][_t] -= _amount; + + _decBal(_bal, _amount, _t, _k); emit LockAdded( _l.buyerAddress, @@ -657,61 +674,8 @@ contract P2PIX is _l.sellerKey, _l.amount ); - - /// @todo - // assembly { - // // sstore(mp.slot, _l) - // mstore(0x00, _k) - // mstore(0x20, sellerBalance.slot) - // let sbkslot := keccak256(0x00, 0x40) - // mstore(0x00, _t) - // mstore(0x20, sbkslot) - // let sbslot := keccak256(0x00,0x40) - // let oldsb := sload(sbslot) - // sstore( - // sbslot, - // or( - // or( - // _newBal, - // shr( - // oldsb, - // BITPOS_PIXTARGET - // )), - // and( - // shr( - // oldsb, - // BITPOS_VALID - // ), - // BITMASK_SB_ENTRY - // ) - // ) - // ) - // } - } - /// @notice Private view auxiliar logic that encodes/returns - /// the `bytes32` identifier of an lock. - /// @dev reverts on a not expired lock with the same ID passed - /// as argument of the function. - /// @dev Called exclusively by the `lock` method. - /// @dev Function sighash: 0x3fc5fb52. - // function _encodeLockID( - // uint256 _lockCounter, - // uint256 _amount, - // address _buyerAddress - // ) private view returns (bytes32 _lockID) { - // _lockID = keccak256( - // abi.encodePacked( - // _lockCounter, - // _amount, - // _buyerAddress - // ) - // ); - // if (mapLocks[_lockID].expirationBlock >= block.number) - // revert NotExpired(); - // } - function merkleVerify( bytes32[] calldata _merkleProof, bytes32 root, @@ -726,9 +690,11 @@ 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, @@ -766,80 +732,164 @@ contract P2PIX is } function _castToUint( - uint96 _amount, - uint160 _pixTarget, - bool _valid) - private - pure + uint96 _amount, + uint160 _pixTarget, + bool _valid + ) + private + pure returns ( - uint256 _amountCasted, - uint256 _pixTargetCasted, + uint256 _amountCasted, + uint256 _pixTargetCasted, uint256 _validCasted - ) { - assembly { - _amountCasted := _amount - _pixTargetCasted := _pixTarget - _validCasted := _valid + ) + { + assembly { + _amountCasted := _amount + _pixTargetCasted := _pixTarget + _validCasted := _valid + } + } + + function _decBal( + uint256 _bal, + uint256 _amount, + ERC20 _t, + uint256 _k + ) private { + assembly { + if iszero( + iszero( + or( + iszero(_bal), + lt(sub(_bal, _amount), 0x0) + ) + ) + ) { + // DecOverflow() + mstore(0x00, 0xce3a3d37) + revert(0x1c, 0x04) } } - function getBalance( - address seller, - ERC20 token - ) - public - view - returns(uint256 bal) - { - bal = - sellerBalance[ - _castAddrToKey(seller) - ][token] & BITMASK_SB_ENTRY; + // we can directly dec from packed uint entry value + sellerBalance[_k][_t] -= _amount; } - function getValid( - address seller, - ERC20 token - ) - public - view - returns(bool valid) + function getBalance(address seller, ERC20 token) + public + view + returns (uint256 bal) { - uint256 b = - (sellerBalance[ - _castAddrToKey(seller) - ][token] >> BITPOS_VALID) & BITMASK_SB_ENTRY; - assembly { valid := b } + // bal = + // sellerBalance[_castAddrToKey(seller)][token] & + // BITMASK_SB_ENTRY; + assembly { + for {/* */} iszero(0x0) {/* */} { + mstore(0x00, shl(0xC,seller)) + mstore(0x20, sellerBalance.slot) + let sbkslot := keccak256(0x00, 0x40) + mstore(0x00, token) + mstore(0x20, sbkslot) + bal := and( + BITMASK_SB_ENTRY, + sload(keccak256(0x00,0x40) + )) break + }} } - function getPixTarget( - address seller, + function getValid(address seller, ERC20 token) + public + view + returns (bool valid) + { + // uint256 b = sellerBalance[ + // _castAddrToKey(seller) + // ][token]; + // ] >> BITPOS_VALID) & BITMASK_SB_ENTRY; + assembly { + for {/* */} iszero(0x0) {/* */} { + mstore(0x00, shl(0xC,seller)) + mstore(0x20, sellerBalance.slot) + let sbkslot := keccak256(0x00, 0x40) + mstore(0x00, token) + mstore(0x20, sbkslot) + valid := and( + BITMASK_SB_ENTRY, + shr( + BITPOS_VALID, + sload(keccak256(0x00,0x40) + ))) break + }} + } + + function getPixTarget(address seller, ERC20 token) + public + view + returns (uint160 pixTarget) + { + // pixTarget = uint160( + // sellerBalance[_castAddrToKey(seller)][token] >> + // BITPOS_PIXTARGET + // ); + assembly { + for {/* */} iszero(0) {/* */} { + mstore(0,shl(12,seller)) + mstore(32,sellerBalance.slot) + let sbkslot := keccak256(0,64) + mstore(0,token) + mstore(32,sbkslot) + pixTarget := shr( + BITPOS_PIXTARGET, + sload(keccak256(0,64) + )) break + }} + } + + function getBalances( + address[] memory sellers, ERC20 token ) - public + external view - returns(uint160 pixTarget) + returns(uint256[] memory balances) { - pixTarget = - uint160( - sellerBalance[ - _castAddrToKey(seller) - ][token] >> BITPOS_PIXTARGET - ); + if(address(token) == address(0x0)) + revert NoTokens(); + if(sellers.length == 0) + revert LengthMismatch(); + + uint256 j; + uint256 len = sellers.length; + while (j < len) { balances[j] = + getBalance(sellers[j], token); + } + + return balances; } /// @notice Public method that handles `address` /// to `uint256` safe type casting. /// @dev Function sighash: 0x4b2ae980. - function _castAddrToKey( - address _addr - ) public pure returns (uint256 _key) { - _key = uint256(uint160(address(_addr))) << 12; + function _castAddrToKey(address _addr) + public + pure + returns (uint256 _key) + { + // _key = uint256(uint160(address(_addr))) << 12; + assembly { + _key := shl(12,_addr) + } } - function _castKeyToAddr( - uint256 _key - ) public pure returns (address _addr) { - _addr = address(uint160(uint256(_key >> 12))); + function _castKeyToAddr(uint256 _key) + public + pure + returns (address _addr) + { + // _addr = address(uint160(uint256(_key >> 12))); + assembly { + _addr := shr(12,_key) + } } } diff --git a/deploys/goerli.json b/deploys/goerli.json new file mode 100644 index 0000000..a4073bd --- /dev/null +++ b/deploys/goerli.json @@ -0,0 +1,8 @@ +{ + "signers": [ + "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + ], + "p2pix": "0x2a54667b566B1Aa3779828720E6696AC18ae3f1b", + "token": "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00" +} \ No newline at end of file diff --git a/deploys/localhost.json b/deploys/localhost.json index ad0c84f..9cd9d57 100644 --- a/deploys/localhost.json +++ b/deploys/localhost.json @@ -3,6 +3,6 @@ "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" ], - "p2pix": "0x37c856F4d5bC2597da60f607b1335738468453F3", - "token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee" -} + "p2pix": "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29", + "token": "0xD38D6367f452D097ccBfDe4490b7de570B6A72Db" +} \ No newline at end of file diff --git a/deploys/polygon-mumbai.json b/deploys/polygon-mumbai.json new file mode 100644 index 0000000..733a0da --- /dev/null +++ b/deploys/polygon-mumbai.json @@ -0,0 +1,8 @@ +{ + "signers": [ + "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + ], + "p2pix": "0x7F4680D114B43c4434FB604c7Bc6306125D32f28", + "token": "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29" +} \ No newline at end of file diff --git a/docs/callgraph.svg b/docs/callgraph.svg index c79b893..281b7c0 100644 --- a/docs/callgraph.svg +++ b/docs/callgraph.svg @@ -1,776 +1,957 @@ - - + + - + - -P2PIX + +P2PIX - + - -DT + +SafeTransferLib - + - -Counters.Counter + +DT - + - -SafeTransferLib + +Merkle - + - -Merkle - - - - -Legend + +Legend - -<Constructor> + +<Constructor> - -setReputation + +setReputation - - + + - -setDefaultLockBlocks + +setDefaultLockBlocks - - + + - -setValidSigners + +setValidSigners - - + + - -tokenSettings + +tokenSettings - - + + - -deposit + +deposit - -setRoot + +setRoot - + - - + + - - + + - -_encodeDepositID + +_castToUint - - + + - - + + + + + + + +_castAddrToKey + + + + + + - + - -ERC20 + +ERC20 - - + + + + + + + +EmptyPixTarget + + + + + + - + - -TokenDenied + +TokenDenied - + - - + + + + + + + +MaxBalExceeded + + + + + + - + - -setReentrancyGuard + +setReentrancyGuard - + - - + + + + + + + +address + + + + + + - + - -clearReentrancyGuard + +clearReentrancyGuard - + - - + + - + - -DepositAdded + +DepositAdded - + - - - - - - - -Deposit - - - - - - - - - - - -increment - - - - - - + + - + - -safeTransferFrom + +safeTransferFrom - + - - + + - - + + - -cancelDeposit + +setValidState - - + + - -_onlySeller + + - - + + - - + + - - + + - -DepositClosed + +ValidSet - - + + - - + + + + + + + +NotInitialized + + + + + + - -lock + +lock - -unlockExpired + +unlockExpired - + - - + + - - + + - -_encodeLockID + +_addLock - - + + - - + + + + + + + + + + + + + + - + - -merkleVerify + +merkleVerify - + - - + + - + - -_limiter + +_limiter - + - - + + - - + + - -_castAddrToKey + +getBalance + + + + + + + + + + + +getValid + + + + + + - + - - + + - + - - + + + + + + + + + + + + + + - + - -InvalidDeposit + +InvalidDeposit - + - - + + - + - -NotEnoughTokens + +NotEnoughTokens - + - - + + - - + + - -LockAdded + +NotExpired - - + + - - - - - - - - + + - + - -AmountNotAllowed + +AmountNotAllowed - + - - + + - + - -Lock + +Lock - + - - + + - -release + +release - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - -AlreadyReleased + +AlreadyReleased - + - - + + + + + + + +LockExpired + + + + + + - + - -TxAlreadyUsed + +TxAlreadyUsed - + - - + + - + - -InvalidSigner + +InvalidSigner - + - - + + - + - -LockReleased + +LockReleased - + - - + + - + - -safeTransfer + +safeTransfer - + - - + + - + - - + + - + - - + + - + - - + + - + - -_notExpired + +_notExpired - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + - + - -LockReturned + +LockReturned - + - - + + - -withdraw + +withdraw - - + + - - + + - + - - + + - - + + - - + +_decBal - - + + - - + + + + + + + + + + + + + + + + + + + + - + - -DepositWithdrawn + +DepositWithdrawn - + - - + + - + - - + + - + - - + + + + + + + +RootUpdated + + + + + + - + - -OnlySeller + +OnlySeller - + - - + + - -withdrawBalance + +withdrawBalance + + + + + + - + - -FundsWithdrawn + +FundsWithdrawn - + - - + + - + - -safeTransferETH + +safeTransferETH - + - - + + + + + + + + - + - -ReputationUpdated + +ReputationUpdated - + - - + + - + - -LockBlocksUpdated + +LockBlocksUpdated - + - - + + - + - - + + - + - -ValidSignersUpdated + +ValidSignersUpdated - + - - + + - -<Receive Ether> - - - - - - - - - - - -NotExpired + +<Receive Ether> - + - - + + - - + + - -DepositAlreadyExists + + - - + + - - + + - - + + - -current + +LockAdded - - + + - - - - - - - - + + - + - -AddressDenied + +AddressDenied - + - - + + - + - -verify + +verify - + - - + + + + + + + +getPixTarget + + + + + +getBalances + + + + + + + + + + + + + + + + + + + + + + + +NoTokens + + + + + + + + + + + +LengthMismatch + + + + + + + + + + + +_castKeyToAddr - + - -Internal Call -External Call -Defined Contract -Undefined Contract + +Internal Call +External Call +Defined Contract +Undefined Contract - + - -    -    - -    - + +    +    + +    + - + - - + + - + - - + + \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 40c6b9a..0c2b4b0 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -21,11 +21,21 @@ if (!infuraApiKey) { ); } +const alchemyApiKey: string | undefined = + process.env.ALCHEMY_API_KEY; +if (!alchemyApiKey) { + throw new Error( + "Please set your ALCHEMY_API_KEY in a .env file", + ); +} + const chainIds = { // "{INSERT_NAME}": {INSERT_ID}, hardhat: 31337, mainnet: 1, sepolia: 11155111, + goerli : 5, + "polygon-mumbai": 80001, }; function getChainConfig( @@ -33,9 +43,9 @@ function getChainConfig( ): NetworkUserConfig { let jsonRpcUrl: string; switch (chain) { - // case "{INSERT_NAME}": - // jsonRpcUrl = "{INSERT_URL}"; - // break; + case "polygon-mumbai": + jsonRpcUrl = "https://polygon-mumbai.g.alchemy.com/v2/" + alchemyApiKey; + break; default: jsonRpcUrl = "https://" + chain + ".infura.io/v3/" + infuraApiKey; @@ -47,6 +57,7 @@ function getChainConfig( mnemonic, path: "m/44'/60'/0'/0", }, + // gasPrice: 8000000000, chainId: chainIds[chain], url: jsonRpcUrl, }; @@ -58,6 +69,8 @@ const config: HardhatUserConfig = { apiKey: { mainnet: process.env.ETHERSCAN_API_KEY || "", rinkeby: process.env.ETHERSCAN_API_KEY || "", + goerli: process.env.ETHERSCAN_API_KEY || "", + polygonMumbai: process.env.POLYGONSCAN_API_KEY || "", }, // customChains: [ // { @@ -78,7 +91,7 @@ const config: HardhatUserConfig = { ), showTimeSpent: true, showMethodSig: true, - token: "ONE", + token: "ETH", currency: "USD", // gasPriceApi: process.env.GASPRICE_API_ENDPOINT, coinmarketcap: process.env.COINMARKETCAP_API_KEY, @@ -95,7 +108,9 @@ const config: HardhatUserConfig = { }, // network: getChainConfig("{INSERT_NAME}"), mainnet: getChainConfig("mainnet"), + goerli: getChainConfig("goerli"), sepolia: getChainConfig("sepolia"), + "polygon-mumbai": getChainConfig("polygon-mumbai"), }, paths: { artifacts: "./artifacts", @@ -106,12 +121,14 @@ const config: HardhatUserConfig = { solidity: { version: "0.8.9", settings: { + // viaIR: true, metadata: { bytecodeHash: "none", }, optimizer: { enabled: true, - runs: 800, + // max val = 4_294_967_295 + runs: 20_000, }, }, }, @@ -121,4 +138,4 @@ const config: HardhatUserConfig = { }, }; -export default config; +export default config; \ No newline at end of file diff --git a/package.json b/package.json index 0bf95a8..8c68673 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p2pix-smart-contracts", - "version": "1.0.0", + "version": "2.0.0", "description": "Repository for P2Pix EVM contracts to be imported by the project.", "homepage": "https://github.com/doiim/p2pix-smart-contracts#readme", "author": "Filipe Soccol (doiim)", @@ -16,6 +16,10 @@ "test": "hardhat test", "deploy1:localhost": "hardhat run scripts/1-deploy-mockToken.ts --network localhost", "deploy2:localhost": "hardhat run scripts/2-deploy-p2pix.ts --network localhost", + "deploy1:goerli": "hardhat run scripts/1-deploy-mockToken.ts --network goerli", + "deploy2:goerli": "hardhat run scripts/2-deploy-p2pix.ts --network goerli", + "deploy1:mumbai": "hardhat run scripts/1-deploy-mockToken.ts --network polygon-mumbai", + "deploy2:mumbai": "hardhat run scripts/2-deploy-p2pix.ts --network polygon-mumbai", "coverage": "hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"test/**/*.ts\" && yarn typechain", "lint": "yarn lint:sol && yarn lint:ts && yarn prettier:check", "lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"", diff --git a/scripts/1-deploy-mockToken.ts b/scripts/1-deploy-mockToken.ts index f4db7ea..7ddfb6d 100644 --- a/scripts/1-deploy-mockToken.ts +++ b/scripts/1-deploy-mockToken.ts @@ -6,7 +6,7 @@ import { ethers, network } from "hardhat"; import { Deploys } from "../test/utils/fixtures"; -// import hre from "hardhat"; +import hre from "hardhat"; let deploysJson: Deploys; const supply: BigNumber = ethers.utils.parseEther("20000000"); @@ -34,18 +34,19 @@ const main = async () => { deploysJson.token = erc20.address; console.log("🚀 Mock Token Deployed:", erc20.address); + await erc20.deployTransaction.wait(6); fs.writeFileSync( `./deploys/${network.name}.json`, JSON.stringify(deploysJson, undefined, 2), ); - /* UNCOMMENT WHEN DEPLOYING TO MAINNET */ - //verify - // await hre.run("verify:verify", { - // address: erc20.address, - // constructorArguments: supply, - // }); + /* UNCOMMENT WHEN DEPLOYING TO MAINNET/PUBLIC TESTNETS */ + // verify + await hre.run("verify:verify", { + address: erc20.address, + constructorArguments: [supply], + }); }; main() @@ -53,4 +54,4 @@ main() .catch(error => { console.log(error); process.exit(1); - }); + }); \ No newline at end of file diff --git a/scripts/2-deploy-p2pix.ts b/scripts/2-deploy-p2pix.ts index b5208e6..0a070f9 100644 --- a/scripts/2-deploy-p2pix.ts +++ b/scripts/2-deploy-p2pix.ts @@ -5,6 +5,8 @@ import { ethers, network } from "hardhat"; import { Deploys } from "../test/utils/fixtures"; +import hre from "hardhat"; + let deploysJson: Deploys; const main = async () => { @@ -40,18 +42,30 @@ const main = async () => { deploysJson.p2pix = p2pix.address; console.log("🚀 P2PIX Deployed:", p2pix.address); + await p2pix.deployTransaction.wait(6); fs.writeFileSync( `./deploys/${network.name}.json`, JSON.stringify(deploysJson, undefined, 2), ); - /* UNCOMMENT WHEN DEPLOYING TO MAINNET */ + /* UNCOMMENT WHEN DEPLOYING TO MAINNET/PUBLIC TESTNETS */ //verify - // await hre.run("verify:verify", { - // address: p2pix.address, - // constructorArguments: [2, deploysJson.signers], - // }); + await hre.run("verify:verify", { + address: p2pix.address, + constructorArguments: + [ + 10, + deploysJson.signers, + reputation.address, + [deploysJson.token], + [true], + ], + }); + await hre.run("verify:verify", { + address: reputation.address, + constructorArguments: [], + }); }; main() @@ -59,4 +73,4 @@ main() .catch(error => { console.log(error); process.exit(1); - }); + }); \ No newline at end of file diff --git a/src/types/EventAndErrors.ts b/src/types/EventAndErrors.ts index 666505b..10dc788 100644 --- a/src/types/EventAndErrors.ts +++ b/src/types/EventAndErrors.ts @@ -1,7 +1,13 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -import type { BaseContract, BigNumber, BytesLike, Signer, utils } from "ethers"; +import type { + BaseContract, + BigNumber, + BigNumberish, + Signer, + utils, +} from "ethers"; import type { EventFragment } from "@ethersproject/abi"; import type { Listener, Provider } from "@ethersproject/providers"; import type { @@ -20,10 +26,10 @@ export interface EventAndErrorsInterface extends utils.Interface { "DepositAdded(address,address,uint256)": EventFragment; "DepositWithdrawn(address,address,uint256)": EventFragment; "FundsWithdrawn(address,uint256)": EventFragment; - "LockAdded(address,bytes32,uint256,uint256)": EventFragment; + "LockAdded(address,uint256,uint256,uint256)": EventFragment; "LockBlocksUpdated(uint256)": EventFragment; - "LockReleased(address,bytes32,uint256)": EventFragment; - "LockReturned(address,bytes32)": EventFragment; + "LockReleased(address,uint256,uint256)": EventFragment; + "LockReturned(address,uint256)": EventFragment; "ReputationUpdated(address)": EventFragment; "RootUpdated(address,bytes32)": EventFragment; "ValidSet(address,address,bool)": EventFragment; @@ -94,12 +100,12 @@ export type FundsWithdrawnEventFilter = TypedEventFilter; export interface LockAddedEventObject { buyer: string; - lockID: string; + lockID: BigNumber; seller: BigNumber; amount: BigNumber; } export type LockAddedEvent = TypedEvent< - [string, string, BigNumber, BigNumber], + [string, BigNumber, BigNumber, BigNumber], LockAddedEventObject >; @@ -118,11 +124,11 @@ export type LockBlocksUpdatedEventFilter = export interface LockReleasedEventObject { buyer: string; - lockId: string; + lockId: BigNumber; amount: BigNumber; } export type LockReleasedEvent = TypedEvent< - [string, string, BigNumber], + [string, BigNumber, BigNumber], LockReleasedEventObject >; @@ -130,10 +136,10 @@ export type LockReleasedEventFilter = TypedEventFilter; export interface LockReturnedEventObject { buyer: string; - lockId: string; + lockId: BigNumber; } export type LockReturnedEvent = TypedEvent< - [string, string], + [string, BigNumber], LockReturnedEventObject >; @@ -252,15 +258,15 @@ export interface EventAndErrors extends BaseContract { ): FundsWithdrawnEventFilter; FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter; - "LockAdded(address,bytes32,uint256,uint256)"( + "LockAdded(address,uint256,uint256,uint256)"( buyer?: PromiseOrValue | null, - lockID?: PromiseOrValue | null, + lockID?: PromiseOrValue | null, seller?: null, amount?: null ): LockAddedEventFilter; LockAdded( buyer?: PromiseOrValue | null, - lockID?: PromiseOrValue | null, + lockID?: PromiseOrValue | null, seller?: null, amount?: null ): LockAddedEventFilter; @@ -268,7 +274,7 @@ export interface EventAndErrors extends BaseContract { "LockBlocksUpdated(uint256)"(blocks?: null): LockBlocksUpdatedEventFilter; LockBlocksUpdated(blocks?: null): LockBlocksUpdatedEventFilter; - "LockReleased(address,bytes32,uint256)"( + "LockReleased(address,uint256,uint256)"( buyer?: PromiseOrValue | null, lockId?: null, amount?: null @@ -279,7 +285,7 @@ export interface EventAndErrors extends BaseContract { amount?: null ): LockReleasedEventFilter; - "LockReturned(address,bytes32)"( + "LockReturned(address,uint256)"( buyer?: PromiseOrValue | null, lockId?: null ): LockReturnedEventFilter; diff --git a/src/types/factories/EventAndErrors__factory.ts b/src/types/factories/EventAndErrors__factory.ts index 853c096..a77dec2 100644 --- a/src/types/factories/EventAndErrors__factory.ts +++ b/src/types/factories/EventAndErrors__factory.ts @@ -209,9 +209,9 @@ const _abi = [ }, { indexed: true, - internalType: "bytes32", + internalType: "uint256", name: "lockID", - type: "bytes32", + type: "uint256", }, { indexed: false, @@ -253,9 +253,9 @@ const _abi = [ }, { indexed: false, - internalType: "bytes32", + internalType: "uint256", name: "lockId", - type: "bytes32", + type: "uint256", }, { indexed: false, @@ -278,9 +278,9 @@ const _abi = [ }, { indexed: false, - internalType: "bytes32", + internalType: "uint256", name: "lockId", - type: "bytes32", + type: "uint256", }, ], name: "LockReturned", diff --git a/src/types/factories/Reputation__factory.ts b/src/types/factories/Reputation__factory.ts index cffb401..f4563d1 100644 --- a/src/types/factories/Reputation__factory.ts +++ b/src/types/factories/Reputation__factory.ts @@ -105,7 +105,7 @@ const _abi = [ ]; const _bytecode = - "0x608060405234801561001057600080fd5b50600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a35061036b806100616000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634d2b1791116100505780634d2b17911461009e5780638da5cb5b146100b1578063a4b34557146100dc57600080fd5b806313af40351461006c5780631a861d2614610081575b600080fd5b61007f61007a3660046102a6565b6100e8565b005b61008b620f424081565b6040519081526020015b60405180910390f35b61008b6100ac3660046102d6565b6101a9565b6000546100c4906001600160a01b031681565b6040516001600160a01b039091168152602001610095565b61008b643a3529440081565b6000546001600160a01b031633146101465760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015260640160405180910390fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b60006101cc6101b88380610305565b6101c790643a35294400610324565b6101f4565b6101d983620f4240610305565b6101e3919061033c565b6101ee906001610324565b92915050565b60b58171010000000000000000000000000000000000811061021b5760409190911b9060801c5b690100000000000000000081106102375760209190911b9060401c5b65010000000000811061024f5760109190911b9060201c5b630100000081106102655760089190911b9060101c5b62010000010260121c80820401600190811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900390565b6000602082840312156102b857600080fd5b81356001600160a01b03811681146102cf57600080fd5b9392505050565b6000602082840312156102e857600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561031f5761031f6102ef565b500290565b60008219821115610337576103376102ef565b500190565b60008261035957634e487b7160e01b600052601260045260246000fd5b50049056fea164736f6c6343000809000a"; + "0x608060405234801561001057600080fd5b50600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a350610416806100616000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634d2b1791116100505780634d2b17911461009e5780638da5cb5b146100b1578063a4b34557146100f657600080fd5b806313af40351461006c5780631a861d2614610081575b600080fd5b61007f61007a3660046102f4565b610102565b005b61008b620f424081565b6040519081526020015b60405180910390f35b61008b6100ac366004610331565b6101f7565b6000546100d19073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610095565b61008b643a3529440081565b60005473ffffffffffffffffffffffffffffffffffffffff163314610187576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015260640160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061021a6102068380610379565b61021590643a352944006103b6565b610242565b61022783620f4240610379565b61023191906103ce565b61023c9060016103b6565b92915050565b60b5817101000000000000000000000000000000000081106102695760409190911b9060801c5b690100000000000000000081106102855760209190911b9060401c5b65010000000000811061029d5760109190911b9060201c5b630100000081106102b35760089190911b9060101c5b62010000010260121c80820401600190811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900390565b60006020828403121561030657600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461032a57600080fd5b9392505050565b60006020828403121561034357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156103b1576103b161034a565b500290565b600082198211156103c9576103c961034a565b500190565b600082610404577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50049056fea164736f6c6343000809000a"; type ReputationConstructorParams = | [signer?: Signer] diff --git a/src/types/factories/lib/mock/mockToken.sol/MockToken__factory.ts b/src/types/factories/lib/mock/mockToken.sol/MockToken__factory.ts index 5374c32..1cdd955 100644 --- a/src/types/factories/lib/mock/mockToken.sol/MockToken__factory.ts +++ b/src/types/factories/lib/mock/mockToken.sol/MockToken__factory.ts @@ -346,7 +346,7 @@ const _abi = [ ]; const _bytecode = - "0x60e06040523480156200001157600080fd5b506040516200105238038062001052833981016040819052620000349162000279565b6040805180820182526007815266135bd8dad0949360ca1b6020808301918252835180850190945260048452631350949360e21b908401528151919291601291620000839160009190620001d3565b50815162000099906001906020850190620001d3565b5060ff81166080524660a052620000af620000ca565b60c05250620000c391503390508262000166565b506200039b565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620000fe9190620002d0565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546200017a919062000374565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b828054620001e19062000293565b90600052602060002090601f01602090048101928262000205576000855562000250565b82601f106200022057805160ff191683800117855562000250565b8280016001018555821562000250579182015b828111156200025057825182559160200191906001019062000233565b506200025e92915062000262565b5090565b5b808211156200025e576000815560010162000263565b6000602082840312156200028c57600080fd5b5051919050565b600181811c90821680620002a857607f821691505b60208210811415620002ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c915080831680620002ed57607f831692505b60208084108214156200030e57634e487b7160e01b86526022600452602486fd5b818015620003255760018114620003375762000366565b60ff1986168952848901965062000366565b60008a81526020902060005b868110156200035e5781548b82015290850190830162000343565b505084890196505b509498975050505050505050565b600082198211156200039657634e487b7160e01b600052601160045260246000fd5b500190565b60805160a05160c051610c87620003cb60003960006104630152600061042e015260006101540152610c876000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906108ad565b60405180910390f35b61011561011036600461091e565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610948565b610338565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e61042a565b61012e61019e366004610984565b60036020526000908152604090205481565b61012e6101be366004610984565b60056020526000908152604090205481565b6100ec610485565b6101156101e636600461091e565b610492565b6101fe6101f93660046109a6565b61050a565b005b61012e61020e366004610a19565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610a62565b610762565b6000805461024b90610b2d565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610b2d565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103279086815260200190565b60405180910390a350600192915050565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146103945761036f8382610b7e565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906103bc908490610b7e565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104179087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104605761045b6107a8565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610b2d565b336000908152600360205260408120805483919083906104b3908490610b7e565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103279086815260200190565b4284101561055f5760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b6000600161056b61042a565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610677573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906106ad5750876001600160a01b0316816001600160a01b0316145b6106f95760405162461bcd60e51b815260206004820152600e60248201527f494e56414c49445f5349474e45520000000000000000000000000000000000006044820152606401610556565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b815160005b818110156107a25761079284828151811061078457610784610b95565b602002602001015184610842565b61079b81610bab565b9050610767565b50505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516107da9190610bc6565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546108549190610c62565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b818110156108da578581018301518582016040015282016108be565b818111156108ec576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461091957600080fd5b919050565b6000806040838503121561093157600080fd5b61093a83610902565b946020939093013593505050565b60008060006060848603121561095d57600080fd5b61096684610902565b925061097460208501610902565b9150604084013590509250925092565b60006020828403121561099657600080fd5b61099f82610902565b9392505050565b600080600080600080600060e0888a0312156109c157600080fd5b6109ca88610902565b96506109d860208901610902565b95506040880135945060608801359350608088013560ff811681146109fc57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610a2c57600080fd5b610a3583610902565b9150610a4360208401610902565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610a7557600080fd5b823567ffffffffffffffff80821115610a8d57600080fd5b818501915085601f830112610aa157600080fd5b8135602082821115610ab557610ab5610a4c565b8160051b604051601f19603f83011681018181108682111715610ada57610ada610a4c565b604052928352818301935084810182019289841115610af857600080fd5b948201945b83861015610b1d57610b0e86610902565b85529482019493820193610afd565b9997909101359750505050505050565b600181811c90821680610b4157607f821691505b60208210811415610b6257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610b9057610b90610b68565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610bbf57610bbf610b68565b5060010190565b600080835481600182811c915080831680610be257607f831692505b6020808410821415610c0257634e487b7160e01b86526022600452602486fd5b818015610c165760018114610c2757610c54565b60ff19861689528489019650610c54565b60008a81526020902060005b86811015610c4c5781548b820152908501908301610c33565b505084890196505b509498975050505050505050565b60008219821115610c7557610c75610b68565b50019056fea164736f6c6343000809000a"; + "0x60e06040523480156200001157600080fd5b506040516200129938038062001299833981016040819052620000349162000279565b6040805180820182526007815266135bd8dad0949360ca1b6020808301918252835180850190945260048452631350949360e21b908401528151919291601291620000839160009190620001d3565b50815162000099906001906020850190620001d3565b5060ff81166080524660a052620000af620000ca565b60c05250620000c391503390508262000166565b506200039b565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620000fe9190620002d0565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546200017a919062000374565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b828054620001e19062000293565b90600052602060002090601f01602090048101928262000205576000855562000250565b82601f106200022057805160ff191683800117855562000250565b8280016001018555821562000250579182015b828111156200025057825182559160200191906001019062000233565b506200025e92915062000262565b5090565b5b808211156200025e576000815560010162000263565b6000602082840312156200028c57600080fd5b5051919050565b600181811c90821680620002a857607f821691505b60208210811415620002ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c915080831680620002ed57607f831692505b60208084108214156200030e57634e487b7160e01b86526022600452602486fd5b818015620003255760018114620003375762000366565b60ff1986168952848901965062000366565b60008a81526020902060005b868110156200035e5781548b82015290850190830162000343565b505084890196505b509498975050505050505050565b600082198211156200039657634e487b7160e01b600052601160045260246000fd5b500190565b60805160a05160c051610ece620003cb60003960006104c20152600061048d015260006101540152610ece6000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906109f2565b60405180910390f35b610115610110366004610a8e565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610ab8565b610345565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e610489565b61012e61019e366004610af4565b60036020526000908152604090205481565b61012e6101be366004610af4565b60056020526000908152604090205481565b6100ec6104e4565b6101156101e6366004610a8e565b6104f1565b6101fe6101f9366004610b16565b610576565b005b61012e61020e366004610b89565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610beb565b61089a565b6000805461024b90610cd4565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610cd4565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103349086815260200190565b60405180910390a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103d9576103a78382610d57565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff85166000908152600360205260408120805485929061040e908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104769087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104bf576104ba6108e0565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610cd4565b33600090815260036020526040812080548391908390610512908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103349086815260200190565b428410156105e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b600060016105f1610489565b73ffffffffffffffffffffffffffffffffffffffff8a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000061010083015261010282019290925261012281019190915261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610743573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116158015906107be57508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e455200000000000000000000000000000000000060448201526064016105dc565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b815160005b818110156108da576108ca8482815181106108bc576108bc610d6e565b60200260200101518461097a565b6108d381610d9d565b905061089f565b50505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516109129190610dd6565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b806002600082825461098c9190610ea9565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b81811015610a1f57858101830151858201604001528201610a03565b81811115610a31576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a8957600080fd5b919050565b60008060408385031215610aa157600080fd5b610aaa83610a65565b946020939093013593505050565b600080600060608486031215610acd57600080fd5b610ad684610a65565b9250610ae460208501610a65565b9150604084013590509250925092565b600060208284031215610b0657600080fd5b610b0f82610a65565b9392505050565b600080600080600080600060e0888a031215610b3157600080fd5b610b3a88610a65565b9650610b4860208901610a65565b95506040880135945060608801359350608088013560ff81168114610b6c57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610b9c57600080fd5b610ba583610a65565b9150610bb360208401610a65565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610bfe57600080fd5b823567ffffffffffffffff80821115610c1657600080fd5b818501915085601f830112610c2a57600080fd5b8135602082821115610c3e57610c3e610bbc565b8160051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108682111715610c8157610c81610bbc565b604052928352818301935084810182019289841115610c9f57600080fd5b948201945b83861015610cc457610cb586610a65565b85529482019493820193610ca4565b9997909101359750505050505050565b600181811c90821680610ce857607f821691505b60208210811415610d22577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015610d6957610d69610d28565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610dcf57610dcf610d28565b5060010190565b600080835481600182811c915080831680610df257607f831692505b6020808410821415610e2b577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015610e3f5760018114610e6e57610e9b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650610e9b565b60008a81526020902060005b86811015610e935781548b820152908501908301610e7a565b505084890196505b509498975050505050505050565b60008219821115610ebc57610ebc610d28565b50019056fea164736f6c6343000809000a"; type MockTokenConstructorParams = | [signer?: Signer] diff --git a/src/types/factories/lib/utils/Counters__factory.ts b/src/types/factories/lib/utils/Counters__factory.ts deleted file mode 100644 index 462a466..0000000 --- a/src/types/factories/lib/utils/Counters__factory.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; -import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../../../common"; -import type { Counters, CountersInterface } from "../../../lib/utils/Counters"; - -const _abi = [ - { - inputs: [], - name: "DecOverflow", - type: "error", - }, -]; - -const _bytecode = - "0x602d6037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c6343000809000a"; - -type CountersConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: CountersConstructorParams -): xs is ConstructorParameters => xs.length > 1; - -export class Counters__factory extends ContractFactory { - constructor(...args: CountersConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override deploy( - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise { - return super.deploy(overrides || {}) as Promise; - } - override getDeployTransaction( - overrides?: Overrides & { from?: PromiseOrValue } - ): TransactionRequest { - return super.getDeployTransaction(overrides || {}); - } - override attach(address: string): Counters { - return super.attach(address) as Counters; - } - override connect(signer: Signer): Counters__factory { - return super.connect(signer) as Counters__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): CountersInterface { - return new utils.Interface(_abi) as CountersInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): Counters { - return new Contract(address, _abi, signerOrProvider) as Counters; - } -} diff --git a/src/types/factories/lib/utils/index.ts b/src/types/factories/lib/utils/index.ts index 457edaa..6d82c4c 100644 --- a/src/types/factories/lib/utils/index.ts +++ b/src/types/factories/lib/utils/index.ts @@ -1,5 +1,4 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export { Counters__factory } from "./Counters__factory"; export { ReentrancyGuard__factory } from "./ReentrancyGuard__factory"; diff --git a/src/types/factories/p2pix.sol/P2PIX__factory.ts b/src/types/factories/p2pix.sol/P2PIX__factory.ts index 1a7a162..e3d6536 100644 --- a/src/types/factories/p2pix.sol/P2PIX__factory.ts +++ b/src/types/factories/p2pix.sol/P2PIX__factory.ts @@ -249,9 +249,9 @@ const _abi = [ }, { indexed: true, - internalType: "bytes32", + internalType: "uint256", name: "lockID", - type: "bytes32", + type: "uint256", }, { indexed: false, @@ -293,9 +293,9 @@ const _abi = [ }, { indexed: false, - internalType: "bytes32", + internalType: "uint256", name: "lockId", - type: "bytes32", + type: "uint256", }, { indexed: false, @@ -318,9 +318,9 @@ const _abi = [ }, { indexed: false, - internalType: "bytes32", + internalType: "uint256", name: "lockId", - type: "bytes32", + type: "uint256", }, ], name: "LockReturned", @@ -555,6 +555,30 @@ const _abi = [ stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "address[]", + name: "sellers", + type: "address[]", + }, + { + internalType: "contract ERC20", + name: "token", + type: "address", + }, + ], + name: "getBalances", + outputs: [ + { + internalType: "uint256[]", + name: "balances", + type: "uint256[]", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [ { @@ -641,17 +665,17 @@ const _abi = [ type: "bytes32[]", }, { - internalType: "bytes32[]", + internalType: "uint256[]", name: "expiredLocks", - type: "bytes32[]", + type: "uint256[]", }, ], name: "lock", outputs: [ { - internalType: "bytes32", - name: "lockID", - type: "bytes32", + internalType: "uint256", + name: "", + type: "uint256", }, ], stateMutability: "nonpayable", @@ -673,9 +697,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes32", + internalType: "uint256", name: "", - type: "bytes32", + type: "uint256", }, ], name: "mapLocks", @@ -750,9 +774,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes32", + internalType: "uint256", name: "lockID", - type: "bytes32", + type: "uint256", }, { internalType: "address", @@ -950,9 +974,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes32[]", + internalType: "uint256[]", name: "lockIDs", - type: "bytes32[]", + type: "uint256[]", }, ], name: "unlockExpired", @@ -1025,19 +1049,18 @@ const _abi = [ type: "address", }, { - internalType: "bytes32[]", + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "uint256[]", name: "expiredLocks", - type: "bytes32[]", + type: "uint256[]", }, ], name: "withdraw", - outputs: [ - { - internalType: "uint256", - name: "_sellerBalance", - type: "uint256", - }, - ], + outputs: [], stateMutability: "nonpayable", type: "function", }, @@ -1055,7 +1078,7 @@ const _abi = [ ]; const _bytecode = - "0x60806040526001805560405162002aa438038062002aa48339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b61247480620006306000396000f3fe6080604052600436106101d15760003560e01c80637f94f65d116100f75780639872dbfe11610095578063c52164c611610064578063c52164c6146106cc578063d4fac45d146106ec578063d6e8b9731461074b578063f7d0e04b1461076b57600080fd5b80639872dbfe146105fa57806398a26871146106105780639eee8d4b14610640578063ad8f2eed1461067857600080fd5b806385313e73116100d157806385313e73146105845780638da5cb5b146105a45780638db564c2146105c45780638e2749d6146105da57600080fd5b80637f94f65d146104d757806380e1d302146104f757806384ab1d281461054b57600080fd5b80634b2ae9801161016f5780636a1460241161013e5780636a1460241461044e5780636d82d9e01461046a578063758d77d41461048a57806377cd38a4146104aa57600080fd5b80634b2ae980146103be578063574983c8146103e95780635fd8c7101461040957806369cc6af41461041e57600080fd5b806316d72240116101ab57806316d722401461025f5780632b9f00e91461033e578063328a71811461035e578063461f31201461037e57600080fd5b806304937320146101dd5780630d2a2d441461021d57806313af40351461023f57600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b5061020a6101f8366004611ddb565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561022957600080fd5b5061023d610238366004611ee8565b61078b565b005b34801561024b57600080fd5b5061023d61025a366004611f25565b61087c565b34801561026b57600080fd5b506102df61027a366004611ddb565b600560208190526000918252604090912080546001820154600283015460038401546004850154958501546006860154600787015460088801546009909801549698959794969395946001600160a01b0393841694928416939182169290821691168a565b604080519a8b5260208b019990995297890196909652606088019490945260808701929092526001600160a01b0390811660a087015290811660c086015290811660e08501529081166101008401521661012082015261014001610214565b34801561034a57600080fd5b5061020a610359366004611f8e565b61091d565b34801561036a57600080fd5b5061023d610379366004612074565b610c90565b34801561038a57600080fd5b506103ae610399366004611ddb565b60096020526000908152604090205460ff1681565b6040519015158152602001610214565b3480156103ca57600080fd5b5061020a6103d9366004611f25565b600c1b611000600160ac1b031690565b3480156103f557600080fd5b5061023d610404366004611ddb565b610e4f565b34801561041557600080fd5b5061023d610ecd565b34801561042a57600080fd5b506103ae610439366004611f25565b600a6020526000908152604090205460ff1681565b34801561045a57600080fd5b5061020a670de0b6b3a764000081565b34801561047657600080fd5b5061023d6104853660046120e7565b610f57565b34801561049657600080fd5b5061023d6104a536600461211c565b611045565b3480156104b657600080fd5b5061020a6104c5366004611ddb565b60066020526000908152604090205481565b3480156104e357600080fd5b5061023d6104f2366004612180565b611429565b34801561050357600080fd5b506103ae6105123660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b039094168352929052205460ff1c90565b34801561055757600080fd5b5061056c610566366004611ddb565b600c1c90565b6040516001600160a01b039091168152602001610214565b34801561059057600080fd5b5061020a61059f3660046121e5565b6114bc565b3480156105b057600080fd5b5060005461056c906001600160a01b031681565b3480156105d057600080fd5b5061020a60045481565b3480156105e657600080fd5b5061023d6105f536600461223a565b6115ee565b34801561060657600080fd5b5061020a60035481565b34801561061c57600080fd5b506103ae61062b366004611ddb565b60086020526000908152604090205460ff1681565b34801561064c57600080fd5b5061020a61065b36600461227c565b600b60209081526000928352604080842090915290825290205481565b34801561068457600080fd5b5061056c6106933660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b0390941683529290522054605f1c90565b3480156106d857600080fd5b5060025461056c906001600160a01b031681565b3480156106f857600080fd5b5061020a6107073660046121ac565b600c9190911b611000600160ac1b03166000908152600b602090815260408083206001600160a01b03909416835292905220546b3fffffffffffffffffffffff1690565b34801561075757600080fd5b5061023d6107663660046122a1565b6117de565b34801561077757600080fd5b5061023d610786366004611f25565b6118b6565b6000546001600160a01b031633146107d95760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156108405760006108198484815181106107fe576107fe612363565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600860205260409020805460ff191660019081179091559290920191506107df565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516108719190612379565b60405180910390a150565b6000546001600160a01b031633146108c55760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b600061092761193d565b61093183836115ee565b600c8b901b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038e1684529091529020548a9060ff1c61098557604051635972996f60e11b815260040160405180910390fd5b611000600160ac1b03600c8d901b166000908152600b602090815260408083206001600160a01b03851684529091529020546b3fffffffffffffffffffffff16878110156109e6576040516308aeed0f60e21b815260040160405180910390fd5b600454611000600160ac1b03600c8f901b1690600090610a079060016123dc565b90506004548a8e604051602001610a4393929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b60405160208183030381529060405280519060200120945043600560008781526020019081526020016000206004015410610a915760405163d0404f8560e01b815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c815260200160035443610ac591906123dc565b8152602001605f600b60008781526020019081526020016000206000896001600160a01b03166001600160a01b0316815260200190815260200160002054901c6001600160a01b031681526020018f6001600160a01b031681526020018e6001600160a01b03168152602001336001600160a01b03168152602001866001600160a01b0316815250905089899050600014610ba457600083815260066020526040902054610b77908b908b9033611968565b610b85848c8884898861199a565b60048054906000610b95836123f4565b91905055505050505050610c79565b68056bc75e2d63100000816060015111610bc657610b85848c8884898861199a565b611000600160ac1b0333600c1b1660009081526007602052604081205490610bfe610bf9670de0b6b3a76400008461240f565b611b0e565b9050610c12670de0b6b3a764000082612431565b83606001511180610c30575069d3c21bcecceda10000008360600151115b15610c4e57604051630e0c7c2360e11b815260040160405180910390fd5b610c5c868e8a868b8a61199a565b60048054906000610c6c836123f4565b9190505550505050505050505b610c8260018055565b9a9950505050505050505050565b84611000600160ac1b0333600c1b166001600160a01b038516610cc65760405163351de29f60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604090205460ff16610cff57604051630abc194760e11b815260040160405180910390fd5b6000818152600b602090815260408083206001600160a01b03861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610d556bffffffffffffffffffffffff8a16836123dc565b1115610d745760405163f3fb0eb960e01b815260040160405180910390fd5b610d7c61193d565b8415610d8c57610d8c3386611429565b87878760ff81901b605f83901b610da385876123dc565b6000898152600b602090815260408083206001600160a01b038e16845290915290209117919091179055610de78733306bffffffffffffffffffffffff8f16611bca565b610df060018055565b604080516001600160a01b038e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b6000546001600160a01b03163314610e985760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b85118160405161087191815260200190565b6000546001600160a01b03163314610f165760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b47610f213382611c61565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610871565b611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b03871684529091529020548015611026576000828152600b602090815260408083206001600160a01b038816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a25061103f565b6040516321c4e35760e21b815260040160405180910390fd5b50505050565b61104d61193d565b6000868152600560205260409020600381015461107d576040516331da482760e11b815260040160405180910390fd5b43816004015410156110a2576040516307b7d7dd60e51b815260040160405180910390fd5b6005810154600382015460405160609290921b6bffffffffffffffffffffffff1916602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161113291907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561118057604051637a48537560e11b815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526111f49060019060a0016020604051602081039080840390855afa1580156111d8573d6000803e3d6000fd5b5050604051601f190151600c1b611000600160ac1b0316919050565b60008181526008602052604090205490915060ff1661122657604051632057875960e21b815260040160405180910390fd5b6009840154600385015460028601546001600160a01b039092169160009061124e9083612450565b60006003890181905560048901819055878152600960205260409020805460ff191660011790556008880154909150336001600160a01b03909116146112ff576002870154611000600160ac1b0333600c1b16600090815260076020526040812080549091906112bf9084906123dc565b90915550506008870154600c1b611000600160ac1b0316600090815260076020526040812080548492906112f49084906123dc565b909155506113419050565b81876002015461130f91906123dc565b611000600160ac1b0333600c1b166000908152600760205260408120805490919061133b9084906123dc565b90915550505b600687015461135b9084906001600160a01b031683611cc1565b6002870154156113c75760078701546001600160a01b038d81169116146113b857600787015460028801546113a09185916001600160a01b039091169060011c611cc1565b6113b3838d60018a60020154901c611cc1565b6113c7565b6113c7838d8960020154611cc1565b6006870154604080518f8152602081018590526001600160a01b03909216917f3fd2eee5028b09fa70abe3da4f6023ea41bfde24cfcb9c167f17d6fbe79eece3910160405180910390a25050505050505061142160018055565b505050505050565b6001600160a01b0382163314156114a357611000600160ac1b03600c83901b1660009081526006602090815260409182902083905581516001600160a01b038516815290810183905281517f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632929181900390910190a15050565b6040516342e8fb9360e11b815260040160405180910390fd5b60006114c661193d565b6114d083836115ee565b33600c1b611000600160ac1b03166000908152600b602090815260408083206001600160a01b038816845290915290205460ff1c15156001141561151957611519846000610f57565b50611000600160ac1b0333600c1b166000818152600b602090815260408083206001600160a01b0388168452909152812080546b3fffffffffffffffffffffff8116939284929161156b908490612450565b90915550508161158e57604051635972996f60e11b815260040160405180910390fd5b611599853384611cc1565b604080516001600160a01b03871681526020810184905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a2506115e760018055565b9392505050565b6000815b808210156117c85760006005600086868681811061161257611612612363565b905060200201358152602001908152602001600020905061163281611d4d565b80546000908152600b6020908152604080832060098501546001600160a01b0316845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e40000009061168890836123dc565b11156116a75760405163f3fb0eb960e01b815260040160405180910390fd5b600382015482546000908152600b6020908152604080832060098701546001600160a01b03168452909152812080549091906116e49084906123dc565b90915550506000600383018190556008830154600c1b611000600160ac1b031660008181526007602052604090205490915060011c68056bc75e2d63100000811161174857600082815260076020526040902068056bc75e2d63100000905561175a565b60008281526007602052604090208190555b60068401546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff89898981811061179b5761179b612363565b905060200201356040516117b191815260200190565b60405180910390a2856001019550505050506115f2565b8082101561103f5763dfb035c96000526004601cfd5b6000546001600160a01b031633146118275760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b81518061183c5763df9578836000526004601cfd5b815181146118525763ff633a386000526004601cfd5b60208301602083018260051b82015b808314611421578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611861565b6000546001600160a01b031633146118ff5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064016107d0565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610871565b600154600214156119615760405163558a1e0360e11b815260040160405180910390fd5b6002600155565b61197d8484846001600160a01b038516611d97565b61103f57604051631dc23a5f60e11b815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a0850151908201805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b039384161790915560c0860151600684018054831691841691909117905560e086015160078401805483169184169190911790556101008601516008840180548316918416919091179055610120860151600990930180549091169290911691909117905585611a785763ce3a3d376000526004601cfd5b6000818152600b602090815260408083206001600160a01b038616845290915281208054879290611aaa908490612450565b909155505060c08301518351606085015160405187936001600160a01b0316927f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea92611afe92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b83604051602401611b2c91815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d9150600051905080945082611bc15763e10bf1cc6000526004601cfd5b50505050919050565b60006040516323b872dd60e01b6000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080611c5a5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064016107d0565b5050505050565b600080600080600085875af1905080611cbc5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016107d0565b505050565b600060405163a9059cbb60e01b6000528360045282602452602060006044600080895af13d15601f3d116001600051141617169150600060605280604052508061103f5760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c4544000000000000000000000000000000000060448201526064016107d0565b4381600401541115611d725760405163d0404f8560e01b815260040160405180910390fd5b6003810154611d94576040516331da482760e11b815260040160405180910390fd5b50565b60008315611dd3578360051b8501855b803580851160051b94855260209485185260406000209301818110611dcb57611dd0565b611da7565b50505b501492915050565b600060208284031215611ded57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611e3357611e33611df4565b604052919050565b600067ffffffffffffffff821115611e5557611e55611df4565b5060051b60200190565b6001600160a01b0381168114611d9457600080fd5b600082601f830112611e8557600080fd5b81356020611e9a611e9583611e3b565b611e0a565b82815260059290921b84018101918181019086841115611eb957600080fd5b8286015b84811015611edd578035611ed081611e5f565b8352918301918301611ebd565b509695505050505050565b600060208284031215611efa57600080fd5b813567ffffffffffffffff811115611f1157600080fd5b611f1d84828501611e74565b949350505050565b600060208284031215611f3757600080fd5b81356115e781611e5f565b60008083601f840112611f5457600080fd5b50813567ffffffffffffffff811115611f6c57600080fd5b6020830191508360208260051b8501011115611f8757600080fd5b9250929050565b6000806000806000806000806000806101008b8d031215611fae57600080fd5b8a35611fb981611e5f565b995060208b0135611fc981611e5f565b985060408b0135611fd981611e5f565b975060608b0135611fe981611e5f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561201457600080fd5b6120208e838f01611f42565b909650945060e08d013591508082111561203957600080fd5b506120468d828e01611f42565b915080935050809150509295989b9194979a5092959850565b8035801515811461206f57600080fd5b919050565b600080600080600060a0868803121561208c57600080fd5b853561209781611e5f565b945060208601356bffffffffffffffffffffffff811681146120b857600080fd5b935060408601356120c881611e5f565b92506120d66060870161205f565b949793965091946080013592915050565b600080604083850312156120fa57600080fd5b823561210581611e5f565b91506121136020840161205f565b90509250929050565b60008060008060008060c0878903121561213557600080fd5b86359550602087013561214781611e5f565b945060408701359350606087013592506080870135915060a087013560ff8116811461217257600080fd5b809150509295509295509295565b6000806040838503121561219357600080fd5b823561219e81611e5f565b946020939093013593505050565b600080604083850312156121bf57600080fd5b82356121ca81611e5f565b915060208301356121da81611e5f565b809150509250929050565b6000806000604084860312156121fa57600080fd5b833561220581611e5f565b9250602084013567ffffffffffffffff81111561222157600080fd5b61222d86828701611f42565b9497909650939450505050565b6000806020838503121561224d57600080fd5b823567ffffffffffffffff81111561226457600080fd5b61227085828601611f42565b90969095509350505050565b6000806040838503121561228f57600080fd5b8235915060208301356121da81611e5f565b600080604083850312156122b457600080fd5b823567ffffffffffffffff808211156122cc57600080fd5b6122d886838701611e74565b93506020915081850135818111156122ef57600080fd5b85019050601f8101861361230257600080fd5b8035612310611e9582611e3b565b81815260059190911b8201830190838101908883111561232f57600080fd5b928401925b82841015612354576123458461205f565b82529284019290840190612334565b80955050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156123ba5783516001600160a01b031683529284019291840191600101612395565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156123ef576123ef6123c6565b500190565b6000600019821415612408576124086123c6565b5060010190565b60008261242c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561244b5761244b6123c6565b500290565b600082821015612462576124626123c6565b50039056fea164736f6c6343000809000a"; + "0x6080604052600180556040516200322a3803806200322a8339810160408190526200002a9162000493565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000616565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005b1565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005c7565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b90565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003ce57620003ce6200038d565b604052919050565b60006001600160401b03821115620003f257620003f26200038d565b5060051b60200190565b6001600160a01b03811681146200041257600080fd5b50565b600082601f8301126200042757600080fd5b81516020620004406200043a83620003d6565b620003a3565b82815260059290921b840181019181810190868411156200046057600080fd5b8286015b84811015620004885780516200047a81620003fc565b835291830191830162000464565b509695505050505050565b600080600080600060a08688031215620004ac57600080fd5b8551602080880151919650906001600160401b0380821115620004ce57600080fd5b620004dc8a838b0162000415565b965060408901519150620004f082620003fc565b6060890151919550808211156200050657600080fd5b620005148a838b0162000415565b945060808901519150808211156200052b57600080fd5b508701601f810189136200053e57600080fd5b80516200054f6200043a82620003d6565b81815260059190911b8201830190838101908b8311156200056f57600080fd5b928401925b828410156200059f57835180151581146200058f5760008081fd5b8252928401929084019062000574565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156200060a5783516001600160a01b031683529284019291840191600101620005e3565b50909695505050505050565b612c0480620006266000396000f3fe6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610215610203366004612406565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461248d565b6107be565b34801561025457600080fd5b50610268610263366004612674565b610b6d565b005b34801561027657600080fd5b506102686102853660046126b1565b610ca7565b34801561029657600080fd5b506102686102a53660046126ea565b610d98565b3480156102b657600080fd5b506103376102c5366004612406565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be366004612406565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe3660046126b1565b600c1b90565b34801561041057600080fd5b5061026861041f366004612406565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d36104543660046126b1565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461275d565b611151565b3480156104b157600080fd5b506102686104c0366004612792565b611268565b3480156104d157600080fd5b506102156104e0366004612406565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127f6565b611747565b34801561051e57600080fd5b506103d361052d366004612822565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d366004612406565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c366004612406565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461285b565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b50610573610674366004612822565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b4366004612880565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b506107066107013660046128c2565b611a50565b60405161021f9190612909565b34801561071f57600080fd5b5061021561072e366004612822565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461294d565b611b5b565b34801561078a57600080fd5b506102686107993660046126b1565b611c6b565b3480156107aa57600080fd5b506102686107b9366004612a0f565b611d37565b60006107c8611e33565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a9a565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a9a565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e77565b610a4e848c84848988611ecf565b60048054906000610a5e83612ab2565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611ecf565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aeb565b61202a565b9050610ad4670de0b6b3a764000082612b26565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611ecf565b60048054906000610b4783612ab2565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b63565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b92565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a9a565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e33565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a9a565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120e6565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b33826121b0565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e33565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612be0565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a9a565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a9a565b9091555061162b9050565b8187600201546116039190612a9a565b33600c1b60009081526007602052604081208054909190611625908490612a9a565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff168361222a565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c61222a565b6116c4838d60018a60020154901c61222a565b6116d8565b6116d8838d896002015461222a565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b63565b9050602002013581526020019081526020016000209050611851816122e9565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a9a565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a9a565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b63565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b606073ffffffffffffffffffffffffffffffffffffffff8216611a9f576040517fdf95788300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8251611ad7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82516000905b80821015611b5357611b30858381518110611afa57611afa612b63565b602090810291909101810151600c1b6000908152600b8252604080822088835290925220546b3fffffffffffffffffffffff1690565b838381518110611b4257611b42612b63565b602002602001018181525050611add565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bf15763df9578836000526004601cfd5b81518114611c075763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611c16565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d3f611e33565b611d49828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d7f57611d7f846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611dcd906b3fffffffffffffffffffffff16858784612365565b611dd885338661222a565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e70576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e9984848473ffffffffffffffffffffffffffffffffffffffff85166123c2565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611fbe86868484612365565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea659261201a92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161204891815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120dd5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806121a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af1905080612225576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b4381600401541115612327576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612362576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123785763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152812080548592906123b7908490612be0565b909155505050505050565b600083156123fe578360051b8501855b803580851160051b948552602094851852604060002093018181106123f6576123fb565b6123d2565b50505b501492915050565b60006020828403121561241857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461236257600080fd5b60008083601f84011261245357600080fd5b50813567ffffffffffffffff81111561246b57600080fd5b6020830191508360208260051b850101111561248657600080fd5b9250929050565b6000806000806000806000806000806101008b8d0312156124ad57600080fd5b8a356124b88161241f565b995060208b01356124c88161241f565b985060408b01356124d88161241f565b975060608b01356124e88161241f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561251357600080fd5b61251f8e838f01612441565b909650945060e08d013591508082111561253857600080fd5b506125458d828e01612441565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125d4576125d461255e565b604052919050565b600067ffffffffffffffff8211156125f6576125f661255e565b5060051b60200190565b600082601f83011261261157600080fd5b81356020612626612621836125dc565b61258d565b82815260059290921b8401810191818101908684111561264557600080fd5b8286015b8481101561266957803561265c8161241f565b8352918301918301612649565b509695505050505050565b60006020828403121561268657600080fd5b813567ffffffffffffffff81111561269d57600080fd5b6126a984828501612600565b949350505050565b6000602082840312156126c357600080fd5b81356126ce8161241f565b9392505050565b803580151581146126e557600080fd5b919050565b600080600080600060a0868803121561270257600080fd5b853561270d8161241f565b945060208601356bffffffffffffffffffffffff8116811461272e57600080fd5b9350604086013561273e8161241f565b925061274c606087016126d5565b949793965091946080013592915050565b6000806040838503121561277057600080fd5b823561277b8161241f565b9150612789602084016126d5565b90509250929050565b60008060008060008060c087890312156127ab57600080fd5b8635955060208701356127bd8161241f565b945060408701359350606087013592506080870135915060a087013560ff811681146127e857600080fd5b809150509295509295509295565b6000806040838503121561280957600080fd5b82356128148161241f565b946020939093013593505050565b6000806040838503121561283557600080fd5b82356128408161241f565b915060208301356128508161241f565b809150509250929050565b6000806040838503121561286e57600080fd5b8235915060208301356128508161241f565b6000806020838503121561289357600080fd5b823567ffffffffffffffff8111156128aa57600080fd5b6128b685828601612441565b90969095509350505050565b600080604083850312156128d557600080fd5b823567ffffffffffffffff8111156128ec57600080fd5b6128f885828601612600565b92505060208301356128508161241f565b6020808252825182820181905260009190848201906040850190845b8181101561294157835183529284019291840191600101612925565b50909695505050505050565b6000806040838503121561296057600080fd5b823567ffffffffffffffff8082111561297857600080fd5b61298486838701612600565b935060209150818501358181111561299b57600080fd5b85019050601f810186136129ae57600080fd5b80356129bc612621826125dc565b81815260059190911b820183019083810190888311156129db57600080fd5b928401925b82841015612a00576129f1846126d5565b825292840192908401906129e0565b80955050505050509250929050565b60008060008060608587031215612a2557600080fd5b8435612a308161241f565b935060208501359250604085013567ffffffffffffffff811115612a5357600080fd5b612a5f87828801612441565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612aad57612aad612a6b565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ae457612ae4612a6b565b5060010190565b600082612b21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b5e57612b5e612a6b565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561294157835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612bae565b600082821015612bf257612bf2612a6b565b50039056fea164736f6c6343000809000a"; type P2PIXConstructorParams = | [signer?: Signer] diff --git a/src/types/hardhat.d.ts b/src/types/hardhat.d.ts index 502849e..d3747a0 100644 --- a/src/types/hardhat.d.ts +++ b/src/types/hardhat.d.ts @@ -32,10 +32,6 @@ declare module "hardhat/types/runtime" { name: "ERC20", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; - getContractFactory( - name: "Counters", - signerOrOptions?: ethers.Signer | FactoryOptions - ): Promise; getContractFactory( name: "ReentrancyGuard", signerOrOptions?: ethers.Signer | FactoryOptions @@ -74,11 +70,6 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; - getContractAt( - name: "Counters", - address: string, - signer?: ethers.Signer - ): Promise; getContractAt( name: "ReentrancyGuard", address: string, diff --git a/src/types/index.ts b/src/types/index.ts index 86d64ba..60e8d58 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -17,8 +17,6 @@ export type { MockToken } from "./lib/mock/mockToken.sol/MockToken"; export { MockToken__factory } from "./factories/lib/mock/mockToken.sol/MockToken__factory"; export type { ERC20 } from "./lib/tokens/ERC20"; export { ERC20__factory } from "./factories/lib/tokens/ERC20__factory"; -export type { Counters } from "./lib/utils/Counters"; -export { Counters__factory } from "./factories/lib/utils/Counters__factory"; export type { ReentrancyGuard } from "./lib/utils/ReentrancyGuard"; export { ReentrancyGuard__factory } from "./factories/lib/utils/ReentrancyGuard__factory"; export type { P2PIX } from "./p2pix.sol/P2PIX"; diff --git a/src/types/lib/utils/Counters.ts b/src/types/lib/utils/Counters.ts deleted file mode 100644 index 5179af4..0000000 --- a/src/types/lib/utils/Counters.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseContract, Signer, utils } from "ethers"; - -import type { Listener, Provider } from "@ethersproject/providers"; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, - PromiseOrValue, -} from "../../common"; - -export interface CountersInterface extends utils.Interface { - functions: {}; - - events: {}; -} - -export interface Counters extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: CountersInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: {}; - - callStatic: {}; - - filters: {}; - - estimateGas: {}; - - populateTransaction: {}; -} diff --git a/src/types/lib/utils/index.ts b/src/types/lib/utils/index.ts index 3d0c435..447e059 100644 --- a/src/types/lib/utils/index.ts +++ b/src/types/lib/utils/index.ts @@ -1,5 +1,4 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export type { Counters } from "./Counters"; export type { ReentrancyGuard } from "./ReentrancyGuard"; diff --git a/src/types/p2pix.sol/P2PIX.ts b/src/types/p2pix.sol/P2PIX.ts index d732e4e..27cedde 100644 --- a/src/types/p2pix.sol/P2PIX.ts +++ b/src/types/p2pix.sol/P2PIX.ts @@ -36,13 +36,14 @@ export interface P2PIXInterface extends utils.Interface { "defaultLockBlocks()": FunctionFragment; "deposit(address,uint96,uint160,bool,bytes32)": FunctionFragment; "getBalance(address,address)": FunctionFragment; + "getBalances(address[],address)": FunctionFragment; "getPixTarget(address,address)": FunctionFragment; "getValid(address,address)": FunctionFragment; - "lock(address,address,address,address,uint256,uint256,bytes32[],bytes32[])": FunctionFragment; + "lock(address,address,address,address,uint256,uint256,bytes32[],uint256[])": FunctionFragment; "lockCounter()": FunctionFragment; - "mapLocks(bytes32)": FunctionFragment; + "mapLocks(uint256)": FunctionFragment; "owner()": FunctionFragment; - "release(bytes32,address,bytes32,bytes32,bytes32,uint8)": FunctionFragment; + "release(uint256,address,bytes32,bytes32,bytes32,uint8)": FunctionFragment; "reputation()": FunctionFragment; "sellerAllowList(uint256)": FunctionFragment; "sellerBalance(uint256,address)": FunctionFragment; @@ -53,11 +54,11 @@ export interface P2PIXInterface extends utils.Interface { "setValidSigners(address[])": FunctionFragment; "setValidState(address,bool)": FunctionFragment; "tokenSettings(address[],bool[])": FunctionFragment; - "unlockExpired(bytes32[])": FunctionFragment; + "unlockExpired(uint256[])": FunctionFragment; "usedTransactions(bytes32)": FunctionFragment; "userRecord(uint256)": FunctionFragment; "validBacenSigners(uint256)": FunctionFragment; - "withdraw(address,bytes32[])": FunctionFragment; + "withdraw(address,uint256,uint256[])": FunctionFragment; "withdrawBalance()": FunctionFragment; }; @@ -70,6 +71,7 @@ export interface P2PIXInterface extends utils.Interface { | "defaultLockBlocks" | "deposit" | "getBalance" + | "getBalances" | "getPixTarget" | "getValid" | "lock" @@ -126,6 +128,10 @@ export interface P2PIXInterface extends utils.Interface { functionFragment: "getBalance", values: [PromiseOrValue, PromiseOrValue] ): string; + encodeFunctionData( + functionFragment: "getBalances", + values: [PromiseOrValue[], PromiseOrValue] + ): string; encodeFunctionData( functionFragment: "getPixTarget", values: [PromiseOrValue, PromiseOrValue] @@ -144,7 +150,7 @@ export interface P2PIXInterface extends utils.Interface { PromiseOrValue, PromiseOrValue, PromiseOrValue[], - PromiseOrValue[] + PromiseOrValue[] ] ): string; encodeFunctionData( @@ -153,13 +159,13 @@ export interface P2PIXInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "mapLocks", - values: [PromiseOrValue] + values: [PromiseOrValue] ): string; encodeFunctionData(functionFragment: "owner", values?: undefined): string; encodeFunctionData( functionFragment: "release", values: [ - PromiseOrValue, + PromiseOrValue, PromiseOrValue, PromiseOrValue, PromiseOrValue, @@ -209,7 +215,7 @@ export interface P2PIXInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "unlockExpired", - values: [PromiseOrValue[]] + values: [PromiseOrValue[]] ): string; encodeFunctionData( functionFragment: "usedTransactions", @@ -225,7 +231,11 @@ export interface P2PIXInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "withdraw", - values: [PromiseOrValue, PromiseOrValue[]] + values: [ + PromiseOrValue, + PromiseOrValue, + PromiseOrValue[] + ] ): string; encodeFunctionData( functionFragment: "withdrawBalance", @@ -251,6 +261,10 @@ export interface P2PIXInterface extends utils.Interface { ): Result; decodeFunctionResult(functionFragment: "deposit", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getBalance", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getBalances", + data: BytesLike + ): Result; decodeFunctionResult( functionFragment: "getPixTarget", data: BytesLike @@ -319,10 +333,10 @@ export interface P2PIXInterface extends utils.Interface { "DepositAdded(address,address,uint256)": EventFragment; "DepositWithdrawn(address,address,uint256)": EventFragment; "FundsWithdrawn(address,uint256)": EventFragment; - "LockAdded(address,bytes32,uint256,uint256)": EventFragment; + "LockAdded(address,uint256,uint256,uint256)": EventFragment; "LockBlocksUpdated(uint256)": EventFragment; - "LockReleased(address,bytes32,uint256)": EventFragment; - "LockReturned(address,bytes32)": EventFragment; + "LockReleased(address,uint256,uint256)": EventFragment; + "LockReturned(address,uint256)": EventFragment; "OwnerUpdated(address,address)": EventFragment; "ReputationUpdated(address)": EventFragment; "RootUpdated(address,bytes32)": EventFragment; @@ -395,12 +409,12 @@ export type FundsWithdrawnEventFilter = TypedEventFilter; export interface LockAddedEventObject { buyer: string; - lockID: string; + lockID: BigNumber; seller: BigNumber; amount: BigNumber; } export type LockAddedEvent = TypedEvent< - [string, string, BigNumber, BigNumber], + [string, BigNumber, BigNumber, BigNumber], LockAddedEventObject >; @@ -419,11 +433,11 @@ export type LockBlocksUpdatedEventFilter = export interface LockReleasedEventObject { buyer: string; - lockId: string; + lockId: BigNumber; amount: BigNumber; } export type LockReleasedEvent = TypedEvent< - [string, string, BigNumber], + [string, BigNumber, BigNumber], LockReleasedEventObject >; @@ -431,10 +445,10 @@ export type LockReleasedEventFilter = TypedEventFilter; export interface LockReturnedEventObject { buyer: string; - lockId: string; + lockId: BigNumber; } export type LockReturnedEvent = TypedEvent< - [string, string], + [string, BigNumber], LockReturnedEventObject >; @@ -557,6 +571,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise<[BigNumber] & { bal: BigNumber }>; + getBalances( + sellers: PromiseOrValue[], + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[BigNumber[]] & { balances: BigNumber[] }>; + getPixTarget( seller: PromiseOrValue, token: PromiseOrValue, @@ -577,14 +597,14 @@ export interface P2PIX extends BaseContract { _relayerPremium: PromiseOrValue, _amount: PromiseOrValue, merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; lockCounter(overrides?: CallOverrides): Promise<[BigNumber]>; mapLocks( - arg0: PromiseOrValue, + arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< [ @@ -615,7 +635,7 @@ export interface P2PIX extends BaseContract { owner(overrides?: CallOverrides): Promise<[string]>; release( - lockID: PromiseOrValue, + lockID: PromiseOrValue, _relayerTarget: PromiseOrValue, pixTimestamp: PromiseOrValue, r: PromiseOrValue, @@ -676,7 +696,7 @@ export interface P2PIX extends BaseContract { ): Promise; unlockExpired( - lockIDs: PromiseOrValue[], + lockIDs: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -697,7 +717,8 @@ export interface P2PIX extends BaseContract { withdraw( token: PromiseOrValue, - expiredLocks: PromiseOrValue[], + amount: PromiseOrValue, + expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -740,6 +761,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + getBalances( + sellers: PromiseOrValue[], + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + getPixTarget( seller: PromiseOrValue, token: PromiseOrValue, @@ -760,14 +787,14 @@ export interface P2PIX extends BaseContract { _relayerPremium: PromiseOrValue, _amount: PromiseOrValue, merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; lockCounter(overrides?: CallOverrides): Promise; mapLocks( - arg0: PromiseOrValue, + arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< [ @@ -798,7 +825,7 @@ export interface P2PIX extends BaseContract { owner(overrides?: CallOverrides): Promise; release( - lockID: PromiseOrValue, + lockID: PromiseOrValue, _relayerTarget: PromiseOrValue, pixTimestamp: PromiseOrValue, r: PromiseOrValue, @@ -859,7 +886,7 @@ export interface P2PIX extends BaseContract { ): Promise; unlockExpired( - lockIDs: PromiseOrValue[], + lockIDs: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -880,7 +907,8 @@ export interface P2PIX extends BaseContract { withdraw( token: PromiseOrValue, - expiredLocks: PromiseOrValue[], + amount: PromiseOrValue, + expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -923,6 +951,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + getBalances( + sellers: PromiseOrValue[], + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + getPixTarget( seller: PromiseOrValue, token: PromiseOrValue, @@ -943,14 +977,14 @@ export interface P2PIX extends BaseContract { _relayerPremium: PromiseOrValue, _amount: PromiseOrValue, merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + expiredLocks: PromiseOrValue[], overrides?: CallOverrides - ): Promise; + ): Promise; lockCounter(overrides?: CallOverrides): Promise; mapLocks( - arg0: PromiseOrValue, + arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< [ @@ -981,7 +1015,7 @@ export interface P2PIX extends BaseContract { owner(overrides?: CallOverrides): Promise; release( - lockID: PromiseOrValue, + lockID: PromiseOrValue, _relayerTarget: PromiseOrValue, pixTimestamp: PromiseOrValue, r: PromiseOrValue, @@ -1042,7 +1076,7 @@ export interface P2PIX extends BaseContract { ): Promise; unlockExpired( - lockIDs: PromiseOrValue[], + lockIDs: PromiseOrValue[], overrides?: CallOverrides ): Promise; @@ -1063,9 +1097,10 @@ export interface P2PIX extends BaseContract { withdraw( token: PromiseOrValue, - expiredLocks: PromiseOrValue[], + amount: PromiseOrValue, + expiredLocks: PromiseOrValue[], overrides?: CallOverrides - ): Promise; + ): Promise; withdrawBalance(overrides?: CallOverrides): Promise; }; @@ -1108,15 +1143,15 @@ export interface P2PIX extends BaseContract { ): FundsWithdrawnEventFilter; FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter; - "LockAdded(address,bytes32,uint256,uint256)"( + "LockAdded(address,uint256,uint256,uint256)"( buyer?: PromiseOrValue | null, - lockID?: PromiseOrValue | null, + lockID?: PromiseOrValue | null, seller?: null, amount?: null ): LockAddedEventFilter; LockAdded( buyer?: PromiseOrValue | null, - lockID?: PromiseOrValue | null, + lockID?: PromiseOrValue | null, seller?: null, amount?: null ): LockAddedEventFilter; @@ -1124,7 +1159,7 @@ export interface P2PIX extends BaseContract { "LockBlocksUpdated(uint256)"(blocks?: null): LockBlocksUpdatedEventFilter; LockBlocksUpdated(blocks?: null): LockBlocksUpdatedEventFilter; - "LockReleased(address,bytes32,uint256)"( + "LockReleased(address,uint256,uint256)"( buyer?: PromiseOrValue | null, lockId?: null, amount?: null @@ -1135,7 +1170,7 @@ export interface P2PIX extends BaseContract { amount?: null ): LockReleasedEventFilter; - "LockReturned(address,bytes32)"( + "LockReturned(address,uint256)"( buyer?: PromiseOrValue | null, lockId?: null ): LockReturnedEventFilter; @@ -1216,6 +1251,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + getBalances( + sellers: PromiseOrValue[], + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + getPixTarget( seller: PromiseOrValue, token: PromiseOrValue, @@ -1236,21 +1277,21 @@ export interface P2PIX extends BaseContract { _relayerPremium: PromiseOrValue, _amount: PromiseOrValue, merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; lockCounter(overrides?: CallOverrides): Promise; mapLocks( - arg0: PromiseOrValue, + arg0: PromiseOrValue, overrides?: CallOverrides ): Promise; owner(overrides?: CallOverrides): Promise; release( - lockID: PromiseOrValue, + lockID: PromiseOrValue, _relayerTarget: PromiseOrValue, pixTimestamp: PromiseOrValue, r: PromiseOrValue, @@ -1311,7 +1352,7 @@ export interface P2PIX extends BaseContract { ): Promise; unlockExpired( - lockIDs: PromiseOrValue[], + lockIDs: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1332,7 +1373,8 @@ export interface P2PIX extends BaseContract { withdraw( token: PromiseOrValue, - expiredLocks: PromiseOrValue[], + amount: PromiseOrValue, + expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1376,6 +1418,12 @@ export interface P2PIX extends BaseContract { overrides?: CallOverrides ): Promise; + getBalances( + sellers: PromiseOrValue[], + token: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + getPixTarget( seller: PromiseOrValue, token: PromiseOrValue, @@ -1396,21 +1444,21 @@ export interface P2PIX extends BaseContract { _relayerPremium: PromiseOrValue, _amount: PromiseOrValue, merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; lockCounter(overrides?: CallOverrides): Promise; mapLocks( - arg0: PromiseOrValue, + arg0: PromiseOrValue, overrides?: CallOverrides ): Promise; owner(overrides?: CallOverrides): Promise; release( - lockID: PromiseOrValue, + lockID: PromiseOrValue, _relayerTarget: PromiseOrValue, pixTimestamp: PromiseOrValue, r: PromiseOrValue, @@ -1471,7 +1519,7 @@ export interface P2PIX extends BaseContract { ): Promise; unlockExpired( - lockIDs: PromiseOrValue[], + lockIDs: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1492,7 +1540,8 @@ export interface P2PIX extends BaseContract { withdraw( token: PromiseOrValue, - expiredLocks: PromiseOrValue[], + amount: PromiseOrValue, + expiredLocks: PromiseOrValue[], overrides?: Overrides & { from?: PromiseOrValue } ): Promise; diff --git a/test/p2pix.test.ts b/test/p2pix.test.ts index ab7f92e..0e648f7 100644 --- a/test/p2pix.test.ts +++ b/test/p2pix.test.ts @@ -1,1774 +1,1866 @@ -// import "@nomicfoundation/hardhat-chai-matchers"; -// import { -// loadFixture, -// mine, -// } from "@nomicfoundation/hardhat-network-helpers"; -// import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -// import { expect } from "chai"; -// import { -// BigNumber, -// ContractReceipt, -// ContractTransaction, -// Wallet, -// } from "ethers"; -// import { -// ethers, -// network, -// /* tracer */ -// } from "hardhat"; - -// // import keccak256 from "keccak256"; -// import { MockToken, P2PIX, Reputation } from "../src/types"; -// import { P2PixErrors } from "./utils/errors"; -// import { -// Deposit, -// Lock, -// getSignerAddrs, -// p2pixFixture, -// randomSigners, -// } 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 -// let merkleRoot: string; // MerkleRoot from seller's allowlist -// let proof: string[]; // Owner's proof as whitelisted address - -// 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, merkleRoot, proof } = -// await loadFixture(p2pixFixture)); -// }); - -// describe("Init", async () => { -// it("P2PIX, Reputation and ERC20 should initialize", async () => { -// // tracer.enabled = true; -// await p2pix.deployed(); -// // tracer.enabled = false; -// 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(10); -// 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(10) -// .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 owner to withdraw contract's balance", async () => { -// const oldBal = await p2pix.provider.getBalance( -// p2pix.address, -// ); -// // this call also tests p2pix's receive() fallback mechanism. -// 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"], -// ) -// .and.to.emit(p2pix, "FundsWithdrawn") -// .withArgs(owner.address, price); - -// await expect( -// p2pix.connect(acc01).withdrawBalance(), -// ).to.be.revertedWith(P2PixErrors.UNAUTHORIZED); -// }); -// it("should allow owner to change reputation instance", async () => { -// const tx = await p2pix.setReputation(acc03.address); -// const newRep = await p2pix.callStatic.reputation(); -// const fail = p2pix -// .connect(acc02) -// .setReputation(owner.address); - -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "ReputationUpdated") -// .withArgs(acc03.address); -// expect(newRep).to.eq(acc03.address); -// await expect(fail).to.be.revertedWith( -// P2PixErrors.UNAUTHORIZED, -// ); -// }); -// it("should allow owner to change defaultLockBlocks ", async () => { -// const magicVal = 1337; -// const tx = await p2pix.setDefaultLockBlocks(magicVal); -// const newVal = -// await p2pix.callStatic.defaultLockBlocks(); -// const fail = p2pix -// .connect(acc02) -// .setDefaultLockBlocks(0); - -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "LockBlocksUpdated") -// .withArgs(magicVal); -// expect(newVal).to.eq(magicVal); -// await expect(fail).to.be.revertedWith( -// P2PixErrors.UNAUTHORIZED, -// ); -// }); -// it("should allow owner to add valid Bacen signers", async () => { -// const newSigners = randomSigners(2); -// const bob = await newSigners[0].getAddress(); -// const alice = await newSigners[1].getAddress(); -// const bobCasted = await p2pix._castAddrToKey(bob); -// const aliceCasted = await p2pix._castAddrToKey(alice); -// const tx = await p2pix.setValidSigners([bob, alice]); -// const newSigner1 = -// await p2pix.callStatic.validBacenSigners(bobCasted); -// const newSigner2 = -// await p2pix.callStatic.validBacenSigners(aliceCasted); -// const fail = p2pix -// .connect(acc03) -// .setValidSigners([owner.address, acc02.address]); - -// expect(tx).to.be.ok; -// expect(newSigner1).to.eq(true); -// expect(newSigner2).to.eq(true); -// await expect(tx) -// .to.emit(p2pix, "ValidSignersUpdated") -// .withArgs([bob, alice]); -// await expect(fail).to.be.revertedWith( -// P2PixErrors.UNAUTHORIZED, -// ); -// }); -// it("should allow owner to adjust tokenSettings", async () => { -// const tx = await p2pix.tokenSettings( -// [erc20.address, owner.address], -// [false, true], -// ); -// const newTokenState1 = -// await p2pix.callStatic.allowedERC20s(erc20.address); -// const newTokenState2 = -// await p2pix.callStatic.allowedERC20s(owner.address); -// const fail = p2pix -// .connect(acc01) -// .tokenSettings([acc01.address], [false]); -// const fail2 = p2pix.tokenSettings([], [true, false]); -// const fail3 = p2pix.tokenSettings([zero], [true, true]); - -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "AllowedERC20Updated") -// .withArgs(erc20.address, false) -// .and.to.emit(p2pix, "AllowedERC20Updated") -// .withArgs(owner.address, true); -// expect(newTokenState1).to.eq(false); -// expect(newTokenState2).to.eq(true); -// await expect(fail).to.be.revertedWith( -// P2PixErrors.UNAUTHORIZED, -// ); -// await expect(fail).to.be.revertedWith( -// P2PixErrors.UNAUTHORIZED, -// ); -// await expect(fail2).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.NoTokens, -// ); -// await expect(fail3).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.LengthMismatch, -// ); -// }); -// }); -// describe("Deposit", async () => { -// it("should revert if ERC20 is not allowed", async () => { -// const pTarget = ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("_pixTarget"), -// ); -// const root = ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("root"), -// ); -// const tx = p2pix.deposit( -// owner.address, -// 1, -// pTarget, -// root, -// ); - -// await expect(tx).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.TokenDenied, -// ); -// }); -// it("should create deposit, update storage and emit event", async () => { -// const pTarget = ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("_pixTarget"), -// ); -// // we use `hashZero` to avoid updating seller's allowlist settings -// const root = ethers.constants.HashZero; -// await erc20.approve(p2pix.address, price); -// const tx = await p2pix.deposit( -// erc20.address, -// price, -// pTarget, -// root, -// ); -// const storage: Deposit = await p2pix.mapDeposits(0); -// const ownerKey = await p2pix.callStatic._castAddrToKey( -// owner.address, -// ); -// const allowList = await p2pix.sellerAllowList(ownerKey); - -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "DepositAdded") -// .withArgs(owner.address, 0, erc20.address, price); -// await expect(tx).to.changeTokenBalances( -// erc20, -// [owner.address, p2pix.address], -// ["-100000000000000000000", price], -// ); -// expect(storage.remaining).to.eq(price); -// expect(storage.pixTarget).to.eq(pTarget); -// expect(storage.seller).to.eq(owner.address); -// expect(storage.token).to.eq(erc20.address); -// expect(storage.valid).to.eq(true); -// expect(allowList).to.eq(root); -// }); -// // edge case test -// it("should create multiple deposits", async () => { -// const ownerKey = await p2pix.callStatic._castAddrToKey( -// owner.address, -// ); -// const acc01Key = await p2pix.callStatic._castAddrToKey( -// acc01.address, -// ); -// const acc02Key = await p2pix.callStatic._castAddrToKey( -// acc02.address, -// ); -// const acc03Key = await p2pix.callStatic._castAddrToKey( -// acc03.address, -// ); - -// const pTarget = ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("_pixTarget"), -// ); -// const pTarget2 = ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("_pixTarget2"), -// ); -// const pTarget3 = ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("_pixTarget3"), -// ); -// // we mock the allowlist root here only to test storage update. In depth -// // allowlist test coverage in both "Lock" and "Allowlist Settings" unit tests. -// const root = ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("root"), -// ); -// const nullRoot = ethers.constants.HashZero; -// const price2 = price.mul(ethers.BigNumber.from(2)); -// const price3 = price.mul(ethers.BigNumber.from(3)); -// const price4 = price.mul(ethers.BigNumber.from(4)); -// await erc20.mint( -// getSignerAddrs(4, await ethers.getSigners()), -// price4, -// ); -// await erc20 -// .connect(owner) -// .approve(p2pix.address, price); -// await erc20 -// .connect(acc01) -// .approve(p2pix.address, price2); -// await erc20 -// .connect(acc02) -// .approve(p2pix.address, price3); -// await erc20 -// .connect(acc03) -// .approve(p2pix.address, price4); - -// const tx = await p2pix -// .connect(owner) -// .deposit(erc20.address, price, pTarget, root); -// const tx2 = await p2pix -// .connect(acc01) -// .deposit(erc20.address, price2, pTarget2, nullRoot); -// const tx3 = await p2pix -// .connect(acc02) -// .deposit(erc20.address, price3, pTarget3, root); -// const tx4 = await p2pix -// .connect(acc03) -// .deposit(erc20.address, price4, pTarget, nullRoot); - -// const storage1: Deposit = await p2pix.mapDeposits(0); -// const storage2: Deposit = await p2pix.mapDeposits(1); -// const storage3: Deposit = await p2pix.mapDeposits(2); -// const storage4: Deposit = await p2pix.mapDeposits(3); - -// const allowList1 = await p2pix.sellerAllowList( -// ownerKey, -// ); -// const allowList2 = await p2pix.sellerAllowList( -// acc01Key, -// ); -// const allowList3 = await p2pix.sellerAllowList( -// acc02Key, -// ); -// const allowList4 = await p2pix.sellerAllowList( -// acc03Key, -// ); - -// expect(tx).to.be.ok; -// expect(tx2).to.be.ok; -// expect(tx3).to.be.ok; -// expect(tx4).to.be.ok; - -// await expect(tx) -// .to.emit(p2pix, "DepositAdded") -// .withArgs(owner.address, 0, erc20.address, price); -// await expect(tx).to.changeTokenBalances( -// erc20, -// [owner.address, p2pix.address], -// ["-100000000000000000000", price], -// ); - -// await expect(tx2) -// .to.emit(p2pix, "DepositAdded") -// .withArgs(acc01.address, 1, erc20.address, price2); -// await expect(tx2).to.changeTokenBalances( -// erc20, -// [acc01.address, p2pix.address], -// ["-200000000000000000000", price2], -// ); - -// await expect(tx3) -// .to.emit(p2pix, "DepositAdded") -// .withArgs(acc02.address, 2, erc20.address, price3); -// await expect(tx3).to.changeTokenBalances( -// erc20, -// [acc02.address, p2pix.address], -// ["-300000000000000000000", price3], -// ); - -// await expect(tx4) -// .to.emit(p2pix, "DepositAdded") -// .withArgs(acc03.address, 3, erc20.address, price4); -// await expect(tx4).to.changeTokenBalances( -// erc20, -// [acc03.address, p2pix.address], -// ["-400000000000000000000", price4], -// ); - -// expect(storage1.remaining).to.eq(price); -// expect(storage1.pixTarget).to.eq(pTarget); -// expect(storage1.seller).to.eq(owner.address); -// expect(storage1.token).to.eq(erc20.address); -// expect(storage1.valid).to.eq(true); -// expect(allowList1).to.eq(root); - -// expect(storage2.remaining).to.eq(price2); -// expect(storage2.pixTarget).to.eq(pTarget2); -// expect(storage2.seller).to.eq(acc01.address); -// expect(storage2.token).to.eq(erc20.address); -// expect(storage2.valid).to.eq(true); -// expect(allowList2).to.eq(nullRoot); - -// expect(storage3.remaining).to.eq(price3); -// expect(storage3.pixTarget).to.eq(pTarget3); -// expect(storage3.seller).to.eq(acc02.address); -// expect(storage3.token).to.eq(erc20.address); -// expect(storage3.valid).to.eq(true); -// expect(allowList3).to.eq(root); - -// expect(storage4.remaining).to.eq(price4); -// expect(storage4.pixTarget).to.eq(pTarget); -// expect(storage4.seller).to.eq(acc03.address); -// expect(storage4.token).to.eq(erc20.address); -// expect(storage4.valid).to.eq(true); -// expect(allowList4).to.eq(nullRoot); -// }); -// }); -// describe("Lock", async () => { -// it("should revert if deposit is invalid", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// ethers.constants.HashZero, -// ); -// await p2pix.cancelDeposit(0); -// const fail = p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// price, -// [], -// [], -// ); -// const fail2 = p2pix.lock( -// 2, -// zero, -// zero, -// 0, -// price, -// [], -// [], -// ); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.InvalidDeposit, -// ); -// await expect(fail2).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.InvalidDeposit, -// ); -// }); -// it("should revert if wished amount is greater than deposit's remaining amount", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// ethers.constants.HashZero, -// ); -// const fail = p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// price.mul(ethers.BigNumber.from(2)), -// [], -// [], -// ); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.NotEnoughTokens, -// ); -// }); -// it("should revert if a non expired lock has the same ID encoded", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// ethers.constants.HashZero, -// ); -// await p2pix -// .connect(acc03) -// .lock(0, acc02.address, acc03.address, 0, 1, [], []); -// const fail = p2pix -// .connect(acc03) -// .lock(0, acc02.address, acc03.address, 0, 1, [], []); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.NotExpired, -// ); -// }); -// it("should revert if an invalid allowlist merkleproof is provided", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// const fail = p2pix -// .connect(acc02) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// 1000, -// [ -// ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("wrong"), -// ), -// ], -// [], -// ); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.AddressDenied, -// ); -// }); -// it("should revert if msg.sender does not have enough credit in his spend limit", async () => { -// await erc20.approve( -// p2pix.address, -// price.mul(BigNumber.from("3")), -// ); -// await p2pix.deposit( -// erc20.address, -// price.mul(BigNumber.from("3")), -// "pixTarget", -// merkleRoot, -// ); -// const fail = p2pix -// .connect(acc02) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// price.mul(BigNumber.from("2")), -// [], -// [], -// ); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.AmountNotAllowed, -// ); -// }); -// it("should create a lock, update storage and emit events via the allowlist path", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// const tx = await p2pix -// .connect(acc01) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// price, -// proof, -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, price, acc02.address], -// ); -// const storage: Lock = await p2pix.callStatic.mapLocks( -// lockID, -// ); - -// const rc: ContractReceipt = await tx.wait(); -// const expiration = rc.blockNumber + 10; - -// expect(tx).to.be.ok; -// expect(storage.depositID).to.eq(0); -// expect(storage.relayerPremium).to.eq( -// ethers.constants.Zero, -// ); -// expect(storage.amount).to.eq(price); -// expect(storage.expirationBlock).to.eq(expiration); -// expect(storage.buyerAddress).to.eq(acc02.address); -// expect(storage.relayerTarget).to.eq(acc03.address); -// expect(storage.relayerAddress).to.eq(acc01.address); -// await expect(tx) -// .to.emit(p2pix, "LockAdded") -// .withArgs( -// acc02.address, -// lockID, -// storage.depositID, -// storage.amount, -// ); -// }); -// it("should create a lock, update storage and emit events via the reputation path", async () => { -// const root = ethers.constants.HashZero; -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// root, -// ); -// const tx = await p2pix -// .connect(acc01) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// price, -// [], -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, price, acc02.address], -// ); -// const storage: Lock = await p2pix.callStatic.mapLocks( -// lockID, -// ); - -// const rc: ContractReceipt = await tx.wait(); -// const expiration = rc.blockNumber + 10; - -// expect(tx).to.be.ok; -// expect(storage.depositID).to.eq(0); -// expect(storage.relayerPremium).to.eq( -// ethers.constants.Zero, -// ); -// expect(storage.amount).to.eq(price); -// expect(storage.expirationBlock).to.eq(expiration); -// expect(storage.buyerAddress).to.eq(acc02.address); -// expect(storage.relayerTarget).to.eq(acc03.address); -// expect(storage.relayerAddress).to.eq(acc01.address); -// await expect(tx) -// .to.emit(p2pix, "LockAdded") -// .withArgs( -// acc02.address, -// lockID, -// storage.depositID, -// storage.amount, -// ); -// }); -// // edge case test -// it("should create multiple locks", async () => { -// const newPrice = price.div(ethers.BigNumber.from(2)); -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// const tx1 = await p2pix -// .connect(acc01) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// newPrice, -// proof, -// [], -// ); -// const lockID1 = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, newPrice, acc02.address], -// ); -// const storage1: Lock = await p2pix.callStatic.mapLocks( -// lockID1, -// ); - -// const rc1: ContractReceipt = await tx1.wait(); -// const expiration1 = rc1.blockNumber + 10; - -// const tx2 = await p2pix -// .connect(acc01) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// 100, -// [], -// [], -// ); -// const lockID2 = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc02.address], -// ); -// const storage2: Lock = await p2pix.callStatic.mapLocks( -// lockID2, -// ); - -// const rc2: ContractReceipt = await tx2.wait(); -// const expiration2 = rc2.blockNumber + 10; - -// const tx3 = await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc03.address, -// acc03.address, -// 0, -// 100, -// [], -// [], -// ); -// const lockID3 = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc03.address], -// ); -// const storage3: Lock = await p2pix.callStatic.mapLocks( -// lockID3, -// ); - -// const rc3: ContractReceipt = await tx3.wait(); -// const expiration3 = rc3.blockNumber + 10; - -// expect(tx1).to.be.ok; -// expect(tx2).to.be.ok; -// expect(tx3).to.be.ok; - -// expect(0) -// .to.eq(storage1.depositID) -// .and.to.eq(storage2.depositID) -// .and.to.eq(storage3.depositID); - -// expect(ethers.constants.Zero) -// .to.eq(storage1.relayerPremium) -// .and.to.eq(storage2.relayerPremium) -// .and.to.eq(storage3.relayerPremium); - -// expect(storage1.amount).to.eq(newPrice); -// expect(ethers.BigNumber.from(100)) -// .to.eq(storage2.amount) -// .and.to.eq(storage3.amount); - -// expect(storage1.expirationBlock).to.eq(expiration1); -// expect(storage2.expirationBlock).to.eq(expiration2); -// expect(storage3.expirationBlock).to.eq(expiration3); - -// expect(acc02.address) -// .to.eq(storage1.buyerAddress) -// .and.to.eq(storage2.buyerAddress); -// expect(storage3.buyerAddress).to.eq(acc03.address); - -// expect(acc03.address) -// .to.eq(storage1.relayerTarget) -// .and.to.eq(storage2.relayerTarget) -// .and.to.eq(storage3.relayerTarget); - -// expect(acc01.address) -// .to.eq(storage1.relayerAddress) -// .and.to.eq(storage2.relayerAddress); -// expect(storage3.relayerAddress).to.eq(acc03.address); - -// await expect(tx1) -// .to.emit(p2pix, "LockAdded") -// .withArgs( -// acc02.address, -// lockID1, -// storage1.depositID, -// storage1.amount, -// ); -// await expect(tx2) -// .to.emit(p2pix, "LockAdded") -// .withArgs( -// acc02.address, -// lockID2, -// storage2.depositID, -// storage2.amount, -// ); -// await expect(tx3) -// .to.emit(p2pix, "LockAdded") -// .withArgs( -// acc03.address, -// lockID3, -// storage3.depositID, -// storage3.amount, -// ); -// }); -// }); -// describe("Cancel Deposit", async () => { -// it("should revert if the msg.sender isn't the deposit's seller", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// const fail = p2pix.connect(acc01).cancelDeposit(0); -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.OnlySeller, -// ); -// }); -// it("should cancel deposit, update storage and emit events", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// const state1: Deposit = -// await p2pix.callStatic.mapDeposits(0); -// const tx = await p2pix.cancelDeposit(0); -// const state2: Deposit = -// await p2pix.callStatic.mapDeposits(0); - -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "DepositClosed") -// .withArgs(owner.address, 0); -// expect(state1.valid).to.be.true; -// expect(state2.valid).to.be.false; -// }); -// it("should cancel multiple deposits", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// ethers.constants.HashZero, -// ); -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// ethers.constants.HashZero, -// ); -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// ethers.constants.HashZero, -// ); -// const oldState1: Deposit = -// await p2pix.callStatic.mapDeposits(0); -// const oldState2: Deposit = -// await p2pix.callStatic.mapDeposits(1); -// const oldState3: Deposit = -// await p2pix.callStatic.mapDeposits(2); -// const tx1 = await p2pix.cancelDeposit(0); -// const tx2 = await p2pix.cancelDeposit(1); -// const tx3 = await p2pix.cancelDeposit(2); -// const newState1: Deposit = -// await p2pix.callStatic.mapDeposits(0); -// const newState2: Deposit = -// await p2pix.callStatic.mapDeposits(1); -// const newState3: Deposit = -// await p2pix.callStatic.mapDeposits(2); - -// expect(tx1).to.be.ok; -// expect(tx2).to.be.ok; -// expect(tx3).to.be.ok; -// await expect(tx1) -// .to.emit(p2pix, "DepositClosed") -// .withArgs(owner.address, 0); -// await expect(tx2) -// .to.emit(p2pix, "DepositClosed") -// .withArgs(owner.address, 1); -// await expect(tx3) -// .to.emit(p2pix, "DepositClosed") -// .withArgs(owner.address, 2); -// expect(oldState1.valid).to.be.true; -// expect(oldState2.valid).to.be.true; -// expect(oldState3.valid).to.be.true; -// expect(newState1.valid).to.be.false; -// expect(newState2.valid).to.be.false; -// expect(newState3.valid).to.be.false; -// }); -// }); -// describe("Release", async () => { -// it("should revert if lock has expired", async () => { -// const messageToSign = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// ["pixTarget", 100, ethers.constants.HashZero], -// ); -// const flatSig = await acc01.signMessage( -// ethers.utils.arrayify(messageToSign), -// ); -// const sig = ethers.utils.splitSignature(flatSig); -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 6, -// 100, -// [], -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc02.address], -// ); -// await mine(13); -// const fail = p2pix.release( -// lockID, -// acc03.address, -// ethers.constants.HashZero, -// sig.r, -// sig.s, -// sig.v, -// ); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.LockExpired, -// ); -// }); -// it("should revert if lock has already been released", async () => { -// const messageToSign = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// ["pixTarget", 100, ethers.constants.HashZero], -// ); -// const flatSig = await acc01.signMessage( -// ethers.utils.arrayify(messageToSign), -// ); -// const sig = ethers.utils.splitSignature(flatSig); -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 6, -// 100, -// [], -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc02.address], -// ); -// await p2pix.release( -// lockID, -// acc03.address, -// ethers.constants.HashZero, -// sig.r, -// sig.s, -// sig.v, -// ); -// const fail = p2pix.release( -// lockID, -// acc03.address, -// ethers.constants.HashZero, -// sig.r, -// sig.s, -// sig.v, -// ); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.AlreadyReleased, -// ); -// }); -// it("should revert if signed message has already been used", async () => { -// const messageToSign = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// ["pixTarget", 100, ethers.constants.HashZero], -// ); -// const flatSig = await owner.signMessage( -// ethers.utils.arrayify(messageToSign), -// ); -// const sig = ethers.utils.splitSignature(flatSig); -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// ethers.constants.HashZero, -// ); -// await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 6, -// 100, -// [], -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc02.address], -// ); -// await p2pix -// .connect(acc01) -// .release( -// lockID, -// acc02.address, -// ethers.constants.HashZero, -// sig.r, -// sig.s, -// sig.v, -// ); -// await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 6, -// 100, -// [], -// [], -// ); -// const lockID2 = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc02.address], -// ); -// const fail = p2pix -// .connect(acc01) -// .release( -// lockID2, -// acc02.address, -// ethers.constants.HashZero, -// sig.r, -// sig.s, -// sig.v, -// ); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.TxAlreadyUsed, -// ); -// }); -// it("should revert if ecrecovered signer is invalid", async () => { -// const messageToSign = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// ["pixTarget", 100, ethers.constants.HashZero], -// ); -// const flatSig = await acc03.signMessage( -// ethers.utils.arrayify(messageToSign), -// ); -// const sig = ethers.utils.splitSignature(flatSig); - -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// ethers.constants.HashZero, -// ); -// await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 6, -// 100, -// [], -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc02.address], -// ); -// const fail = p2pix -// .connect(acc01) -// .release( -// lockID, -// acc02.address, -// ethers.constants.HashZero, -// sig.r, -// sig.s, -// sig.v, -// ); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.InvalidSigner, -// ); -// }); -// it("should release lock, update storage and emit events", async () => { -// const endtoendID = ethers.constants.HashZero; -// const pixTarget = "pixTarget"; -// const messageToSign = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// [pixTarget, 100, endtoendID], -// ); -// // Note: messageToSign is a string, that is 66-bytes long, to sign the -// // binary value, we must convert it to the 32 byte Array that -// // the string represents -// // -// // i.e., -// // 66-byte string -// // "0x592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba" -// // ... vs ... -// // 32 entry Uint8Array -// // [ 89, 47, 167, 67, 136, 159, ... 103, 7, 186] -// const messageHashBytes = -// ethers.utils.arrayify(messageToSign); -// const flatSig = await acc01.signMessage( -// messageHashBytes, -// ); -// const sig = ethers.utils.splitSignature(flatSig); -// const root = ethers.constants.HashZero; - -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// pixTarget, -// root, -// ); -// await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 6, -// 100, -// [], -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc02.address], -// ); -// const acc01Key = await p2pix.callStatic._castAddrToKey( -// acc01.address, -// ); -// const acc03Key = await p2pix.callStatic._castAddrToKey( -// acc03.address, -// ); -// const userRecordA = await p2pix.callStatic.userRecord( -// acc01Key, -// ); -// const userRecord1 = await p2pix.callStatic.userRecord( -// acc03Key, -// ); -// const storage1: Lock = await p2pix.callStatic.mapLocks( -// lockID, -// ); -// const tx = await p2pix -// .connect(acc01) -// .release( -// lockID, -// acc02.address, -// endtoendID, -// sig.r, -// sig.s, -// sig.v, -// ); -// const storage2: Lock = await p2pix.callStatic.mapLocks( -// lockID, -// ); -// const userRecordB = await p2pix.callStatic.userRecord( -// acc01Key, -// ); -// const userRecord2 = await p2pix.callStatic.userRecord( -// acc03Key, -// ); -// const used = await p2pix.callStatic.usedTransactions( -// messageHashBytes, -// ); -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "LockReleased") -// .withArgs(acc02.address, lockID); -// expect(storage1.expirationBlock).to.eq( -// ethers.BigNumber.from(16), -// ); -// expect(storage1.amount).to.eq( -// ethers.BigNumber.from(100), -// ); -// expect(storage2.expirationBlock).to.eq( -// ethers.BigNumber.from(0), -// ); -// expect(storage2.amount).to.eq(ethers.BigNumber.from(0)); -// expect(used).to.eq(true); -// expect(userRecordA).to.eq(ethers.constants.Zero); -// expect(userRecord1).to.eq(ethers.constants.Zero); -// expect(userRecordB).to.eq(ethers.BigNumber.from(6)); -// expect(userRecord2).to.eq(ethers.BigNumber.from(100)); -// await expect(tx).to.changeTokenBalances( -// erc20, -// [acc03.address, acc02.address], -// [3, 97], -// // acc02 is acting both as buyer and relayerTarget -// // (i.e., 94 + 3 = 97) -// ); -// }); -// // edge case test -// it("should release multiple locks", async () => { -// const endtoendID = ethers.constants.HashZero; -// const pixTarget = "pixTarget"; -// const root = ethers.constants.HashZero; -// const acc01Key = await p2pix.callStatic._castAddrToKey( -// acc01.address, -// ); -// const acc03Key = await p2pix.callStatic._castAddrToKey( -// acc03.address, -// ); -// const acc01Record1 = await p2pix.callStatic.userRecord( -// acc01Key, -// ); -// const acc03Record1 = await p2pix.callStatic.userRecord( -// acc03Key, -// ); -// const messageToSign1 = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// [pixTarget, 100, endtoendID], -// ); -// const flatSig1 = await owner.signMessage( -// ethers.utils.arrayify(messageToSign1), -// ); -// const sig1 = ethers.utils.splitSignature(flatSig1); -// const messageToSign2 = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// [pixTarget, 50, endtoendID], -// ); -// const flatSig2 = await owner.signMessage( -// ethers.utils.arrayify(messageToSign2), -// ); -// const sig2 = ethers.utils.splitSignature(flatSig2); -// const messageToSign3 = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// [pixTarget, 25, endtoendID], -// ); -// const flatSig3 = await owner.signMessage( -// ethers.utils.arrayify(messageToSign3), -// ); -// const sig3 = ethers.utils.splitSignature(flatSig3); -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// pixTarget, -// root, -// ); -// await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// 100, -// [], -// [], -// ); -// await p2pix -// .connect(acc03) -// .lock(0, acc02.address, acc03.address, 6, 50, [], []); -// await p2pix -// .connect(acc03) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 10, -// 25, -// [], -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 100, acc02.address], -// ); -// const lockID2 = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 50, acc02.address], -// ); -// const lockID3 = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 25, acc02.address], -// ); -// // relayerPremium == 0 -// const tx = await p2pix -// .connect(acc01) -// .release( -// lockID, -// acc02.address, -// endtoendID, -// sig1.r, -// sig1.s, -// sig1.v, -// ); -// // relayerPremium != 0 && -// // lock's msg.sender != release's msg.sender -// const tx1 = await p2pix -// .connect(acc01) -// .release( -// lockID2, -// acc02.address, -// endtoendID, -// sig2.r, -// sig2.s, -// sig2.v, -// ); -// // relayerPremium != 0 && -// // lock's msg.sender == release's msg.sender -// const tx2 = await p2pix -// .connect(acc03) -// .release( -// lockID3, -// acc02.address, -// endtoendID, -// sig3.r, -// sig3.s, -// sig3.v, -// ); -// const used1 = await p2pix.callStatic.usedTransactions( -// ethers.utils.arrayify(messageToSign1), -// ); -// const used2 = await p2pix.callStatic.usedTransactions( -// ethers.utils.arrayify(messageToSign2), -// ); -// const used3 = await p2pix.callStatic.usedTransactions( -// ethers.utils.arrayify(messageToSign3), -// ); -// const acc01Record2 = await p2pix.callStatic.userRecord( -// acc01Key, -// ); -// const acc03Record2 = await p2pix.callStatic.userRecord( -// acc03Key, -// ); - -// expect(tx).to.be.ok; -// expect(tx1).to.be.ok; -// expect(tx2).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "LockReleased") -// .withArgs(acc02.address, lockID); -// await expect(tx1) -// .to.emit(p2pix, "LockReleased") -// .withArgs(acc02.address, lockID2); -// await expect(tx2) -// .to.emit(p2pix, "LockReleased") -// .withArgs(acc02.address, lockID3); -// expect(used1).to.eq(true); -// expect(used2).to.eq(true); -// expect(used3).to.eq(true); -// expect(0).to.eq(acc01Record1).and.to.eq(acc03Record1); -// expect(acc01Record2).to.eq(6); // 0 + 6 -// expect(acc03Record2).to.eq(185); // 100 + 50 + 25 + 10 -// await expect(tx).to.changeTokenBalances( -// erc20, -// [ -// acc01.address, -// acc02.address, -// acc03.address, -// p2pix.address, -// ], -// [0, 100, 0, "-100"], -// ); -// await expect(tx1).to.changeTokenBalances( -// erc20, -// [ -// acc01.address, -// acc02.address, -// acc03.address, -// p2pix.address, -// ], -// [0, 47, 3, "-50"], -// ); -// await expect(tx2).to.changeTokenBalances( -// erc20, -// [ -// acc01.address, -// acc02.address, -// acc03.address, -// p2pix.address, -// ], -// [0, 20, 5, "-25"], -// ); -// }); -// }); -// describe("Unexpire Locks", async () => { -// it("should revert if lock isn't expired", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// await p2pix -// .connect(acc02) -// .lock(0, acc02.address, acc03.address, 0, 1, [], []); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 1, acc02.address], -// ); -// const fail = p2pix.unlockExpired([lockID]); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.NotExpired, -// ); -// }); -// it("should revert if lock has already been released", async () => { -// const endtoendID = ethers.constants.HashZero; -// const pixTarget = "pixTarget"; -// const messageToSign = ethers.utils.solidityKeccak256( -// ["string", "uint256", "bytes32"], -// [pixTarget, 1, endtoendID], -// ); -// const messageHashBytes = -// ethers.utils.arrayify(messageToSign); -// const flatSig = await acc01.signMessage( -// messageHashBytes, -// ); -// const sig = ethers.utils.splitSignature(flatSig); -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// pixTarget, -// merkleRoot, -// ); -// await p2pix -// .connect(acc02) -// .lock(0, acc02.address, acc03.address, 0, 1, [], []); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 1, acc02.address], -// ); -// // await mine(10); -// await p2pix.release( -// lockID, -// acc03.address, -// endtoendID, -// sig.r, -// sig.s, -// sig.v, -// ); -// const fail = p2pix.unlockExpired([lockID]); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.AlreadyReleased, -// ); -// }); -// it("should unlock expired locks, update storage and emit events", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// await p2pix -// .connect(acc02) -// .lock(0, acc02.address, acc03.address, 0, 1, [], []); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, 1, acc02.address], -// ); -// await mine(11); -// const storage: Lock = await p2pix.callStatic.mapLocks( -// lockID, -// ); -// const userKey = await p2pix.callStatic._castAddrToKey( -// acc02.address, -// ); -// const record1 = await p2pix.callStatic.userRecord( -// userKey, -// ); -// const tx = await p2pix.unlockExpired([lockID]); -// const storage2: Lock = await p2pix.callStatic.mapLocks( -// lockID, -// ); -// const record2 = await p2pix.callStatic.userRecord( -// userKey, -// ); - -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "LockReturned") -// .withArgs(acc02.address, lockID); -// expect(storage.amount).to.eq(ethers.constants.One); -// expect(storage2.amount).to.eq(ethers.constants.Zero); -// expect(record1).to.eq(0); -// expect(record2).to.eq(price); -// }); -// it("should unlock expired through lock function", async () => { -// // test method through lock fx -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// const lock1: ContractTransaction = await p2pix -// .connect(acc01) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// price, -// proof, -// [], -// ); -// // as return values of non view functions can't be accessed -// // outside the evm, we fetch the lockID from the emitted event. -// const rc: ContractReceipt = await lock1.wait(); -// const event = rc.events?.find( -// event => event.event === "LockAdded", -// ); -// // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -// const emittedLockID = event?.args!["lockID"]; -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, price, acc02.address], -// ); - -// // mine blocks to expire lock -// await mine(12); -// // const blocknum = await p2pix.provider.getBlockNumber(); -// // console.log("bn = 6 + 12 ( i.e., %s )", blocknum); -// // console.log( -// // "\n", -// // " 2 blocks past the expiration block", -// // ); -// // const struct2: Lock = await p2pix.callStatic.mapLocks( -// // emittedLockID, -// // ); -// // console.log( -// // "\n", -// // "Current state of the lock:", -// // "\n", -// // struct2, -// // ); - -// expect(emittedLockID).to.eq(lockID); - -// // create another lock by freeing the price value -// // back to `l.remamining` and lock 100 again. -// const tx1 = await p2pix.lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// 100, -// [], -// [lockID], -// ); -// const dep: Deposit = await p2pix.callStatic.mapDeposits( -// 0, -// ); - -// expect(tx1).to.be.ok; -// await expect(tx1) -// .to.emit(p2pix, "LockReturned") -// .withArgs(acc02.address, lockID); -// expect(dep.remaining).to.eq( -// price.sub(ethers.BigNumber.from(100)), -// ); -// }); -// it("should unlock expired through withdraw function", async () => { -// // test method through withdraw fx -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// await p2pix -// .connect(acc01) -// .lock( -// 0, -// acc02.address, -// acc03.address, -// 0, -// price, -// proof, -// [], -// ); -// const lockID = ethers.utils.solidityKeccak256( -// ["uint256", "uint256", "address"], -// [0, price, acc02.address], -// ); -// // mine blocks to expire lock -// await mine(11); -// const tx = await p2pix.withdraw(0, [lockID]); -// const dep: Deposit = await p2pix.callStatic.mapDeposits( -// 0, -// ); - -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "LockReturned") -// .withArgs(acc02.address, lockID); -// expect(dep.remaining).to.eq(0); -// }); -// }); -// describe("Seller Withdraw", async () => { -// it("should revert if the msg.sender isn't the deposit's seller", async () => { -// await erc20.approve(p2pix.address, price); -// await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// const fail = p2pix.connect(acc02).withdraw(0, []); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.OnlySeller, -// ); -// }); -// it("should withdraw remaining funds from deposit, update storage and emit event", async () => { -// await erc20.approve(p2pix.address, price); -// const dep = await p2pix.deposit( -// erc20.address, -// price, -// "pixTarget", -// merkleRoot, -// ); -// const tx = await p2pix.withdraw(0, []); - -// expect(tx).to.be.ok; -// await expect(dep) -// .to.changeTokenBalance( -// erc20, -// owner.address, -// "-100000000000000000000", -// ) -// .and.to.changeTokenBalance( -// erc20, -// p2pix.address, -// price, -// ); -// await expect(tx) -// .to.changeTokenBalance(erc20, owner.address, price) -// .and.to.changeTokenBalance( -// erc20, -// p2pix.address, -// "-100000000000000000000", -// ); - -// await expect(tx) -// .to.emit(p2pix, "DepositWithdrawn") -// .withArgs(owner.address, 0, price); -// }); -// }); -// describe("Allowlist Settings", async () => { -// it("should revert if the msg.sender differs from deposit's seller", async () => { -// const root = ethers.utils.keccak256( -// ethers.utils.toUtf8Bytes("root"), -// ); -// const fail = p2pix -// .connect(acc02) -// .setRoot(owner.address, root); - -// await expect(fail).to.be.revertedWithCustomError( -// p2pix, -// P2PixErrors.OnlySeller, -// ); -// }); -// it("should set root of seller's allowlist, update storage and emit event", async () => { -// const ownerKey = await p2pix.callStatic._castAddrToKey( -// owner.address, -// ); -// const oldState = await p2pix.callStatic.sellerAllowList( -// ownerKey, -// ); -// const tx = await p2pix -// .connect(owner) -// .setRoot(owner.address, merkleRoot); -// const newState = await p2pix.callStatic.sellerAllowList( -// ownerKey, -// ); - -// expect(tx).to.be.ok; -// await expect(tx) -// .to.emit(p2pix, "RootUpdated") -// .withArgs(owner.address, merkleRoot); -// expect(oldState).to.eq(ethers.constants.HashZero); -// expect(newState).to.eq(merkleRoot); -// }); -// }); -// }); +import "@nomicfoundation/hardhat-chai-matchers"; +import { + loadFixture, + mine, +} from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { + BigNumber, + ContractReceipt, + ContractTransaction, + Wallet, +} from "ethers"; +import { + ethers, + network, + /* tracer */ +} from "hardhat"; + +// import keccak256 from "keccak256"; +import { MockToken, P2PIX, Reputation } from "../src/types"; +import { P2PixErrors } from "./utils/errors"; +import { + // Deposit, + Lock, + getSignerAddrs, + p2pixFixture, + randomSigners, +} 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 + let merkleRoot: string; // MerkleRoot from seller's allowlist + let proof: string[]; // Owner's proof as whitelisted address + + 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, merkleRoot, proof } = + await loadFixture(p2pixFixture)); + }); + + describe("Init", async () => { + it("P2PIX, Reputation and ERC20 should initialize", async () => { + // tracer.enabled = true; + await p2pix.deployed(); + // tracer.enabled = false; + 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(10); + expect(await p2pix.callStatic.reputation()).to.eq( + reputation.address, + ); + expect(await p2pix.callStatic.lockCounter()).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(10) + .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 owner to withdraw contract's balance", async () => { + const oldBal = await p2pix.provider.getBalance( + p2pix.address, + ); + // this call also tests p2pix's receive() fallback mechanism. + 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"], + ) + .and.to.emit(p2pix, "FundsWithdrawn") + .withArgs(owner.address, price); + + await expect( + p2pix.connect(acc01).withdrawBalance(), + ).to.be.revertedWith(P2PixErrors.UNAUTHORIZED); + }); + it("should allow owner to change reputation instance", async () => { + const tx = await p2pix.setReputation(acc03.address); + const newRep = await p2pix.callStatic.reputation(); + const fail = p2pix + .connect(acc02) + .setReputation(owner.address); + + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "ReputationUpdated") + .withArgs(acc03.address); + expect(newRep).to.eq(acc03.address); + await expect(fail).to.be.revertedWith( + P2PixErrors.UNAUTHORIZED, + ); + }); + it("should allow owner to change defaultLockBlocks ", async () => { + const magicVal = 1337; + const tx = await p2pix.setDefaultLockBlocks(magicVal); + const newVal = + await p2pix.callStatic.defaultLockBlocks(); + const fail = p2pix + .connect(acc02) + .setDefaultLockBlocks(0); + + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "LockBlocksUpdated") + .withArgs(magicVal); + expect(newVal).to.eq(magicVal); + await expect(fail).to.be.revertedWith( + P2PixErrors.UNAUTHORIZED, + ); + }); + it("should allow owner to add valid Bacen signers", async () => { + const newSigners = randomSigners(2); + const bob = await newSigners[0].getAddress(); + const alice = await newSigners[1].getAddress(); + const bobCasted = await p2pix._castAddrToKey(bob); + const aliceCasted = await p2pix._castAddrToKey(alice); + const tx = await p2pix.setValidSigners([bob, alice]); + const newSigner1 = + await p2pix.callStatic.validBacenSigners(bobCasted); + const newSigner2 = + await p2pix.callStatic.validBacenSigners(aliceCasted); + const fail = p2pix + .connect(acc03) + .setValidSigners([owner.address, acc02.address]); + + expect(tx).to.be.ok; + expect(newSigner1).to.eq(true); + expect(newSigner2).to.eq(true); + await expect(tx) + .to.emit(p2pix, "ValidSignersUpdated") + .withArgs([bob, alice]); + await expect(fail).to.be.revertedWith( + P2PixErrors.UNAUTHORIZED, + ); + }); + it("should allow owner to adjust tokenSettings", async () => { + const tx = await p2pix.tokenSettings( + [erc20.address, owner.address], + [false, true], + ); + const newTokenState1 = + await p2pix.callStatic.allowedERC20s(erc20.address); + const newTokenState2 = + await p2pix.callStatic.allowedERC20s(owner.address); + const fail = p2pix + .connect(acc01) + .tokenSettings([acc01.address], [false]); + const fail2 = p2pix.tokenSettings([], [true, false]); + const fail3 = p2pix.tokenSettings([zero], [true, true]); + + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "AllowedERC20Updated") + .withArgs(erc20.address, false) + .and.to.emit(p2pix, "AllowedERC20Updated") + .withArgs(owner.address, true); + expect(newTokenState1).to.eq(false); + expect(newTokenState2).to.eq(true); + await expect(fail).to.be.revertedWith( + P2PixErrors.UNAUTHORIZED, + ); + await expect(fail).to.be.revertedWith( + P2PixErrors.UNAUTHORIZED, + ); + await expect(fail2).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.NoTokens, + ); + await expect(fail3).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.LengthMismatch, + ); + }); + }); + describe("Deposit", async () => { + it("should revert if ERC20 is not allowed", async () => { + const pTarget = ethers.BigNumber.from(7331); + const root = ethers.utils.keccak256( + ethers.utils.toUtf8Bytes("root"), + ); + const tx = p2pix.deposit( + owner.address, + 1, + pTarget, + true, + root, + ); + + await expect(tx).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.TokenDenied, + ); + }); + it("should revert if pixTarget is empty", async () => { + // const pTarget = ethers.BigNumber.from(7331); + const root = ethers.utils.keccak256( + ethers.utils.toUtf8Bytes("root"), + ); + const tx = p2pix.deposit( + erc20.address, + 1, + 0, + true, + root, + ); + + await expect(tx).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.EmptyPixTarget, + ); + }); + it("should revert if amount exceeds the balance limit", async () => { + const pTarget = ethers.BigNumber.from(7331); + const root = ethers.utils.keccak256( + ethers.utils.toUtf8Bytes("root"), + ); + const tx = p2pix.deposit( + erc20.address, + ethers.utils.parseEther("100000001"), + pTarget, + true, + root, + ); + + await expect(tx).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.MaxBalExceeded, + ); + }); + it("should create deposit, update storage and emit event", async () => { + const pTarget = ethers.BigNumber.from(7331); + // we use `hashZero` to avoid updating seller's allowlist settings + const root = ethers.constants.HashZero; + await erc20.approve(p2pix.address, price); + const tx = await p2pix.deposit( + erc20.address, + price, + pTarget, + true, + root, + ); + const storage = await p2pix.callStatic.getBalance(owner.address, erc20.address); + const pixTarget = await p2pix.callStatic.getPixTarget(owner.address,erc20.address); + const valid = await p2pix.callStatic.getValid(owner.address,erc20.address); + const ownerKey = await p2pix.callStatic._castAddrToKey( + owner.address, + ); + const allowList = await p2pix.sellerAllowList(ownerKey); + + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "DepositAdded") + .withArgs(owner.address, erc20.address, price); + await expect(tx).to.changeTokenBalances( + erc20, + [owner.address, p2pix.address], + ["-100000000000000000000", price], + ); + expect(storage).to.eq(price); + expect(pixTarget).to.eq(pTarget); + expect(valid).to.eq(true); + expect(allowList).to.eq(root); + }); + // edge case test + it("should create multiple deposits", async () => { + const ownerKey = await p2pix.callStatic._castAddrToKey( + owner.address, + ); + const acc01Key = await p2pix.callStatic._castAddrToKey( + acc01.address, + ); + const acc02Key = await p2pix.callStatic._castAddrToKey( + acc02.address, + ); + const acc03Key = await p2pix.callStatic._castAddrToKey( + acc03.address, + ); + + const pTarget = ethers.BigNumber.from(7331); + const pTarget2 = ethers.BigNumber.from(1337); + const pTarget3 = ethers.BigNumber.from(3731); + // we mock the allowlist root here only to test storage update. In depth + // allowlist test coverage in both "Lock" and "Allowlist Settings" unit tests. + const root = ethers.utils.keccak256( + ethers.utils.toUtf8Bytes("root"), + ); + const nullRoot = ethers.constants.HashZero; + const price2 = price.mul(ethers.BigNumber.from(2)); + const price3 = price.mul(ethers.BigNumber.from(3)); + const price4 = price.mul(ethers.BigNumber.from(4)); + await erc20.mint( + getSignerAddrs(4, await ethers.getSigners()), + price4, + ); + await erc20 + .connect(owner) + .approve(p2pix.address, price); + await erc20 + .connect(acc01) + .approve(p2pix.address, price2); + await erc20 + .connect(acc02) + .approve(p2pix.address, price3); + await erc20 + .connect(acc03) + .approve(p2pix.address, price4); + + const tx = await p2pix + .connect(owner) + .deposit(erc20.address, price, pTarget, true, root); + const tx2 = await p2pix + .connect(acc01) + .deposit(erc20.address, price2, pTarget2, false, nullRoot); + const tx3 = await p2pix + .connect(acc02) + .deposit(erc20.address, price3, pTarget3, true, root); + const tx4 = await p2pix + .connect(acc03) + .deposit(erc20.address, price4, pTarget, false, nullRoot); + + const storage1 = await p2pix.callStatic.getBalance(owner.address, erc20.address); + const storage2 = await p2pix.callStatic.getBalance(acc01.address, erc20.address); + const storage3 = await p2pix.callStatic.getBalance(acc02.address, erc20.address); + const storage4 = await p2pix.callStatic.getBalance(acc03.address, erc20.address); + + const pixTarget1 = await p2pix.callStatic.getPixTarget(owner.address, erc20.address); + const pixTarget2 = await p2pix.callStatic.getPixTarget(acc01.address, erc20.address); + const pixTarget3 = await p2pix.callStatic.getPixTarget(acc02.address, erc20.address); + const pixTarget4 = await p2pix.callStatic.getPixTarget(acc03.address, erc20.address); + + const valid1 = await p2pix.callStatic.getValid(owner.address, erc20.address); + const valid2 = await p2pix.callStatic.getValid(acc01.address, erc20.address); + const valid3 = await p2pix.callStatic.getValid(acc02.address, erc20.address); + const valid4 = await p2pix.callStatic.getValid(acc03.address, erc20.address); + + const allowList1 = await p2pix.sellerAllowList( + ownerKey, + ); + const allowList2 = await p2pix.sellerAllowList( + acc01Key, + ); + const allowList3 = await p2pix.sellerAllowList( + acc02Key, + ); + const allowList4 = await p2pix.sellerAllowList( + acc03Key, + ); + + expect(tx).to.be.ok; + expect(tx2).to.be.ok; + expect(tx3).to.be.ok; + expect(tx4).to.be.ok; + + await expect(tx) + .to.emit(p2pix, "DepositAdded") + .withArgs(owner.address, erc20.address, price); + await expect(tx).to.changeTokenBalances( + erc20, + [owner.address, p2pix.address], + ["-100000000000000000000", price], + ); + + await expect(tx2) + .to.emit(p2pix, "DepositAdded") + .withArgs(acc01.address, erc20.address, price2); + await expect(tx2).to.changeTokenBalances( + erc20, + [acc01.address, p2pix.address], + ["-200000000000000000000", price2], + ); + + await expect(tx3) + .to.emit(p2pix, "DepositAdded") + .withArgs(acc02.address, erc20.address, price3); + await expect(tx3).to.changeTokenBalances( + erc20, + [acc02.address, p2pix.address], + ["-300000000000000000000", price3], + ); + + await expect(tx4) + .to.emit(p2pix, "DepositAdded") + .withArgs(acc03.address, erc20.address, price4); + await expect(tx4).to.changeTokenBalances( + erc20, + [acc03.address, p2pix.address], + ["-400000000000000000000", price4], + ); + + expect(storage1).to.eq(price); + expect(pixTarget1).to.eq(pTarget); + expect(valid1).to.eq(true); + expect(allowList1).to.eq(root); + + expect(storage2).to.eq(price2); + expect(pixTarget2).to.eq(pTarget2); + expect(valid2).to.eq(false); + expect(allowList2).to.eq(nullRoot); + + expect(storage3).to.eq(price3); + expect(pixTarget3).to.eq(pTarget3); + expect(valid3).to.eq(true); + expect(allowList3).to.eq(root); + + expect(storage4).to.eq(price4); + expect(pixTarget4).to.eq(pTarget); + expect(valid4).to.eq(false); + expect(allowList4).to.eq(nullRoot); + }); + }); + describe("Lock", async () => { + it("should revert if deposit is invalid", async () => { + const pTarget = ethers.BigNumber.from(7331); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + pTarget, + true, + ethers.constants.HashZero, + ); + await p2pix.setValidState(erc20.address,false); + const fail = p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + price, + [], + [], + ); + const fail2 = p2pix.lock( + zero, + zero, + zero, + zero, + 0, + price, + [], + [], + ); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.InvalidDeposit, + ); + await expect(fail2).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.InvalidDeposit, + ); + }); + it("should revert if wished amount is greater than balance's remaining amount", async () => { + await erc20.approve(p2pix.address, price); + const pTarget = ethers.BigNumber.from(1337); + await p2pix.deposit( + erc20.address, + price, + pTarget, + true, + ethers.constants.HashZero, + ); + const fail = p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + price.mul(ethers.BigNumber.from(2)), + [], + [], + ); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.NotEnoughTokens, + ); + }); + // test invalid since lockID has been replaced by a counter. + // it.only("should revert if a non expired lock has the same ID encoded", async () => { + // const pTarget = ethers.BigNumber.from(1337); + // await erc20.approve(p2pix.address, price); + // await p2pix.deposit( + // erc20.address, + // price, + // pTarget, + // true, + // ethers.constants.HashZero, + // ); + // await p2pix + // .connect(acc03) + // .lock( + // owner.address, + // erc20.address, + // acc02.address, + // acc03.address, + // 0, 1, [], []); + + // console.log(await p2pix.callStatic.getValid(owner.address,erc20.address)) + // const fail = p2pix + // .connect(acc03) + // .lock(owner.address, erc20.address, acc02.address, acc03.address, 0, 1, [], []); + + // await expect(fail).to.be.revertedWithCustomError( + // p2pix, + // P2PixErrors.NotExpired, + // ); + // }); + it("should revert if an invalid allowlist merkleproof is provided", async () => { + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + ethers.BigNumber.from("1337"), + true, + merkleRoot, + ); + const fail = p2pix + .connect(acc02) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + 1000, + [ + ethers.utils.keccak256( + ethers.utils.toUtf8Bytes("wrong"), + ), + ], + [], + ); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.AddressDenied, + ); + }); + it("should revert if msg.sender does not have enough credit in his spend limit", async () => { + await erc20.approve( + p2pix.address, + price.mul(BigNumber.from("3")), + ); + await p2pix.deposit( + erc20.address, + price.mul(BigNumber.from("3")), + ethers.BigNumber.from("1"), + true, + merkleRoot, + ); + const fail = p2pix + .connect(acc02) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + price.mul(BigNumber.from("2")), + [], + [], + ); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.AmountNotAllowed, + ); + }); + it("should create a lock, update storage and emit events via the allowlist path", async () => { + const target = ethers.BigNumber.from(101); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + const tx = await p2pix + .connect(acc01) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + price, + proof, + [], + ); + // const storage: Lock = await p2pix.callStatic.mapLocks(1); + + // const rc: ContractReceipt = await tx.wait(); + // const expiration = rc.blockNumber + 10; + // const key = await p2pix.callStatic._castAddrToKey(owner.address); + + // await expect(tx) + // .to.emit(p2pix, "LockAdded") + // .withArgs( + // acc02.address, + // ethers.constants.One, + // key, + // price, + // ); + // expect(tx).to.be.ok; + // expect(storage.sellerKey).to.eq(key); + // expect(storage.counter).to.eq(1); + // expect(storage.relayerPremium).to.eq( + // ethers.constants.Zero, + // ); + // expect(storage.amount).to.eq(price); + // expect(storage.expirationBlock).to.eq(expiration); + // expect(storage.pixTarget).to.eq(target); + // expect(storage.buyerAddress).to.eq(acc02.address); + // expect(storage.relayerTarget).to.eq(acc03.address); + // expect(storage.relayerAddress).to.eq(acc01.address); + // expect(storage.token).to.eq(erc20.address); + }); + it("should create a lock, update storage and emit events via the reputation path", async () => { + const root = ethers.constants.HashZero; + const target = ethers.BigNumber.from(101); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + root, + ); + const tx = await p2pix + .connect(acc01) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + price, + [], + [], + ); + const storage: Lock = await p2pix.callStatic.mapLocks(1); + + const rc: ContractReceipt = await tx.wait(); + const expiration = rc.blockNumber + 10; + const key = await p2pix.callStatic._castAddrToKey(owner.address); + + expect(tx).to.be.ok; + expect(storage.sellerKey).to.eq(key); + expect(storage.counter).to.eq(1); + expect(storage.relayerPremium).to.eq( + ethers.constants.Zero, + ); + expect(storage.amount).to.eq(price); + expect(storage.expirationBlock).to.eq(expiration); + expect(storage.pixTarget).to.eq(target); + expect(storage.buyerAddress).to.eq(acc02.address); + expect(storage.relayerTarget).to.eq(acc03.address); + expect(storage.relayerAddress).to.eq(acc01.address); + expect(storage.token).to.eq(erc20.address); + + await expect(tx) + .to.emit(p2pix, "LockAdded") + .withArgs( + acc02.address, + 1, + key, + storage.amount, + ); + }); + // edge case test + it("should create multiple locks", async () => { + const newPrice = price.div(ethers.BigNumber.from(2)); + const target = ethers.BigNumber.from(101); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + const tx1 = await p2pix + .connect(acc01) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + newPrice, + proof, + [], + ); + const storage1: Lock = await p2pix.callStatic.mapLocks( + 1, + ); + + const rc1: ContractReceipt = await tx1.wait(); + const expiration1 = rc1.blockNumber + 10; + + const tx2 = await p2pix + .connect(acc01) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + 100, + [], + [], + ); + const storage2: Lock = await p2pix.callStatic.mapLocks(2); + + const rc2: ContractReceipt = await tx2.wait(); + const expiration2 = rc2.blockNumber + 10; + + const tx3 = await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc03.address, + acc03.address, + 0, + 100, + [], + [], + ); + const storage3: Lock = await p2pix.callStatic.mapLocks(3); + + const rc3: ContractReceipt = await tx3.wait(); + const expiration3 = rc3.blockNumber + 10; + + const key = await p2pix.callStatic._castAddrToKey(owner.address); + + expect(tx1).to.be.ok; + expect(tx2).to.be.ok; + expect(tx3).to.be.ok; + + expect(key) + .to.eq(storage1.sellerKey) + .and.to.eq(storage2.sellerKey) + .and.to.eq(storage3.sellerKey); + + expect(storage1.counter).to.eq(1); + expect(storage2.counter).to.eq(2); + expect(storage3.counter).to.eq(3); + + expect(ethers.constants.Zero) + .to.eq(storage1.relayerPremium) + .and.to.eq(storage2.relayerPremium) + .and.to.eq(storage3.relayerPremium); + + expect(storage1.amount).to.eq(newPrice); + expect(ethers.BigNumber.from(100)) + .to.eq(storage2.amount) + .and.to.eq(storage3.amount); + + expect(storage1.expirationBlock).to.eq(expiration1); + expect(storage2.expirationBlock).to.eq(expiration2); + expect(storage3.expirationBlock).to.eq(expiration3); + + expect(target) + .to.eq(storage1.pixTarget) + .and.to.eq(storage2.pixTarget) + .and.to.eq(storage3.pixTarget); + + expect(acc02.address) + .to.eq(storage1.buyerAddress) + .and.to.eq(storage2.buyerAddress); + expect(storage3.buyerAddress).to.eq(acc03.address); + + expect(acc03.address) + .to.eq(storage1.relayerTarget) + .and.to.eq(storage2.relayerTarget) + .and.to.eq(storage3.relayerTarget); + + expect(acc01.address) + .to.eq(storage1.relayerAddress) + .and.to.eq(storage2.relayerAddress); + expect(storage3.relayerAddress).to.eq(acc03.address); + + expect(erc20.address) + .to.eq(storage1.token) + .and.to.eq(storage2.token) + .and.to.eq(storage3.token); + + await expect(tx1) + .to.emit(p2pix, "LockAdded") + .withArgs( + acc02.address, + 1, + key, + storage1.amount, + ); + await expect(tx2) + .to.emit(p2pix, "LockAdded") + .withArgs( + acc02.address, + 2, + key, + storage2.amount, + ); + await expect(tx3) + .to.emit(p2pix, "LockAdded") + .withArgs( + acc03.address, + 3, + key, + storage3.amount, + ); + }); + }); + describe("Set sellerBalance Valid State", async () => { + it("should revert if sellerBalance hasn't been initialized", async () => { + // await erc20.approve(p2pix.address, price); + // await p2pix.deposit( + // erc20.address, + // price, + // "pixTarget", + // merkleRoot, + // ); + const fail = p2pix.setValidState(erc20.address,false); + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.NotInitialized, + ); + }); + it("should setValidState, update storage and emit events", async () => { + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + ethers.BigNumber.from(10101), + true, + merkleRoot, + ); + const state1 = + await p2pix.callStatic.getValid(owner.address,erc20.address); + const tx = await p2pix.setValidState(erc20.address,false); + const state2 = + await p2pix.callStatic.getValid(owner.address,erc20.address); + + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "ValidSet") + .withArgs(owner.address, erc20.address, false); + expect(state1).to.be.true; + expect(state2).to.be.false; + }); + it("should cancel multiple balances", async () => { + const hashZero = ethers.constants.HashZero; + await erc20.mint([acc01.address,acc02.address],price); + const target = ethers.BigNumber.from("1"); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + hashZero, + ); + await erc20.connect(acc01).approve(p2pix.address, price); + await p2pix.connect(acc01).deposit( + erc20.address, + price, + target, + false, + hashZero, + ); + await erc20.connect(acc02).approve(p2pix.address, price); + await p2pix.connect(acc02).deposit( + erc20.address, + price, + target, + true, + hashZero, + ); + const oldState1 = + await p2pix.callStatic.getValid(owner.address,erc20.address); + const oldState2 = + await p2pix.callStatic.getValid(acc01.address,erc20.address); + const oldState3 = + await p2pix.callStatic.getValid(acc02.address,erc20.address); + const tx1 = await p2pix.setValidState(erc20.address,false); + const tx2 = await p2pix.connect(acc01).setValidState(erc20.address,true); + const tx3 = await p2pix.connect(acc02).setValidState(erc20.address,true); + const newState1 = + await p2pix.callStatic.getValid(owner.address,erc20.address); + const newState2 = + await p2pix.callStatic.getValid(acc01.address,erc20.address); + const newState3 = + await p2pix.callStatic.getValid(acc02.address,erc20.address); + + expect(tx1).to.be.ok; + expect(tx2).to.be.ok; + expect(tx3).to.be.ok; + await expect(tx1) + .to.emit(p2pix, "ValidSet") + .withArgs(owner.address, erc20.address,false); + await expect(tx2) + .to.emit(p2pix, "ValidSet") + .withArgs(acc01.address, erc20.address,true); + await expect(tx3) + .to.emit(p2pix, "ValidSet") + .withArgs(acc02.address, erc20.address,true); + expect(oldState1).to.be.true; + expect(oldState2).to.be.false; + expect(oldState3).to.be.true; + expect(newState1).to.be.false; + expect(newState2).to.be.true; + expect(newState3).to.be.true; + }); + }); + describe("Release", async () => { + it("should revert if lock has expired", async () => { + const target = ethers.BigNumber.from(101); + const messageToSign = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [target, 100, ethers.constants.HashZero], + ); + const flatSig = await acc01.signMessage( + ethers.utils.arrayify(messageToSign), + ); + const sig = ethers.utils.splitSignature(flatSig); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 6, + 100, + [], + [], + ); + const lockID = ethers.constants.One; + await mine(13); + const fail = p2pix.release( + lockID, + acc03.address, + ethers.constants.HashZero, + sig.r, + sig.s, + sig.v, + ); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.LockExpired, + ); + }); + it("should revert if lock has already been released", async () => { + const target = ethers.BigNumber.from("1"); + const hashZero = ethers.constants.HashZero; + const messageToSign = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [target, 100, hashZero], + ); + const flatSig = await acc01.signMessage( + ethers.utils.arrayify(messageToSign), + ); + const sig = ethers.utils.splitSignature(flatSig); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 6, + 100, + [], + [], + ); + const lockID = ethers.constants.One; + await p2pix.release( + lockID, + acc03.address, + ethers.constants.HashZero, + sig.r, + sig.s, + sig.v, + ); + const fail = p2pix.release( + lockID, + acc03.address, + ethers.constants.HashZero, + sig.r, + sig.s, + sig.v, + ); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.AlreadyReleased, + ); + }); + it("should revert if signed message has already been used", async () => { + const target = ethers.BigNumber.from(101); + const messageToSign = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [target, 100, ethers.constants.HashZero], + ); + const flatSig = await owner.signMessage( + ethers.utils.arrayify(messageToSign), + ); + const sig = ethers.utils.splitSignature(flatSig); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + ethers.constants.HashZero, + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 6, + 100, + [], + [], + ); + + await p2pix + .connect(acc01) + .release( + 1, + acc02.address, + ethers.constants.HashZero, + sig.r, + sig.s, + sig.v, + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 6, + 100, + [], + [], + ); + const fail = p2pix + .connect(acc01) + .release( + 2, + acc02.address, + ethers.constants.HashZero, + sig.r, + sig.s, + sig.v, + ); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.TxAlreadyUsed, + ); + }); + it("should revert if ecrecovered signer is invalid", async () => { + const target = ethers.BigNumber.from(101); + const messageToSign = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [target, 100, ethers.constants.HashZero], + ); + const flatSig = await acc03.signMessage( + ethers.utils.arrayify(messageToSign), + ); + const sig = ethers.utils.splitSignature(flatSig); + + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + ethers.constants.HashZero, + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 6, + 100, + [], + [], + ); + const fail = p2pix + .connect(acc01) + .release( + 1, + acc02.address, + ethers.constants.HashZero, + sig.r, + sig.s, + sig.v, + ); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.InvalidSigner, + ); + }); + it("should release lock, update storage and emit events", async () => { + const zero = ethers.constants.Zero; + const endtoendID = ethers.constants.HashZero; + const pixTarget = ethers.BigNumber.from(101); + const messageToSign = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [pixTarget, 100, endtoendID], + ); + // Note: messageToSign is a string, that is 66-bytes long, to sign the + // binary value, we must convert it to the 32 byte Array that + // the string represents + // + // i.e., + // 66-byte string + // "0x592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba" + // ... vs ... + // 32 entry Uint8Array + // [ 89, 47, 167, 67, 136, 159, ... 103, 7, 186] + const messageHashBytes = + ethers.utils.arrayify(messageToSign); + const flatSig = await acc01.signMessage( + messageHashBytes, + ); + const sig = ethers.utils.splitSignature(flatSig); + const root = ethers.constants.HashZero; + + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + pixTarget, + true, + root, + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 6, + 100, + [], + [], + ); + const acc01Key = await p2pix.callStatic._castAddrToKey( + acc01.address, + ); + const acc03Key = await p2pix.callStatic._castAddrToKey( + acc03.address, + ); + const userRecordA = await p2pix.callStatic.userRecord( + acc01Key, + ); + const userRecord1 = await p2pix.callStatic.userRecord( + acc03Key, + ); + const storage1: Lock = await p2pix.callStatic.mapLocks(1); + const tx = await p2pix + .connect(acc01) + .release( + 1, + acc02.address, + endtoendID, + sig.r, + sig.s, + sig.v, + ); + const storage2: Lock = await p2pix.callStatic.mapLocks(1); + const userRecordB = await p2pix.callStatic.userRecord( + acc01Key, + ); + const userRecord2 = await p2pix.callStatic.userRecord( + acc03Key, + ); + const used = await p2pix.callStatic.usedTransactions( + messageHashBytes, + ); + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "LockReleased") + .withArgs(acc02.address, ethers.constants.One, storage1.amount); + expect(storage1.expirationBlock).to.eq( + ethers.BigNumber.from(16), + ); + expect(storage1.amount).to.eq( + ethers.BigNumber.from(100), + ); + expect(storage2.expirationBlock).to.eq(zero); + expect(storage2.amount).to.eq(zero); + expect(used).to.eq(true); + expect(userRecordA).to.eq(zero); + expect(userRecord1).to.eq(zero); + expect(userRecordB).to.eq(ethers.BigNumber.from(6)); + expect(userRecord2).to.eq(ethers.BigNumber.from(100)); + await expect(tx).to.changeTokenBalances( + erc20, + [acc03.address, acc02.address], + [3, 97], + // acc02 is acting both as buyer and relayerTarget + // (i.e., 94 + 3 = 97) + ); + }); + // edge case test + it("should release multiple locks", async () => { + const endtoendID = ethers.constants.HashZero; + const pixTarget = ethers.BigNumber.from(101); + const root = ethers.constants.HashZero; + const acc01Key = await p2pix.callStatic._castAddrToKey( + acc01.address, + ); + const acc03Key = await p2pix.callStatic._castAddrToKey( + acc03.address, + ); + const acc01Record1 = await p2pix.callStatic.userRecord( + acc01Key, + ); + const acc03Record1 = await p2pix.callStatic.userRecord( + acc03Key, + ); + const messageToSign1 = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [pixTarget, 100, endtoendID], + ); + const flatSig1 = await owner.signMessage( + ethers.utils.arrayify(messageToSign1), + ); + const sig1 = ethers.utils.splitSignature(flatSig1); + const messageToSign2 = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [pixTarget, 50, endtoendID], + ); + const flatSig2 = await owner.signMessage( + ethers.utils.arrayify(messageToSign2), + ); + const sig2 = ethers.utils.splitSignature(flatSig2); + const messageToSign3 = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [pixTarget, 25, endtoendID], + ); + const flatSig3 = await owner.signMessage( + ethers.utils.arrayify(messageToSign3), + ); + const sig3 = ethers.utils.splitSignature(flatSig3); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + pixTarget, + true, + root, + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + 100, + [], + [], + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 6, + 50, + [], + [] + ); + await p2pix + .connect(acc03) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 10, + 25, + [], + [], + ); + const lockID = ethers.constants.One; + const lockID2 = ethers.constants.Two; + const lockID3 = ethers.BigNumber.from(3); + const storage1: Lock = await p2pix.callStatic.mapLocks(lockID); + const storage2: Lock = await p2pix.callStatic.mapLocks(lockID2); + const storage3: Lock = await p2pix.callStatic.mapLocks(lockID3); + // relayerPremium == 0 + const tx = await p2pix + .connect(acc01) + .release( + lockID, + acc02.address, + endtoendID, + sig1.r, + sig1.s, + sig1.v, + ); + // relayerPremium != 0 && + // lock's msg.sender != release's msg.sender + const tx1 = await p2pix + .connect(acc01) + .release( + lockID2, + acc02.address, + endtoendID, + sig2.r, + sig2.s, + sig2.v, + ); + // relayerPremium != 0 && + // lock's msg.sender == release's msg.sender + const tx2 = await p2pix + .connect(acc03) + .release( + lockID3, + acc02.address, + endtoendID, + sig3.r, + sig3.s, + sig3.v, + ); + const used1 = await p2pix.callStatic.usedTransactions( + ethers.utils.arrayify(messageToSign1), + ); + const used2 = await p2pix.callStatic.usedTransactions( + ethers.utils.arrayify(messageToSign2), + ); + const used3 = await p2pix.callStatic.usedTransactions( + ethers.utils.arrayify(messageToSign3), + ); + const acc01Record2 = await p2pix.callStatic.userRecord( + acc01Key, + ); + const acc03Record2 = await p2pix.callStatic.userRecord( + acc03Key, + ); + + expect(tx).to.be.ok; + expect(tx1).to.be.ok; + expect(tx2).to.be.ok; + await expect(tx) + .to.emit(p2pix, "LockReleased") + .withArgs(acc02.address, lockID, storage1.amount); + await expect(tx1) + .to.emit(p2pix, "LockReleased") + .withArgs(acc02.address, lockID2, storage2.amount); + await expect(tx2) + .to.emit(p2pix, "LockReleased") + .withArgs(acc02.address, lockID3, storage3.amount); + expect(used1).to.eq(true); + expect(used2).to.eq(true); + expect(used3).to.eq(true); + expect(0).to.eq(acc01Record1).and.to.eq(acc03Record1); + expect(acc01Record2).to.eq(6); // 0 + 6 + expect(acc03Record2).to.eq(185); // 100 + 50 + 25 + 10 + await expect(tx).to.changeTokenBalances( + erc20, + [ + acc01.address, + acc02.address, + acc03.address, + p2pix.address, + ], + [0, 100, 0, "-100"], + ); + await expect(tx1).to.changeTokenBalances( + erc20, + [ + acc01.address, + acc02.address, + acc03.address, + p2pix.address, + ], + [0, 47, 3, "-50"], + ); + await expect(tx2).to.changeTokenBalances( + erc20, + [ + acc01.address, + acc02.address, + acc03.address, + p2pix.address, + ], + [0, 20, 5, "-25"], + ); + }); + }); + describe("Unexpire Locks", async () => { + it("should revert if lock isn't expired", async () => { + const target = ethers.BigNumber.from(101); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + await p2pix + .connect(acc02) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + 1, + [], + [] + ); + const lockID = ethers.constants.One; + const fail = p2pix.unlockExpired([lockID]); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.NotExpired, + ); + }); + it("should revert if lock has already been released", async () => { + const endtoendID = ethers.constants.HashZero; + const pixTarget = ethers.BigNumber.from(101); + const messageToSign = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [pixTarget, 1, endtoendID], + ); + const messageHashBytes = + ethers.utils.arrayify(messageToSign); + const flatSig = await acc01.signMessage( + messageHashBytes, + ); + const sig = ethers.utils.splitSignature(flatSig); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + pixTarget, + true, + merkleRoot, + ); + await p2pix + .connect(acc02) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + 1, + [], + [] + ); + const lockID = ethers.constants.One; + // await mine(10); + await p2pix.release( + lockID, + acc03.address, + endtoendID, + sig.r, + sig.s, + sig.v, + ); + const fail = p2pix.unlockExpired([lockID]); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.AlreadyReleased, + ); + }); + it("should unlock expired locks, update storage and emit events", async () => { + const target = ethers.BigNumber.from(101); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + await p2pix + .connect(acc02) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + 1, + [], + [] + ); + const lockID = ethers.constants.One; + await mine(11); + const storage: Lock = await p2pix.callStatic.mapLocks( + lockID, + ); + const userKey = await p2pix.callStatic._castAddrToKey( + acc02.address, + ); + const record1 = await p2pix.callStatic.userRecord( + userKey, + ); + const tx = await p2pix.unlockExpired([lockID]); + const storage2: Lock = await p2pix.callStatic.mapLocks( + lockID, + ); + const record2 = await p2pix.callStatic.userRecord( + userKey, + ); + + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "LockReturned") + .withArgs(acc02.address, lockID); + expect(storage.amount).to.eq(ethers.constants.One); + expect(storage2.amount).to.eq(ethers.constants.Zero); + expect(record1).to.eq(0); + expect(record2).to.eq(price); + }); + it("should unlock expired through lock function", async () => { + const target = ethers.BigNumber.from(101); + // test method through lock fx + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + const lock1: ContractTransaction = await p2pix + .connect(acc01) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + price, + proof, + [], + ); + // as return values of non view functions can't be accessed + // outside the evm, we fetch the lockID from the emitted event. + const rc: ContractReceipt = await lock1.wait(); + const event = rc.events?.find( + event => event.event === "LockAdded", + ); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const emittedLockID = event?.args!["lockID"]; + const lockID = ethers.constants.One; + + // mine blocks to expire lock + await mine(12); + // const blocknum = await p2pix.provider.getBlockNumber(); + // console.log("bn = 6 + 12 ( i.e., %s )", blocknum); + // console.log( + // "\n", + // " 2 blocks past the expiration block", + // ); + // const struct2: Lock = await p2pix.callStatic.mapLocks( + // emittedLockID, + // ); + // console.log( + // "\n", + // "Current state of the lock:", + // "\n", + // struct2, + // ); + + expect(emittedLockID).to.eq(lockID); + + // create another lock by freeing the price value + // back to `l.remamining` and lock 100 again. + const tx1 = await p2pix.lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + 100, + [], + [lockID], + ); + const remaining = await p2pix.callStatic.getBalance(owner.address,erc20.address); + + expect(tx1).to.be.ok; + await expect(tx1) + .to.emit(p2pix, "LockReturned") + .withArgs(acc02.address, lockID); + expect(remaining).to.eq( + price.sub(ethers.BigNumber.from(100)), + ); + }); + it("should unlock expired through withdraw function", async () => { + const target = ethers.constants.One; + // test method through withdraw fx + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + await p2pix + .connect(acc01) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + price, + proof, + [], + ); + const lockID = ethers.constants.One; + // mine blocks to expire lock + await mine(11); + const tx = await p2pix.withdraw(erc20.address, price, [lockID]); + const remaining = await p2pix.callStatic.getBalance(owner.address, erc20.address); + + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "LockReturned") + .withArgs(acc02.address, lockID); + expect(remaining).to.eq(0); + }); + }); + + describe("Seller Withdraw", async () => { + it("should revert if the wished amount is invalid", async () => { + const target = ethers.BigNumber.from(101); + await erc20.approve(p2pix.address, price); + await p2pix.deposit( + erc20.address, + price, + target, + true, + merkleRoot, + ); + const fail = p2pix.connect(acc02).withdraw(erc20.address, price.mul(ethers.constants.Two),[]); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.DecOverflow, + ); + + }); + it("should withdraw remaining funds from deposit, update storage and emit event", async () => { + const newPrice = price.div(ethers.constants.Two); + await erc20.approve(p2pix.address, price); + const dep = await p2pix.deposit( + erc20.address, + price, + ethers.BigNumber.from(101), + true, + merkleRoot, + ); + const tx = await p2pix.withdraw( + erc20.address, + price.div(ethers.constants.Two), + [] + ); + + expect(tx).to.be.ok; + await expect(dep) + .to.changeTokenBalance( + erc20, + owner.address, + "-100000000000000000000", + ) + .and.to.changeTokenBalance( + erc20, + p2pix.address, + price, + ); + await expect(tx) + .to.changeTokenBalance(erc20, owner.address, newPrice) + .and.to.changeTokenBalance( + erc20, + p2pix.address, + "-50000000000000000000", + ); + + await expect(tx) + .to.emit(p2pix, "DepositWithdrawn") + .withArgs(owner.address, erc20.address, newPrice); + }); + }); + describe("Allowlist Settings", async () => { + it("should revert if the msg.sender differs from deposit's seller", async () => { + const root = ethers.utils.keccak256( + ethers.utils.toUtf8Bytes("root"), + ); + const fail = p2pix + .connect(acc02) + .setRoot(owner.address, root); + + await expect(fail).to.be.revertedWithCustomError( + p2pix, + P2PixErrors.OnlySeller, + ); + }); + it("should set root of seller's allowlist, update storage and emit event", async () => { + const ownerKey = await p2pix.callStatic._castAddrToKey( + owner.address, + ); + const oldState = await p2pix.callStatic.sellerAllowList( + ownerKey, + ); + const tx = await p2pix + .connect(owner) + .setRoot(owner.address, merkleRoot); + const newState = await p2pix.callStatic.sellerAllowList( + ownerKey, + ); + + expect(tx).to.be.ok; + await expect(tx) + .to.emit(p2pix, "RootUpdated") + .withArgs(owner.address, merkleRoot); + expect(oldState).to.eq(ethers.constants.HashZero); + expect(newState).to.eq(merkleRoot); + }); + }); +}); diff --git a/test/utils/errors.ts b/test/utils/errors.ts index 111ff6f..5bf5595 100644 --- a/test/utils/errors.ts +++ b/test/utils/errors.ts @@ -15,4 +15,8 @@ export enum P2PixErrors { AddressDenied = "AddressDenied", AmountNotAllowed = "AmountNotAllowed", LockExpired = "LockExpired", + EmptyPixTarget = "EmptyPixTarget", + MaxBalExceeded = "MaxBalExceeded", + NotInitialized = "NotInitialized", + DecOverflow = "DecOverflow", } diff --git a/test/utils/fixtures.ts b/test/utils/fixtures.ts index ab9d9ed..fd9baca 100644 --- a/test/utils/fixtures.ts +++ b/test/utils/fixtures.ts @@ -17,22 +17,25 @@ export interface Deploys { token: string; } -export interface Deposit { - remaining: BigNumber; - pixTarget: string; - seller: string; - token: string; - valid: boolean; -} +// export interface Deposit { +// remaining: BigNumber; +// pixTarget: string; +// seller: string; +// token: string; +// valid: boolean; +// } export interface Lock { - depositID: BigNumber; + sellerKey: BigNumber; + counter: BigNumber; relayerPremium: BigNumber; amount: BigNumber; expirationBlock: BigNumber; + pixTarget: BigNumber; buyerAddress: string; relayerTarget: string; relayerAddress: string; + token: string; } export interface P2pixFixture { From bb10cf953f3b353c816f3afe3359a25566023511 Mon Sep 17 00:00:00 2001 From: PedroCailleret Date: Fri, 27 Jan 2023 01:50:37 -0300 Subject: [PATCH 3/3] :adhesive_bandage: getBalances Fix --- README.md | 14 +- .../DataTypes.sol/DataTypes.dbg.json | 2 +- .../EventAndErrors.dbg.json | 2 +- .../Reputation.sol/Reputation.dbg.json | 2 +- .../lib/auth/Owned.sol/Owned.dbg.json | 2 +- .../IReputation.sol/IReputation.dbg.json | 2 +- .../lib/mock/mockToken.sol/MockToken.dbg.json | 2 +- .../lib/tokens/ERC20.sol/ERC20.dbg.json | 2 +- .../MerkleProofLib.dbg.json | 2 +- .../ReentrancyGuard.dbg.json | 2 +- .../SafeTransferLib.dbg.json | 2 +- artifacts/contracts/p2pix.sol/P2PIX.dbg.json | 2 +- artifacts/contracts/p2pix.sol/P2PIX.json | 6 +- contracts/p2pix.sol | 24 +-- deploys/goerli.json | 2 +- deploys/polygon-mumbai.json | 2 +- .../factories/p2pix.sol/P2PIX__factory.ts | 4 +- src/types/p2pix.sol/P2PIX.ts | 2 +- test/p2pix.test.ts | 166 ++++++++++++++---- 19 files changed, 173 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index ec6daf7..087ca5b 100644 --- a/README.md +++ b/README.md @@ -50,16 +50,18 @@ ### V2 | Testnet | Token Address | P2pix Address | Reputation Address | |--------- |-------------------------------------------- |-------------------------------------------- |-------------------------------------------- | -| Goerli | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0x2a54667b566B1Aa3779828720E6696AC18ae3f1b | 0x7c4010CFe2B5446f0c9dcc5e9B596534b2D2eB44 | -| Mumbai | 0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29 | 0x7F4680D114B43c4434FB604c7Bc6306125D32f28 | 0xD38D6367f452D097ccBfDe4490b7de570B6A72Db | +| Goerli | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0xefa5cE4351cda51192509cf8De7d8881ADAE95DD | 0x939d3c357dc7017cDbDE681BF8e552b54595318A | +| Mumbai | 0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29 | 0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b | 0x1fd30b94f20d2f73e9630261342ba68f244da92b | - - + + + - - + + + ## Usage ### Pre Requisites diff --git a/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json b/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json index c296519..0202b49 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json index c296519..0202b49 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/Reputation.sol/Reputation.dbg.json b/artifacts/contracts/Reputation.sol/Reputation.dbg.json index c296519..0202b49 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json b/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json index ff1ed99..b9559f1 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json b/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json index ff1ed99..b9559f1 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json index ff1ed99..b9559f1 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json b/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json index ff1ed99..b9559f1 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json b/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json index ff1ed99..b9559f1 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json b/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json index ff1ed99..b9559f1 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json b/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json index ff1ed99..b9559f1 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.dbg.json b/artifacts/contracts/p2pix.sol/P2PIX.dbg.json index c296519..0202b49 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/6801f23dfb2a9667d9e89d4173ae1ee7.json" + "buildInfo": "../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.json b/artifacts/contracts/p2pix.sol/P2PIX.json index e4946d4..a7dbe7e 100644 --- a/artifacts/contracts/p2pix.sol/P2PIX.json +++ b/artifacts/contracts/p2pix.sol/P2PIX.json @@ -561,7 +561,7 @@ "outputs": [ { "internalType": "uint256[]", - "name": "balances", + "name": "", "type": "uint256[]" } ], @@ -1065,8 +1065,8 @@ "type": "receive" } ], - "bytecode": "0x6080604052600180556040516200322a3803806200322a8339810160408190526200002a9162000493565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000616565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005b1565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005c7565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b90565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003ce57620003ce6200038d565b604052919050565b60006001600160401b03821115620003f257620003f26200038d565b5060051b60200190565b6001600160a01b03811681146200041257600080fd5b50565b600082601f8301126200042757600080fd5b81516020620004406200043a83620003d6565b620003a3565b82815260059290921b840181019181810190868411156200046057600080fd5b8286015b84811015620004885780516200047a81620003fc565b835291830191830162000464565b509695505050505050565b600080600080600060a08688031215620004ac57600080fd5b8551602080880151919650906001600160401b0380821115620004ce57600080fd5b620004dc8a838b0162000415565b965060408901519150620004f082620003fc565b6060890151919550808211156200050657600080fd5b620005148a838b0162000415565b945060808901519150808211156200052b57600080fd5b508701601f810189136200053e57600080fd5b80516200054f6200043a82620003d6565b81815260059190911b8201830190838101908b8311156200056f57600080fd5b928401925b828410156200059f57835180151581146200058f5760008081fd5b8252928401929084019062000574565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156200060a5783516001600160a01b031683529284019291840191600101620005e3565b50909695505050505050565b612c0480620006266000396000f3fe6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610215610203366004612406565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461248d565b6107be565b34801561025457600080fd5b50610268610263366004612674565b610b6d565b005b34801561027657600080fd5b506102686102853660046126b1565b610ca7565b34801561029657600080fd5b506102686102a53660046126ea565b610d98565b3480156102b657600080fd5b506103376102c5366004612406565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be366004612406565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe3660046126b1565b600c1b90565b34801561041057600080fd5b5061026861041f366004612406565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d36104543660046126b1565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461275d565b611151565b3480156104b157600080fd5b506102686104c0366004612792565b611268565b3480156104d157600080fd5b506102156104e0366004612406565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127f6565b611747565b34801561051e57600080fd5b506103d361052d366004612822565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d366004612406565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c366004612406565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461285b565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b50610573610674366004612822565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b4366004612880565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b506107066107013660046128c2565b611a50565b60405161021f9190612909565b34801561071f57600080fd5b5061021561072e366004612822565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461294d565b611b5b565b34801561078a57600080fd5b506102686107993660046126b1565b611c6b565b3480156107aa57600080fd5b506102686107b9366004612a0f565b611d37565b60006107c8611e33565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a9a565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a9a565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e77565b610a4e848c84848988611ecf565b60048054906000610a5e83612ab2565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611ecf565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aeb565b61202a565b9050610ad4670de0b6b3a764000082612b26565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611ecf565b60048054906000610b4783612ab2565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b63565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b92565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a9a565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e33565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a9a565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120e6565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b33826121b0565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e33565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612be0565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a9a565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a9a565b9091555061162b9050565b8187600201546116039190612a9a565b33600c1b60009081526007602052604081208054909190611625908490612a9a565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff168361222a565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c61222a565b6116c4838d60018a60020154901c61222a565b6116d8565b6116d8838d896002015461222a565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b63565b9050602002013581526020019081526020016000209050611851816122e9565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a9a565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a9a565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b63565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b606073ffffffffffffffffffffffffffffffffffffffff8216611a9f576040517fdf95788300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8251611ad7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82516000905b80821015611b5357611b30858381518110611afa57611afa612b63565b602090810291909101810151600c1b6000908152600b8252604080822088835290925220546b3fffffffffffffffffffffff1690565b838381518110611b4257611b42612b63565b602002602001018181525050611add565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bf15763df9578836000526004601cfd5b81518114611c075763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611c16565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d3f611e33565b611d49828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d7f57611d7f846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611dcd906b3fffffffffffffffffffffff16858784612365565b611dd885338661222a565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e70576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e9984848473ffffffffffffffffffffffffffffffffffffffff85166123c2565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611fbe86868484612365565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea659261201a92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161204891815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120dd5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806121a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af1905080612225576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b4381600401541115612327576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612362576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123785763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152812080548592906123b7908490612be0565b909155505050505050565b600083156123fe578360051b8501855b803580851160051b948552602094851852604060002093018181106123f6576123fb565b6123d2565b50505b501492915050565b60006020828403121561241857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461236257600080fd5b60008083601f84011261245357600080fd5b50813567ffffffffffffffff81111561246b57600080fd5b6020830191508360208260051b850101111561248657600080fd5b9250929050565b6000806000806000806000806000806101008b8d0312156124ad57600080fd5b8a356124b88161241f565b995060208b01356124c88161241f565b985060408b01356124d88161241f565b975060608b01356124e88161241f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561251357600080fd5b61251f8e838f01612441565b909650945060e08d013591508082111561253857600080fd5b506125458d828e01612441565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125d4576125d461255e565b604052919050565b600067ffffffffffffffff8211156125f6576125f661255e565b5060051b60200190565b600082601f83011261261157600080fd5b81356020612626612621836125dc565b61258d565b82815260059290921b8401810191818101908684111561264557600080fd5b8286015b8481101561266957803561265c8161241f565b8352918301918301612649565b509695505050505050565b60006020828403121561268657600080fd5b813567ffffffffffffffff81111561269d57600080fd5b6126a984828501612600565b949350505050565b6000602082840312156126c357600080fd5b81356126ce8161241f565b9392505050565b803580151581146126e557600080fd5b919050565b600080600080600060a0868803121561270257600080fd5b853561270d8161241f565b945060208601356bffffffffffffffffffffffff8116811461272e57600080fd5b9350604086013561273e8161241f565b925061274c606087016126d5565b949793965091946080013592915050565b6000806040838503121561277057600080fd5b823561277b8161241f565b9150612789602084016126d5565b90509250929050565b60008060008060008060c087890312156127ab57600080fd5b8635955060208701356127bd8161241f565b945060408701359350606087013592506080870135915060a087013560ff811681146127e857600080fd5b809150509295509295509295565b6000806040838503121561280957600080fd5b82356128148161241f565b946020939093013593505050565b6000806040838503121561283557600080fd5b82356128408161241f565b915060208301356128508161241f565b809150509250929050565b6000806040838503121561286e57600080fd5b8235915060208301356128508161241f565b6000806020838503121561289357600080fd5b823567ffffffffffffffff8111156128aa57600080fd5b6128b685828601612441565b90969095509350505050565b600080604083850312156128d557600080fd5b823567ffffffffffffffff8111156128ec57600080fd5b6128f885828601612600565b92505060208301356128508161241f565b6020808252825182820181905260009190848201906040850190845b8181101561294157835183529284019291840191600101612925565b50909695505050505050565b6000806040838503121561296057600080fd5b823567ffffffffffffffff8082111561297857600080fd5b61298486838701612600565b935060209150818501358181111561299b57600080fd5b85019050601f810186136129ae57600080fd5b80356129bc612621826125dc565b81815260059190911b820183019083810190888311156129db57600080fd5b928401925b82841015612a00576129f1846126d5565b825292840192908401906129e0565b80955050505050509250929050565b60008060008060608587031215612a2557600080fd5b8435612a308161241f565b935060208501359250604085013567ffffffffffffffff811115612a5357600080fd5b612a5f87828801612441565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612aad57612aad612a6b565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ae457612ae4612a6b565b5060010190565b600082612b21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b5e57612b5e612a6b565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561294157835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612bae565b600082821015612bf257612bf2612a6b565b50039056fea164736f6c6343000809000a", - "deployedBytecode": "0x6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610215610203366004612406565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461248d565b6107be565b34801561025457600080fd5b50610268610263366004612674565b610b6d565b005b34801561027657600080fd5b506102686102853660046126b1565b610ca7565b34801561029657600080fd5b506102686102a53660046126ea565b610d98565b3480156102b657600080fd5b506103376102c5366004612406565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be366004612406565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe3660046126b1565b600c1b90565b34801561041057600080fd5b5061026861041f366004612406565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d36104543660046126b1565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461275d565b611151565b3480156104b157600080fd5b506102686104c0366004612792565b611268565b3480156104d157600080fd5b506102156104e0366004612406565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127f6565b611747565b34801561051e57600080fd5b506103d361052d366004612822565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d366004612406565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c366004612406565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461285b565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b50610573610674366004612822565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b4366004612880565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b506107066107013660046128c2565b611a50565b60405161021f9190612909565b34801561071f57600080fd5b5061021561072e366004612822565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461294d565b611b5b565b34801561078a57600080fd5b506102686107993660046126b1565b611c6b565b3480156107aa57600080fd5b506102686107b9366004612a0f565b611d37565b60006107c8611e33565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a9a565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a9a565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e77565b610a4e848c84848988611ecf565b60048054906000610a5e83612ab2565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611ecf565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aeb565b61202a565b9050610ad4670de0b6b3a764000082612b26565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611ecf565b60048054906000610b4783612ab2565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b63565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b92565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a9a565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e33565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a9a565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120e6565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b33826121b0565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e33565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612be0565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a9a565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a9a565b9091555061162b9050565b8187600201546116039190612a9a565b33600c1b60009081526007602052604081208054909190611625908490612a9a565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff168361222a565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c61222a565b6116c4838d60018a60020154901c61222a565b6116d8565b6116d8838d896002015461222a565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b63565b9050602002013581526020019081526020016000209050611851816122e9565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a9a565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a9a565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b63565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b606073ffffffffffffffffffffffffffffffffffffffff8216611a9f576040517fdf95788300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8251611ad7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82516000905b80821015611b5357611b30858381518110611afa57611afa612b63565b602090810291909101810151600c1b6000908152600b8252604080822088835290925220546b3fffffffffffffffffffffff1690565b838381518110611b4257611b42612b63565b602002602001018181525050611add565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bf15763df9578836000526004601cfd5b81518114611c075763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611c16565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d3f611e33565b611d49828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d7f57611d7f846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611dcd906b3fffffffffffffffffffffff16858784612365565b611dd885338661222a565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e70576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e9984848473ffffffffffffffffffffffffffffffffffffffff85166123c2565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611fbe86868484612365565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea659261201a92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161204891815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120dd5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806121a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af1905080612225576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b4381600401541115612327576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612362576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123785763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152812080548592906123b7908490612be0565b909155505050505050565b600083156123fe578360051b8501855b803580851160051b948552602094851852604060002093018181106123f6576123fb565b6123d2565b50505b501492915050565b60006020828403121561241857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461236257600080fd5b60008083601f84011261245357600080fd5b50813567ffffffffffffffff81111561246b57600080fd5b6020830191508360208260051b850101111561248657600080fd5b9250929050565b6000806000806000806000806000806101008b8d0312156124ad57600080fd5b8a356124b88161241f565b995060208b01356124c88161241f565b985060408b01356124d88161241f565b975060608b01356124e88161241f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561251357600080fd5b61251f8e838f01612441565b909650945060e08d013591508082111561253857600080fd5b506125458d828e01612441565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125d4576125d461255e565b604052919050565b600067ffffffffffffffff8211156125f6576125f661255e565b5060051b60200190565b600082601f83011261261157600080fd5b81356020612626612621836125dc565b61258d565b82815260059290921b8401810191818101908684111561264557600080fd5b8286015b8481101561266957803561265c8161241f565b8352918301918301612649565b509695505050505050565b60006020828403121561268657600080fd5b813567ffffffffffffffff81111561269d57600080fd5b6126a984828501612600565b949350505050565b6000602082840312156126c357600080fd5b81356126ce8161241f565b9392505050565b803580151581146126e557600080fd5b919050565b600080600080600060a0868803121561270257600080fd5b853561270d8161241f565b945060208601356bffffffffffffffffffffffff8116811461272e57600080fd5b9350604086013561273e8161241f565b925061274c606087016126d5565b949793965091946080013592915050565b6000806040838503121561277057600080fd5b823561277b8161241f565b9150612789602084016126d5565b90509250929050565b60008060008060008060c087890312156127ab57600080fd5b8635955060208701356127bd8161241f565b945060408701359350606087013592506080870135915060a087013560ff811681146127e857600080fd5b809150509295509295509295565b6000806040838503121561280957600080fd5b82356128148161241f565b946020939093013593505050565b6000806040838503121561283557600080fd5b82356128408161241f565b915060208301356128508161241f565b809150509250929050565b6000806040838503121561286e57600080fd5b8235915060208301356128508161241f565b6000806020838503121561289357600080fd5b823567ffffffffffffffff8111156128aa57600080fd5b6128b685828601612441565b90969095509350505050565b600080604083850312156128d557600080fd5b823567ffffffffffffffff8111156128ec57600080fd5b6128f885828601612600565b92505060208301356128508161241f565b6020808252825182820181905260009190848201906040850190845b8181101561294157835183529284019291840191600101612925565b50909695505050505050565b6000806040838503121561296057600080fd5b823567ffffffffffffffff8082111561297857600080fd5b61298486838701612600565b935060209150818501358181111561299b57600080fd5b85019050601f810186136129ae57600080fd5b80356129bc612621826125dc565b81815260059190911b820183019083810190888311156129db57600080fd5b928401925b82841015612a00576129f1846126d5565b825292840192908401906129e0565b80955050505050509250929050565b60008060008060608587031215612a2557600080fd5b8435612a308161241f565b935060208501359250604085013567ffffffffffffffff811115612a5357600080fd5b612a5f87828801612441565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612aad57612aad612a6b565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ae457612ae4612a6b565b5060010190565b600082612b21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b5e57612b5e612a6b565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561294157835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612bae565b600082821015612bf257612bf2612a6b565b50039056fea164736f6c6343000809000a", + "bytecode": "0x608060405260018055604051620031f9380380620031f98339810160408190526200002a9162000493565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000616565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005b1565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005c7565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b90565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003ce57620003ce6200038d565b604052919050565b60006001600160401b03821115620003f257620003f26200038d565b5060051b60200190565b6001600160a01b03811681146200041257600080fd5b50565b600082601f8301126200042757600080fd5b81516020620004406200043a83620003d6565b620003a3565b82815260059290921b840181019181810190868411156200046057600080fd5b8286015b84811015620004885780516200047a81620003fc565b835291830191830162000464565b509695505050505050565b600080600080600060a08688031215620004ac57600080fd5b8551602080880151919650906001600160401b0380821115620004ce57600080fd5b620004dc8a838b0162000415565b965060408901519150620004f082620003fc565b6060890151919550808211156200050657600080fd5b620005148a838b0162000415565b945060808901519150808211156200052b57600080fd5b508701601f810189136200053e57600080fd5b80516200054f6200043a82620003d6565b81815260059190911b8201830190838101908b8311156200056f57600080fd5b928401925b828410156200059f57835180151581146200058f5760008081fd5b8252928401929084019062000574565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156200060a5783516001600160a01b031683529284019291840191600101620005e3565b50909695505050505050565b612bd380620006266000396000f3fe6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102156102033660046123d5565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461245c565b6107be565b34801561025457600080fd5b50610268610263366004612643565b610b6d565b005b34801561027657600080fd5b50610268610285366004612680565b610ca7565b34801561029657600080fd5b506102686102a53660046126b9565b610d98565b3480156102b657600080fd5b506103376102c53660046123d5565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be3660046123d5565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe366004612680565b600c1b90565b34801561041057600080fd5b5061026861041f3660046123d5565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d3610454366004612680565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461272c565b611151565b3480156104b157600080fd5b506102686104c0366004612761565b611268565b3480156104d157600080fd5b506102156104e03660046123d5565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127c5565b611747565b34801561051e57600080fd5b506103d361052d3660046127f1565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d3660046123d5565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c3660046123d5565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461282a565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b506105736106743660046127f1565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b436600461284f565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b50610706610701366004612891565b611a50565b60405161021f91906128d8565b34801561071f57600080fd5b5061021561072e3660046127f1565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461291c565b611b2a565b34801561078a57600080fd5b50610268610799366004612680565b611c3a565b3480156107aa57600080fd5b506102686107b93660046129de565b611d06565b60006107c8611e02565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a69565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a69565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e46565b610a4e848c84848988611e9e565b60048054906000610a5e83612a81565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611e9e565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aba565b611ff9565b9050610ad4670de0b6b3a764000082612af5565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611e9e565b60048054906000610b4783612a81565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b32565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b61565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a69565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e02565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a69565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120b5565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b338261217f565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e02565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612baf565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a69565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a69565b9091555061162b9050565b8187600201546116039190612a69565b33600c1b60009081526007602052604081208054909190611625908490612a69565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff16836121f9565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c6121f9565b6116c4838d60018a60020154901c6121f9565b6116d8565b6116d8838d89600201546121f9565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b32565b9050602002013581526020019081526020016000209050611851816122b8565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a69565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a69565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b32565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b8151606090600090818167ffffffffffffffff811115611a7257611a7261252d565b604051908082528060200260200182016040528015611a9b578160200160208202803683370190505b5090505b81831015611b21576000611af4878581518110611abe57611abe612b32565b602090810291909101810151600c1b6000908152600b825260408082208a835290925220546b3fffffffffffffffffffffff1690565b905080828581518110611b0957611b09612b32565b60200260200101818152505083600101935050611a9f565b95945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bc05763df9578836000526004601cfd5b81518114611bd65763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611be5565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d0e611e02565b611d18828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d4e57611d4e846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611d9c906b3fffffffffffffffffffffff16858784612334565b611da78533866121f9565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e3f576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e6884848473ffffffffffffffffffffffffffffffffffffffff8516612391565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611f8d86868484612334565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea6592611fe992918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161201791815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120ac5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080612178576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af19050806121f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b43816004015411156122f6576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612331576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123475763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281208054859290612386908490612baf565b909155505050505050565b600083156123cd578360051b8501855b803580851160051b948552602094851852604060002093018181106123c5576123ca565b6123a1565b50505b501492915050565b6000602082840312156123e757600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461233157600080fd5b60008083601f84011261242257600080fd5b50813567ffffffffffffffff81111561243a57600080fd5b6020830191508360208260051b850101111561245557600080fd5b9250929050565b6000806000806000806000806000806101008b8d03121561247c57600080fd5b8a35612487816123ee565b995060208b0135612497816123ee565b985060408b01356124a7816123ee565b975060608b01356124b7816123ee565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff808211156124e257600080fd5b6124ee8e838f01612410565b909650945060e08d013591508082111561250757600080fd5b506125148d828e01612410565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125a3576125a361252d565b604052919050565b600067ffffffffffffffff8211156125c5576125c561252d565b5060051b60200190565b600082601f8301126125e057600080fd5b813560206125f56125f0836125ab565b61255c565b82815260059290921b8401810191818101908684111561261457600080fd5b8286015b8481101561263857803561262b816123ee565b8352918301918301612618565b509695505050505050565b60006020828403121561265557600080fd5b813567ffffffffffffffff81111561266c57600080fd5b612678848285016125cf565b949350505050565b60006020828403121561269257600080fd5b813561269d816123ee565b9392505050565b803580151581146126b457600080fd5b919050565b600080600080600060a086880312156126d157600080fd5b85356126dc816123ee565b945060208601356bffffffffffffffffffffffff811681146126fd57600080fd5b9350604086013561270d816123ee565b925061271b606087016126a4565b949793965091946080013592915050565b6000806040838503121561273f57600080fd5b823561274a816123ee565b9150612758602084016126a4565b90509250929050565b60008060008060008060c0878903121561277a57600080fd5b86359550602087013561278c816123ee565b945060408701359350606087013592506080870135915060a087013560ff811681146127b757600080fd5b809150509295509295509295565b600080604083850312156127d857600080fd5b82356127e3816123ee565b946020939093013593505050565b6000806040838503121561280457600080fd5b823561280f816123ee565b9150602083013561281f816123ee565b809150509250929050565b6000806040838503121561283d57600080fd5b82359150602083013561281f816123ee565b6000806020838503121561286257600080fd5b823567ffffffffffffffff81111561287957600080fd5b61288585828601612410565b90969095509350505050565b600080604083850312156128a457600080fd5b823567ffffffffffffffff8111156128bb57600080fd5b6128c7858286016125cf565b925050602083013561281f816123ee565b6020808252825182820181905260009190848201906040850190845b81811015612910578351835292840192918401916001016128f4565b50909695505050505050565b6000806040838503121561292f57600080fd5b823567ffffffffffffffff8082111561294757600080fd5b612953868387016125cf565b935060209150818501358181111561296a57600080fd5b85019050601f8101861361297d57600080fd5b803561298b6125f0826125ab565b81815260059190911b820183019083810190888311156129aa57600080fd5b928401925b828410156129cf576129c0846126a4565b825292840192908401906129af565b80955050505050509250929050565b600080600080606085870312156129f457600080fd5b84356129ff816123ee565b935060208501359250604085013567ffffffffffffffff811115612a2257600080fd5b612a2e87828801612410565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612a7c57612a7c612a3a565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ab357612ab3612a3a565b5060010190565b600082612af0577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b2d57612b2d612a3a565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561291057835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612b7d565b600082821015612bc157612bc1612a3a565b50039056fea164736f6c6343000809000a", + "deployedBytecode": "0x6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102156102033660046123d5565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461245c565b6107be565b34801561025457600080fd5b50610268610263366004612643565b610b6d565b005b34801561027657600080fd5b50610268610285366004612680565b610ca7565b34801561029657600080fd5b506102686102a53660046126b9565b610d98565b3480156102b657600080fd5b506103376102c53660046123d5565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be3660046123d5565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe366004612680565b600c1b90565b34801561041057600080fd5b5061026861041f3660046123d5565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d3610454366004612680565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461272c565b611151565b3480156104b157600080fd5b506102686104c0366004612761565b611268565b3480156104d157600080fd5b506102156104e03660046123d5565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127c5565b611747565b34801561051e57600080fd5b506103d361052d3660046127f1565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d3660046123d5565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c3660046123d5565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461282a565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b506105736106743660046127f1565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b436600461284f565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b50610706610701366004612891565b611a50565b60405161021f91906128d8565b34801561071f57600080fd5b5061021561072e3660046127f1565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461291c565b611b2a565b34801561078a57600080fd5b50610268610799366004612680565b611c3a565b3480156107aa57600080fd5b506102686107b93660046129de565b611d06565b60006107c8611e02565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a69565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a69565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e46565b610a4e848c84848988611e9e565b60048054906000610a5e83612a81565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611e9e565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aba565b611ff9565b9050610ad4670de0b6b3a764000082612af5565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611e9e565b60048054906000610b4783612a81565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b32565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b61565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a69565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e02565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a69565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120b5565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b338261217f565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e02565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612baf565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a69565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a69565b9091555061162b9050565b8187600201546116039190612a69565b33600c1b60009081526007602052604081208054909190611625908490612a69565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff16836121f9565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c6121f9565b6116c4838d60018a60020154901c6121f9565b6116d8565b6116d8838d89600201546121f9565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b32565b9050602002013581526020019081526020016000209050611851816122b8565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a69565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a69565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b32565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b8151606090600090818167ffffffffffffffff811115611a7257611a7261252d565b604051908082528060200260200182016040528015611a9b578160200160208202803683370190505b5090505b81831015611b21576000611af4878581518110611abe57611abe612b32565b602090810291909101810151600c1b6000908152600b825260408082208a835290925220546b3fffffffffffffffffffffff1690565b905080828581518110611b0957611b09612b32565b60200260200101818152505083600101935050611a9f565b95945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bc05763df9578836000526004601cfd5b81518114611bd65763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611be5565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d0e611e02565b611d18828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d4e57611d4e846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611d9c906b3fffffffffffffffffffffff16858784612334565b611da78533866121f9565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e3f576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e6884848473ffffffffffffffffffffffffffffffffffffffff8516612391565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611f8d86868484612334565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea6592611fe992918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161201791815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120ac5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080612178576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af19050806121f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b43816004015411156122f6576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612331576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123475763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281208054859290612386908490612baf565b909155505050505050565b600083156123cd578360051b8501855b803580851160051b948552602094851852604060002093018181106123c5576123ca565b6123a1565b50505b501492915050565b6000602082840312156123e757600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461233157600080fd5b60008083601f84011261242257600080fd5b50813567ffffffffffffffff81111561243a57600080fd5b6020830191508360208260051b850101111561245557600080fd5b9250929050565b6000806000806000806000806000806101008b8d03121561247c57600080fd5b8a35612487816123ee565b995060208b0135612497816123ee565b985060408b01356124a7816123ee565b975060608b01356124b7816123ee565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff808211156124e257600080fd5b6124ee8e838f01612410565b909650945060e08d013591508082111561250757600080fd5b506125148d828e01612410565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125a3576125a361252d565b604052919050565b600067ffffffffffffffff8211156125c5576125c561252d565b5060051b60200190565b600082601f8301126125e057600080fd5b813560206125f56125f0836125ab565b61255c565b82815260059290921b8401810191818101908684111561261457600080fd5b8286015b8481101561263857803561262b816123ee565b8352918301918301612618565b509695505050505050565b60006020828403121561265557600080fd5b813567ffffffffffffffff81111561266c57600080fd5b612678848285016125cf565b949350505050565b60006020828403121561269257600080fd5b813561269d816123ee565b9392505050565b803580151581146126b457600080fd5b919050565b600080600080600060a086880312156126d157600080fd5b85356126dc816123ee565b945060208601356bffffffffffffffffffffffff811681146126fd57600080fd5b9350604086013561270d816123ee565b925061271b606087016126a4565b949793965091946080013592915050565b6000806040838503121561273f57600080fd5b823561274a816123ee565b9150612758602084016126a4565b90509250929050565b60008060008060008060c0878903121561277a57600080fd5b86359550602087013561278c816123ee565b945060408701359350606087013592506080870135915060a087013560ff811681146127b757600080fd5b809150509295509295509295565b600080604083850312156127d857600080fd5b82356127e3816123ee565b946020939093013593505050565b6000806040838503121561280457600080fd5b823561280f816123ee565b9150602083013561281f816123ee565b809150509250929050565b6000806040838503121561283d57600080fd5b82359150602083013561281f816123ee565b6000806020838503121561286257600080fd5b823567ffffffffffffffff81111561287957600080fd5b61288585828601612410565b90969095509350505050565b600080604083850312156128a457600080fd5b823567ffffffffffffffff8111156128bb57600080fd5b6128c7858286016125cf565b925050602083013561281f816123ee565b6020808252825182820181905260009190848201906040850190845b81811015612910578351835292840192918401916001016128f4565b50909695505050505050565b6000806040838503121561292f57600080fd5b823567ffffffffffffffff8082111561294757600080fd5b612953868387016125cf565b935060209150818501358181111561296a57600080fd5b85019050601f8101861361297d57600080fd5b803561298b6125f0826125ab565b81815260059190911b820183019083810190888311156129aa57600080fd5b928401925b828410156129cf576129c0846126a4565b825292840192908401906129af565b80955050505050509250929050565b600080600080606085870312156129f457600080fd5b84356129ff816123ee565b935060208501359250604085013567ffffffffffffffff811115612a2257600080fd5b612a2e87828801612410565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612a7c57612a7c612a3a565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ab357612ab3612a3a565b5060010190565b600082612af0577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b2d57612b2d612a3a565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561291057835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612b7d565b600082821015612bc157612bc1612a3a565b50039056fea164736f6c6343000809000a", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/contracts/p2pix.sol b/contracts/p2pix.sol index fb50051..cff8475 100644 --- a/contracts/p2pix.sol +++ b/contracts/p2pix.sol @@ -332,7 +332,7 @@ contract P2PIX is /// 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; - /// @param _relayerTarget Target address entitled to the `relayerPremim`. + /// @param _relayerTarget Target address entitled to the `relayerPremium`. /// @dev Function sighash: 0x4e1389ed. function release( uint256 lockID, @@ -852,17 +852,21 @@ contract P2PIX is ) external view - returns(uint256[] memory balances) + returns(uint256[] memory) { - if(address(token) == address(0x0)) - revert NoTokens(); - if(sellers.length == 0) - revert LengthMismatch(); - uint256 j; - uint256 len = sellers.length; - while (j < len) { balances[j] = - getBalance(sellers[j], token); + uint256 len = + sellers.length; + uint256[] memory balances = + new uint256[](len); + while (j < len) { + uint256 bal = + getBalance( + sellers[j], + token + ); + balances[j] = bal; + unchecked { ++j; } } return balances; diff --git a/deploys/goerli.json b/deploys/goerli.json index a4073bd..3857f9e 100644 --- a/deploys/goerli.json +++ b/deploys/goerli.json @@ -3,6 +3,6 @@ "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" ], - "p2pix": "0x2a54667b566B1Aa3779828720E6696AC18ae3f1b", + "p2pix": "0xefa5cE4351cda51192509cf8De7d8881ADAE95DD", "token": "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00" } \ No newline at end of file diff --git a/deploys/polygon-mumbai.json b/deploys/polygon-mumbai.json index 733a0da..6ea7d2a 100644 --- a/deploys/polygon-mumbai.json +++ b/deploys/polygon-mumbai.json @@ -3,6 +3,6 @@ "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" ], - "p2pix": "0x7F4680D114B43c4434FB604c7Bc6306125D32f28", + "p2pix": "0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b", "token": "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29" } \ No newline at end of file diff --git a/src/types/factories/p2pix.sol/P2PIX__factory.ts b/src/types/factories/p2pix.sol/P2PIX__factory.ts index e3d6536..66092be 100644 --- a/src/types/factories/p2pix.sol/P2PIX__factory.ts +++ b/src/types/factories/p2pix.sol/P2PIX__factory.ts @@ -572,7 +572,7 @@ const _abi = [ outputs: [ { internalType: "uint256[]", - name: "balances", + name: "", type: "uint256[]", }, ], @@ -1078,7 +1078,7 @@ const _abi = [ ]; const _bytecode = - "0x6080604052600180556040516200322a3803806200322a8339810160408190526200002a9162000493565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000616565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005b1565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005c7565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b90565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003ce57620003ce6200038d565b604052919050565b60006001600160401b03821115620003f257620003f26200038d565b5060051b60200190565b6001600160a01b03811681146200041257600080fd5b50565b600082601f8301126200042757600080fd5b81516020620004406200043a83620003d6565b620003a3565b82815260059290921b840181019181810190868411156200046057600080fd5b8286015b84811015620004885780516200047a81620003fc565b835291830191830162000464565b509695505050505050565b600080600080600060a08688031215620004ac57600080fd5b8551602080880151919650906001600160401b0380821115620004ce57600080fd5b620004dc8a838b0162000415565b965060408901519150620004f082620003fc565b6060890151919550808211156200050657600080fd5b620005148a838b0162000415565b945060808901519150808211156200052b57600080fd5b508701601f810189136200053e57600080fd5b80516200054f6200043a82620003d6565b81815260059190911b8201830190838101908b8311156200056f57600080fd5b928401925b828410156200059f57835180151581146200058f5760008081fd5b8252928401929084019062000574565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156200060a5783516001600160a01b031683529284019291840191600101620005e3565b50909695505050505050565b612c0480620006266000396000f3fe6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610215610203366004612406565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461248d565b6107be565b34801561025457600080fd5b50610268610263366004612674565b610b6d565b005b34801561027657600080fd5b506102686102853660046126b1565b610ca7565b34801561029657600080fd5b506102686102a53660046126ea565b610d98565b3480156102b657600080fd5b506103376102c5366004612406565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be366004612406565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe3660046126b1565b600c1b90565b34801561041057600080fd5b5061026861041f366004612406565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d36104543660046126b1565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461275d565b611151565b3480156104b157600080fd5b506102686104c0366004612792565b611268565b3480156104d157600080fd5b506102156104e0366004612406565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127f6565b611747565b34801561051e57600080fd5b506103d361052d366004612822565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d366004612406565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c366004612406565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461285b565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b50610573610674366004612822565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b4366004612880565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b506107066107013660046128c2565b611a50565b60405161021f9190612909565b34801561071f57600080fd5b5061021561072e366004612822565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461294d565b611b5b565b34801561078a57600080fd5b506102686107993660046126b1565b611c6b565b3480156107aa57600080fd5b506102686107b9366004612a0f565b611d37565b60006107c8611e33565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a9a565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a9a565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e77565b610a4e848c84848988611ecf565b60048054906000610a5e83612ab2565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611ecf565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aeb565b61202a565b9050610ad4670de0b6b3a764000082612b26565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611ecf565b60048054906000610b4783612ab2565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b63565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b92565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a9a565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e33565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a9a565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120e6565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b33826121b0565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e33565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612be0565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a9a565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a9a565b9091555061162b9050565b8187600201546116039190612a9a565b33600c1b60009081526007602052604081208054909190611625908490612a9a565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff168361222a565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c61222a565b6116c4838d60018a60020154901c61222a565b6116d8565b6116d8838d896002015461222a565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b63565b9050602002013581526020019081526020016000209050611851816122e9565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a9a565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a9a565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b63565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b606073ffffffffffffffffffffffffffffffffffffffff8216611a9f576040517fdf95788300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8251611ad7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82516000905b80821015611b5357611b30858381518110611afa57611afa612b63565b602090810291909101810151600c1b6000908152600b8252604080822088835290925220546b3fffffffffffffffffffffff1690565b838381518110611b4257611b42612b63565b602002602001018181525050611add565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bf15763df9578836000526004601cfd5b81518114611c075763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611c16565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d3f611e33565b611d49828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d7f57611d7f846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611dcd906b3fffffffffffffffffffffff16858784612365565b611dd885338661222a565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e70576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e9984848473ffffffffffffffffffffffffffffffffffffffff85166123c2565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611fbe86868484612365565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea659261201a92918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161204891815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120dd5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d11600160005114161716915060006060528060405250806121a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af1905080612225576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b4381600401541115612327576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612362576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123785763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152812080548592906123b7908490612be0565b909155505050505050565b600083156123fe578360051b8501855b803580851160051b948552602094851852604060002093018181106123f6576123fb565b6123d2565b50505b501492915050565b60006020828403121561241857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461236257600080fd5b60008083601f84011261245357600080fd5b50813567ffffffffffffffff81111561246b57600080fd5b6020830191508360208260051b850101111561248657600080fd5b9250929050565b6000806000806000806000806000806101008b8d0312156124ad57600080fd5b8a356124b88161241f565b995060208b01356124c88161241f565b985060408b01356124d88161241f565b975060608b01356124e88161241f565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff8082111561251357600080fd5b61251f8e838f01612441565b909650945060e08d013591508082111561253857600080fd5b506125458d828e01612441565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125d4576125d461255e565b604052919050565b600067ffffffffffffffff8211156125f6576125f661255e565b5060051b60200190565b600082601f83011261261157600080fd5b81356020612626612621836125dc565b61258d565b82815260059290921b8401810191818101908684111561264557600080fd5b8286015b8481101561266957803561265c8161241f565b8352918301918301612649565b509695505050505050565b60006020828403121561268657600080fd5b813567ffffffffffffffff81111561269d57600080fd5b6126a984828501612600565b949350505050565b6000602082840312156126c357600080fd5b81356126ce8161241f565b9392505050565b803580151581146126e557600080fd5b919050565b600080600080600060a0868803121561270257600080fd5b853561270d8161241f565b945060208601356bffffffffffffffffffffffff8116811461272e57600080fd5b9350604086013561273e8161241f565b925061274c606087016126d5565b949793965091946080013592915050565b6000806040838503121561277057600080fd5b823561277b8161241f565b9150612789602084016126d5565b90509250929050565b60008060008060008060c087890312156127ab57600080fd5b8635955060208701356127bd8161241f565b945060408701359350606087013592506080870135915060a087013560ff811681146127e857600080fd5b809150509295509295509295565b6000806040838503121561280957600080fd5b82356128148161241f565b946020939093013593505050565b6000806040838503121561283557600080fd5b82356128408161241f565b915060208301356128508161241f565b809150509250929050565b6000806040838503121561286e57600080fd5b8235915060208301356128508161241f565b6000806020838503121561289357600080fd5b823567ffffffffffffffff8111156128aa57600080fd5b6128b685828601612441565b90969095509350505050565b600080604083850312156128d557600080fd5b823567ffffffffffffffff8111156128ec57600080fd5b6128f885828601612600565b92505060208301356128508161241f565b6020808252825182820181905260009190848201906040850190845b8181101561294157835183529284019291840191600101612925565b50909695505050505050565b6000806040838503121561296057600080fd5b823567ffffffffffffffff8082111561297857600080fd5b61298486838701612600565b935060209150818501358181111561299b57600080fd5b85019050601f810186136129ae57600080fd5b80356129bc612621826125dc565b81815260059190911b820183019083810190888311156129db57600080fd5b928401925b82841015612a00576129f1846126d5565b825292840192908401906129e0565b80955050505050509250929050565b60008060008060608587031215612a2557600080fd5b8435612a308161241f565b935060208501359250604085013567ffffffffffffffff811115612a5357600080fd5b612a5f87828801612441565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612aad57612aad612a6b565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ae457612ae4612a6b565b5060010190565b600082612b21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b5e57612b5e612a6b565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561294157835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612bae565b600082821015612bf257612bf2612a6b565b50039056fea164736f6c6343000809000a"; + "0x608060405260018055604051620031f9380380620031f98339810160408190526200002a9162000493565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000616565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005b1565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005c7565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b90565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003ce57620003ce6200038d565b604052919050565b60006001600160401b03821115620003f257620003f26200038d565b5060051b60200190565b6001600160a01b03811681146200041257600080fd5b50565b600082601f8301126200042757600080fd5b81516020620004406200043a83620003d6565b620003a3565b82815260059290921b840181019181810190868411156200046057600080fd5b8286015b84811015620004885780516200047a81620003fc565b835291830191830162000464565b509695505050505050565b600080600080600060a08688031215620004ac57600080fd5b8551602080880151919650906001600160401b0380821115620004ce57600080fd5b620004dc8a838b0162000415565b965060408901519150620004f082620003fc565b6060890151919550808211156200050657600080fd5b620005148a838b0162000415565b945060808901519150808211156200052b57600080fd5b508701601f810189136200053e57600080fd5b80516200054f6200043a82620003d6565b81815260059190911b8201830190838101908b8311156200056f57600080fd5b928401925b828410156200059f57835180151581146200058f5760008081fd5b8252928401929084019062000574565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156200060a5783516001600160a01b031683529284019291840191600101620005e3565b50909695505050505050565b612bd380620006266000396000f3fe6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102156102033660046123d5565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461245c565b6107be565b34801561025457600080fd5b50610268610263366004612643565b610b6d565b005b34801561027657600080fd5b50610268610285366004612680565b610ca7565b34801561029657600080fd5b506102686102a53660046126b9565b610d98565b3480156102b657600080fd5b506103376102c53660046123d5565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be3660046123d5565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe366004612680565b600c1b90565b34801561041057600080fd5b5061026861041f3660046123d5565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d3610454366004612680565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461272c565b611151565b3480156104b157600080fd5b506102686104c0366004612761565b611268565b3480156104d157600080fd5b506102156104e03660046123d5565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127c5565b611747565b34801561051e57600080fd5b506103d361052d3660046127f1565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d3660046123d5565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c3660046123d5565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461282a565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b506105736106743660046127f1565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b436600461284f565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b50610706610701366004612891565b611a50565b60405161021f91906128d8565b34801561071f57600080fd5b5061021561072e3660046127f1565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461291c565b611b2a565b34801561078a57600080fd5b50610268610799366004612680565b611c3a565b3480156107aa57600080fd5b506102686107b93660046129de565b611d06565b60006107c8611e02565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a69565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a69565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815250905089899050600014610a7057600083815260066020526040902054610a40908b908b9033611e46565b610a4e848c84848988611e9e565b60048054906000610a5e83612a81565b91905055508195505050505050610b56565b68056bc75e2d63100000816060015111610a9257610a4e848c84848988611e9e565b33600c1b60009081526007602052604081205490610ac0610abb670de0b6b3a764000084612aba565b611ff9565b9050610ad4670de0b6b3a764000082612af5565b83606001511180610af2575069d3c21bcecceda10000008360600151115b15610b29576040517f1c18f84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b37868e86868b8a611e9e565b60048054906000610b4783612a81565b90915550939750505050505050505b610b5f60018055565b9a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bf3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b80516000905b80821015610c6b576000610c26848481518110610c1857610c18612b32565b6020026020010151600c1b90565b600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155929092019150610bf9565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051610c9c9190612b61565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b8433600c1b73ffffffffffffffffffffffffffffffffffffffff8516610dea576040517f6a3bc53e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff16610e49576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546b3fffffffffffffffffffffff81166a52b7d2dcc80cd2e4000000610eac6bffffffffffffffffffffffff8a1683612a69565b1115610ee4576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eec611e02565b8415610efc57610efc3386611747565b87878760ff81901b605f83901b610f138587612a69565b6000898152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290209117919091179055610f648733306bffffffffffffffffffffffff8f166120b5565b610f6d60018055565b6040805173ffffffffffffffffffffffffffffffffffffffff8e1681526bffffffffffffffffffffffff8d16602082015233917f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf910160405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851181604051610c9c91815260200190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b4761111b338261217f565b60408051338152602081018390527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9101610c9c565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548015611230576000828152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8816808552908352928190207f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490941660ff87901b1793849055805192835285151591830191909152849133917fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d49910160405180910390a250611262565b6040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b611270611e02565b600086815260056020526040902060038101546112b9576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b43816004015410156112f7576040517ff6fafba000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005810154600382015460405160609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602083015260348201526054810186905260009060740160405160208183030381529060405280519060200120905060008160405160200161139a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000858152600990935291205490915060ff1615156001141561141f576040517ff490a6ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160008082526020820180845284905260ff87169282019290925260608101889052608081018790526114879060019060a0016020604051602081039080840390855afa158015611477573d6000803e3d6000fd5b50505060206040510351600c1b90565b60008181526008602052604090205490915060ff166114d2576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60098401546003850154600286015473ffffffffffffffffffffffffffffffffffffffff909216916000906115079083612baf565b6000600389018190556004890181905587815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560088801549091503373ffffffffffffffffffffffffffffffffffffffff909116146115f357600287015433600c1b60009081526007602052604081208054909190611599908490612a69565b9091555050600887015482906007906000906115cb9073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b815260200190815260200160002060008282546115e89190612a69565b9091555061162b9050565b8187600201546116039190612a69565b33600c1b60009081526007602052604081208054909190611625908490612a69565b90915550505b600687015461165290849073ffffffffffffffffffffffffffffffffffffffff16836121f9565b6002870154156116d857600787015473ffffffffffffffffffffffffffffffffffffffff8d81169116146116c957600787015460028801546116b191859173ffffffffffffffffffffffffffffffffffffffff9091169060011c6121f9565b6116c4838d60018a60020154901c6121f9565b6116d8565b6116d8838d89600201546121f9565b6006870154604080518f81526020810185905273ffffffffffffffffffffffffffffffffffffffff909216917f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8910160405180910390a25050505050505061173f60018055565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156117db57806006600061177485600c1b90565b8152602080820192909252604090810160002092909255815173ffffffffffffffffffffffffffffffffffffffff851681529081018390527f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632910160405180910390a15050565b6040517f85d1f72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815b80821015611a3a5760006005600086868681811061183157611831612b32565b9050602002013581526020019081526020016000209050611851816122b8565b80546000908152600b60209081526040808320600985015473ffffffffffffffffffffffffffffffffffffffff16845290915290205460038201546b3fffffffffffffffffffffff909116906a52b7d2dcc80cd2e4000000906118b49083612a69565b11156118ec576040517ff3fb0eb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600382015482546000908152600b60209081526040808320600987015473ffffffffffffffffffffffffffffffffffffffff16845290915281208054909190611936908490612a69565b909155505060006003830181905560088301546119699073ffffffffffffffffffffffffffffffffffffffff16600c1b90565b60008181526007602052604090205490915060011c68056bc75e2d6310000081116119ad57600082815260076020526040902068056bc75e2d6310000090556119bf565b60008281526007602052604090208190555b600684015473ffffffffffffffffffffffffffffffffffffffff167f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da5898989818110611a0d57611a0d612b32565b90506020020135604051611a2391815260200190565b60405180910390a285600101955050505050611811565b808210156112625763dfb035c96000526004601cfd5b8151606090600090818167ffffffffffffffff811115611a7257611a7261252d565b604051908082528060200260200182016040528015611a9b578160200160208202803683370190505b5090505b81831015611b21576000611af4878581518110611abe57611abe612b32565b602090810291909101810151600c1b6000908152600b825260408082208a835290925220546b3fffffffffffffffffffffff1690565b905080828581518110611b0957611b09612b32565b60200260200101818152505083600101935050611a9f565b95945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611bab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b815180611bc05763df9578836000526004601cfd5b81518114611bd65763ff633a386000526004601cfd5b60208301602083018260051b82015b80831461173f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a3602083019250602082019150611be5565b60005473ffffffffffffffffffffffffffffffffffffffff163314611cbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610bea565b600281905560405173ffffffffffffffffffffffffffffffffffffffff821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f90602001610c9c565b611d0e611e02565b611d18828261180d565b33600c1b6000908152600b6020908152604080832087845290915290205460ff1c151560011415611d4e57611d4e846000611151565b33600c1b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff89168452909152902054611d9c906b3fffffffffffffffffffffff16858784612334565b611da78533866121f9565b6040805173ffffffffffffffffffffffffffffffffffffffff871681526020810186905233917f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e910160405180910390a25061126260018055565b60015460021415611e3f576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600155565b611e6884848473ffffffffffffffffffffffffffffffffffffffff8516612391565b611262576040517f3b8474be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526005602081815260409283902086518155908601516001820155918501516002830155606085015160038301556080850151600483015560a085015190820180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560c0860151600684018054831691841691909117905560e0860151600784018054831691841691909117905561010086015160088401805483169184169190911790556101208601516009909301805490911692909116919091179055611f8d86868484612334565b60c083015183516060850151604051879373ffffffffffffffffffffffffffffffffffffffff16927f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea6592611fe992918252602082015260400190565b60405180910390a3505050505050565b600080634d2b179160e01b8360405160240161201791815260200190565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600080600060206000855160208701600254617530fa92503d91506000519050809450826120ac5763e10bf1cc6000526004601cfd5b50505050919050565b60006040517f23b872dd000000000000000000000000000000000000000000000000000000006000528460045283602452826044526020600060646000808a5af13d15601f3d1160016000511416171691506000606052806040525080612178576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610bea565b5050505050565b600080600080600085875af19050806121f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610bea565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000006000528360045282602452602060006044600080895af13d15601f3d1160016000511416171691506000606052806040525080611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610bea565b43816004015411156122f6576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003810154612331576040517f63b4904e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b836123475763ce3a3d376000526004601cfd5b6000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281208054859290612386908490612baf565b909155505050505050565b600083156123cd578360051b8501855b803580851160051b948552602094851852604060002093018181106123c5576123ca565b6123a1565b50505b501492915050565b6000602082840312156123e757600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461233157600080fd5b60008083601f84011261242257600080fd5b50813567ffffffffffffffff81111561243a57600080fd5b6020830191508360208260051b850101111561245557600080fd5b9250929050565b6000806000806000806000806000806101008b8d03121561247c57600080fd5b8a35612487816123ee565b995060208b0135612497816123ee565b985060408b01356124a7816123ee565b975060608b01356124b7816123ee565b965060808b0135955060a08b0135945060c08b013567ffffffffffffffff808211156124e257600080fd5b6124ee8e838f01612410565b909650945060e08d013591508082111561250757600080fd5b506125148d828e01612410565b915080935050809150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156125a3576125a361252d565b604052919050565b600067ffffffffffffffff8211156125c5576125c561252d565b5060051b60200190565b600082601f8301126125e057600080fd5b813560206125f56125f0836125ab565b61255c565b82815260059290921b8401810191818101908684111561261457600080fd5b8286015b8481101561263857803561262b816123ee565b8352918301918301612618565b509695505050505050565b60006020828403121561265557600080fd5b813567ffffffffffffffff81111561266c57600080fd5b612678848285016125cf565b949350505050565b60006020828403121561269257600080fd5b813561269d816123ee565b9392505050565b803580151581146126b457600080fd5b919050565b600080600080600060a086880312156126d157600080fd5b85356126dc816123ee565b945060208601356bffffffffffffffffffffffff811681146126fd57600080fd5b9350604086013561270d816123ee565b925061271b606087016126a4565b949793965091946080013592915050565b6000806040838503121561273f57600080fd5b823561274a816123ee565b9150612758602084016126a4565b90509250929050565b60008060008060008060c0878903121561277a57600080fd5b86359550602087013561278c816123ee565b945060408701359350606087013592506080870135915060a087013560ff811681146127b757600080fd5b809150509295509295509295565b600080604083850312156127d857600080fd5b82356127e3816123ee565b946020939093013593505050565b6000806040838503121561280457600080fd5b823561280f816123ee565b9150602083013561281f816123ee565b809150509250929050565b6000806040838503121561283d57600080fd5b82359150602083013561281f816123ee565b6000806020838503121561286257600080fd5b823567ffffffffffffffff81111561287957600080fd5b61288585828601612410565b90969095509350505050565b600080604083850312156128a457600080fd5b823567ffffffffffffffff8111156128bb57600080fd5b6128c7858286016125cf565b925050602083013561281f816123ee565b6020808252825182820181905260009190848201906040850190845b81811015612910578351835292840192918401916001016128f4565b50909695505050505050565b6000806040838503121561292f57600080fd5b823567ffffffffffffffff8082111561294757600080fd5b612953868387016125cf565b935060209150818501358181111561296a57600080fd5b85019050601f8101861361297d57600080fd5b803561298b6125f0826125ab565b81815260059190911b820183019083810190888311156129aa57600080fd5b928401925b828410156129cf576129c0846126a4565b825292840192908401906129af565b80955050505050509250929050565b600080600080606085870312156129f457600080fd5b84356129ff816123ee565b935060208501359250604085013567ffffffffffffffff811115612a2257600080fd5b612a2e87828801612410565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612a7c57612a7c612a3a565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ab357612ab3612a3a565b5060010190565b600082612af0577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b2d57612b2d612a3a565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561291057835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612b7d565b600082821015612bc157612bc1612a3a565b50039056fea164736f6c6343000809000a"; type P2PIXConstructorParams = | [signer?: Signer] diff --git a/src/types/p2pix.sol/P2PIX.ts b/src/types/p2pix.sol/P2PIX.ts index 27cedde..29276a1 100644 --- a/src/types/p2pix.sol/P2PIX.ts +++ b/src/types/p2pix.sol/P2PIX.ts @@ -575,7 +575,7 @@ export interface P2PIX extends BaseContract { sellers: PromiseOrValue[], token: PromiseOrValue, overrides?: CallOverrides - ): Promise<[BigNumber[]] & { balances: BigNumber[] }>; + ): Promise<[BigNumber[]]>; getPixTarget( seller: PromiseOrValue, diff --git a/test/p2pix.test.ts b/test/p2pix.test.ts index 0e648f7..53c95c8 100644 --- a/test/p2pix.test.ts +++ b/test/p2pix.test.ts @@ -284,7 +284,6 @@ describe("P2PIX", () => { ); }); it("should revert if pixTarget is empty", async () => { - // const pTarget = ethers.BigNumber.from(7331); const root = ethers.utils.keccak256( ethers.utils.toUtf8Bytes("root"), ); @@ -338,6 +337,10 @@ describe("P2PIX", () => { owner.address, ); const allowList = await p2pix.sellerAllowList(ownerKey); + const balances = await p2pix.callStatic.getBalances( + [owner.address, acc01.address], + erc20.address, + ); expect(tx).to.be.ok; await expect(tx) @@ -352,6 +355,8 @@ describe("P2PIX", () => { expect(pixTarget).to.eq(pTarget); expect(valid).to.eq(true); expect(allowList).to.eq(root); + expect(balances[0]).to.eq(price); + expect(balances[1]).to.eq(zero); }); // edge case test it("should create multiple deposits", async () => { @@ -380,6 +385,7 @@ describe("P2PIX", () => { const price2 = price.mul(ethers.BigNumber.from(2)); const price3 = price.mul(ethers.BigNumber.from(3)); const price4 = price.mul(ethers.BigNumber.from(4)); + const prices:BigNumber[] = [price, price2, price3, price4]; await erc20.mint( getSignerAddrs(4, await ethers.getSigners()), price4, @@ -410,6 +416,9 @@ describe("P2PIX", () => { .connect(acc03) .deposit(erc20.address, price4, pTarget, false, nullRoot); + const balances = await p2pix.callStatic.getBalances( + [owner.address, acc01.address, acc02.address, acc03.address], erc20.address); + const storage1 = await p2pix.callStatic.getBalance(owner.address, erc20.address); const storage2 = await p2pix.callStatic.getBalance(acc01.address, erc20.address); const storage3 = await p2pix.callStatic.getBalance(acc02.address, erc20.address); @@ -478,6 +487,11 @@ describe("P2PIX", () => { [acc03.address, p2pix.address], ["-400000000000000000000", price4], ); + + expect(prices[0]).to.eq(balances[0]); + expect(prices[1]).to.eq(balances[1]); + expect(prices[2]).to.eq(balances[2]); + expect(prices[3]).to.eq(balances[3]); expect(storage1).to.eq(price); expect(pixTarget1).to.eq(pTarget); @@ -685,35 +699,35 @@ describe("P2PIX", () => { proof, [], ); - // const storage: Lock = await p2pix.callStatic.mapLocks(1); + const storage: Lock = await p2pix.callStatic.mapLocks(1); - // const rc: ContractReceipt = await tx.wait(); - // const expiration = rc.blockNumber + 10; - // const key = await p2pix.callStatic._castAddrToKey(owner.address); + const rc: ContractReceipt = await tx.wait(); + const expiration = rc.blockNumber + 10; + const key = await p2pix.callStatic._castAddrToKey(owner.address); - // await expect(tx) - // .to.emit(p2pix, "LockAdded") - // .withArgs( - // acc02.address, - // ethers.constants.One, - // key, - // price, - // ); - // expect(tx).to.be.ok; - // expect(storage.sellerKey).to.eq(key); - // expect(storage.counter).to.eq(1); - // expect(storage.relayerPremium).to.eq( - // ethers.constants.Zero, - // ); - // expect(storage.amount).to.eq(price); - // expect(storage.expirationBlock).to.eq(expiration); - // expect(storage.pixTarget).to.eq(target); - // expect(storage.buyerAddress).to.eq(acc02.address); - // expect(storage.relayerTarget).to.eq(acc03.address); - // expect(storage.relayerAddress).to.eq(acc01.address); - // expect(storage.token).to.eq(erc20.address); + await expect(tx) + .to.emit(p2pix, "LockAdded") + .withArgs( + acc02.address, + ethers.constants.One, + key, + price, + ); + expect(tx).to.be.ok; + expect(storage.sellerKey).to.eq(key); + expect(storage.counter).to.eq(1); + expect(storage.relayerPremium).to.eq( + ethers.constants.Zero, + ); + expect(storage.amount).to.eq(price); + expect(storage.expirationBlock).to.eq(expiration); + expect(storage.pixTarget).to.eq(target); + expect(storage.buyerAddress).to.eq(acc02.address); + expect(storage.relayerTarget).to.eq(acc03.address); + expect(storage.relayerAddress).to.eq(acc01.address); + expect(storage.token).to.eq(erc20.address); }); - it("should create a lock, update storage and emit events via the reputation path", async () => { + it("should create a lock, update storage and emit events via the reputation path 1", async () => { const root = ethers.constants.HashZero; const target = ethers.BigNumber.from(101); await erc20.approve(p2pix.address, price); @@ -741,8 +755,10 @@ describe("P2PIX", () => { const rc: ContractReceipt = await tx.wait(); const expiration = rc.blockNumber + 10; const key = await p2pix.callStatic._castAddrToKey(owner.address); + const castBack = await p2pix.callStatic._castKeyToAddr(key); expect(tx).to.be.ok; + expect(castBack).to.eq(owner.address); expect(storage.sellerKey).to.eq(key); expect(storage.counter).to.eq(1); expect(storage.relayerPremium).to.eq( @@ -765,6 +781,94 @@ describe("P2PIX", () => { storage.amount, ); }); + it("should create a lock, update storage and emit events via the reputation path 2", async () => { + const root = ethers.constants.HashZero; + const newPrice = price.mul(ethers.constants.Two).add(ethers.constants.One); + const endtoendID = ethers.constants.HashZero; + const target = ethers.BigNumber.from(101); + const messageToSign = ethers.utils.solidityKeccak256( + ["uint160", "uint256", "bytes32"], + [target, price, endtoendID], + ); + const messageHashBytes = + ethers.utils.arrayify(messageToSign); + const flatSig = await acc01.signMessage( + messageHashBytes, + ); + const sig = ethers.utils.splitSignature(flatSig); + await erc20.approve(p2pix.address, newPrice); + await p2pix.deposit( + erc20.address, + newPrice, + target, + true, + root, + ); + await p2pix + .connect(acc01) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + price, + price, + [], + [], + ); + await p2pix + .connect(acc01) + .release( + 1, + acc02.address, + endtoendID, + sig.r, + sig.s, + sig.v, + ); + const tx = await p2pix + .connect(acc01) + .lock( + owner.address, + erc20.address, + acc02.address, + acc03.address, + 0, + price.add(ethers.constants.One), + [], + [], + ); + const storage: Lock = await p2pix.callStatic.mapLocks(2); + + const rc: ContractReceipt = await tx.wait(); + const expiration = rc.blockNumber + 10; + const key = await p2pix.callStatic._castAddrToKey(owner.address); + const castBack = await p2pix.callStatic._castKeyToAddr(key); + + expect(tx).to.be.ok; + expect(castBack).to.eq(owner.address); + expect(storage.sellerKey).to.eq(key); + expect(storage.counter).to.eq(2); + expect(storage.relayerPremium).to.eq( + ethers.constants.Zero, + ); + expect(storage.amount).to.eq(price.add(ethers.constants.One)); + expect(storage.expirationBlock).to.eq(expiration); + expect(storage.pixTarget).to.eq(target); + expect(storage.buyerAddress).to.eq(acc02.address); + expect(storage.relayerTarget).to.eq(acc03.address); + expect(storage.relayerAddress).to.eq(acc01.address); + expect(storage.token).to.eq(erc20.address); + + await expect(tx) + .to.emit(p2pix, "LockAdded") + .withArgs( + acc02.address, + 2, + key, + storage.amount, + ); + }); // edge case test it("should create multiple locks", async () => { const newPrice = price.div(ethers.BigNumber.from(2)); @@ -912,14 +1016,8 @@ describe("P2PIX", () => { }); describe("Set sellerBalance Valid State", async () => { it("should revert if sellerBalance hasn't been initialized", async () => { - // await erc20.approve(p2pix.address, price); - // await p2pix.deposit( - // erc20.address, - // price, - // "pixTarget", - // merkleRoot, - // ); const fail = p2pix.setValidState(erc20.address,false); + await expect(fail).to.be.revertedWithCustomError( p2pix, P2PixErrors.NotInitialized,