From 26a495246e5db68446024e9b39684f905a68a73b Mon Sep 17 00:00:00 2001 From: PedroCailleret Date: Mon, 22 May 2023 06:40:53 -0300 Subject: [PATCH] Moved stack allocation from memory to calldata --- .solcover.js | 13 +- .../Reputation.sol/Reputation.dbg.json | 2 +- .../core/BaseUtils.sol/BaseUtils.dbg.json | 2 +- .../core/BaseUtils.sol/BaseUtils.json | 8 +- .../core/Constants.sol/Constants.dbg.json | 2 +- .../core/DataTypes.sol/DataTypes.dbg.json | 2 +- .../core/DataTypes.sol/DataTypes.json | 4 +- .../EventAndErrors.dbg.json | 2 +- .../EventAndErrors.sol/EventAndErrors.json | 4 +- .../OwnerSettings.sol/OwnerSettings.dbg.json | 2 +- .../core/OwnerSettings.sol/OwnerSettings.json | 8 +- .../lib/auth/Owned.sol/Owned.dbg.json | 2 +- .../IReputation.sol/IReputation.dbg.json | 2 +- .../ERC2771Context.sol/Context.dbg.json | 2 +- .../ERC2771Context.dbg.json | 2 +- .../lib/mock/mockToken.sol/MockToken.dbg.json | 2 +- .../lib/tokens/ERC20.sol/ERC20.dbg.json | 2 +- .../lib/utils/ECDSA.sol/ECDSA.dbg.json | 2 +- .../MerkleProofLib.dbg.json | 2 +- .../utils/Multicall.sol/Multicall.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 | 128 +-- contracts/core/BaseUtils.sol | 28 +- contracts/core/DataTypes.sol | 20 +- contracts/core/EventAndErrors.sol | 2 +- contracts/core/OwnerSettings.sol | 18 +- contracts/p2pix.sol | 151 ++-- scripts/1-deploy-mockToken.ts | 2 +- scripts/2-deploy-p2pix.ts | 2 +- scripts/setDefaultBlocks.ts | 2 +- src/types/core/BaseUtils.ts | 22 +- src/types/core/EventAndErrors.ts | 8 +- src/types/core/OwnerSettings.ts | 22 +- .../factories/core/BaseUtils__factory.ts | 8 +- .../factories/core/EventAndErrors__factory.ts | 4 +- .../factories/core/OwnerSettings__factory.ts | 8 +- .../factories/p2pix.sol/P2PIX__factory.ts | 126 +-- src/types/p2pix.sol/P2PIX.ts | 160 ++-- test/p2pix.test.ts | 843 +++++++++--------- test/utils/fixtures.ts | 61 +- test/utils/interfaces.ts | 71 ++ 43 files changed, 933 insertions(+), 826 deletions(-) create mode 100644 test/utils/interfaces.ts diff --git a/.solcover.js b/.solcover.js index d71a669..4cc0d29 100644 --- a/.solcover.js +++ b/.solcover.js @@ -1,7 +1,18 @@ module.exports = { + configureYulOptimizer: true, + solcOptimizerDetails: { + deduplicate: true, + cse: true, + constantOptimizer: true, + peephole: true, + jumpdestRemover: true, + yul: true, + // inliner: false, + // orderLiterals: true, + }, istanbulReporter: ["html", "lcov"], providerOptions: { mnemonic: process.env.MNEMONIC, }, - skipFiles: ["test"], + skipFiles: ["test", 'core/BaseUtils.sol', 'core/OwnerSettings.sol'], }; diff --git a/artifacts/contracts/Reputation.sol/Reputation.dbg.json b/artifacts/contracts/Reputation.sol/Reputation.dbg.json index 7881f4e..d0e0ae8 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/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/core/BaseUtils.sol/BaseUtils.dbg.json b/artifacts/contracts/core/BaseUtils.sol/BaseUtils.dbg.json index 8bb0302..9772ad4 100644 --- a/artifacts/contracts/core/BaseUtils.sol/BaseUtils.dbg.json +++ b/artifacts/contracts/core/BaseUtils.sol/BaseUtils.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/f220dbc6fa6f1dbf5c2cb562d65f0725.json" + "buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/core/BaseUtils.sol/BaseUtils.json b/artifacts/contracts/core/BaseUtils.sol/BaseUtils.json index 6cd6c4c..2dfd1fd 100644 --- a/artifacts/contracts/core/BaseUtils.sol/BaseUtils.json +++ b/artifacts/contracts/core/BaseUtils.sol/BaseUtils.json @@ -213,9 +213,9 @@ }, { "indexed": false, - "internalType": "uint256", + "internalType": "address", "name": "seller", - "type": "uint256" + "type": "address" }, { "indexed": false, @@ -529,9 +529,9 @@ { "inputs": [ { - "internalType": "uint256", + "internalType": "address", "name": "sellerKey", - "type": "uint256" + "type": "address" } ], "name": "sellerAllowList", diff --git a/artifacts/contracts/core/Constants.sol/Constants.dbg.json b/artifacts/contracts/core/Constants.sol/Constants.dbg.json index 59faafd..9772ad4 100644 --- a/artifacts/contracts/core/Constants.sol/Constants.dbg.json +++ b/artifacts/contracts/core/Constants.sol/Constants.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/core/DataTypes.sol/DataTypes.dbg.json b/artifacts/contracts/core/DataTypes.sol/DataTypes.dbg.json index 59faafd..9772ad4 100644 --- a/artifacts/contracts/core/DataTypes.sol/DataTypes.dbg.json +++ b/artifacts/contracts/core/DataTypes.sol/DataTypes.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/core/DataTypes.sol/DataTypes.json b/artifacts/contracts/core/DataTypes.sol/DataTypes.json index 2ee0216..cf6a67f 100644 --- a/artifacts/contracts/core/DataTypes.sol/DataTypes.json +++ b/artifacts/contracts/core/DataTypes.sol/DataTypes.json @@ -3,8 +3,8 @@ "contractName": "DataTypes", "sourceName": "contracts/core/DataTypes.sol", "abi": [], - "bytecode": "0x60808060405234601757603a9081601d823930815050f35b600080fdfe600080fdfea2646970667358221220a40e6f94f4c0b9a9cdd9ac64f98613aece8f5a3f084ee1eca35eba466df9810964736f6c63430008130033", - "deployedBytecode": "0x600080fdfea2646970667358221220a40e6f94f4c0b9a9cdd9ac64f98613aece8f5a3f084ee1eca35eba466df9810964736f6c63430008130033", + "bytecode": "0x60808060405234601757603a9081601d823930815050f35b600080fdfe600080fdfea26469706673582212201904685203adfcebeda9a1444d5381c24a37e2895e8a7dff26bd8d5af2fafcbc64736f6c63430008130033", + "deployedBytecode": "0x600080fdfea26469706673582212201904685203adfcebeda9a1444d5381c24a37e2895e8a7dff26bd8d5af2fafcbc64736f6c63430008130033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/artifacts/contracts/core/EventAndErrors.sol/EventAndErrors.dbg.json b/artifacts/contracts/core/EventAndErrors.sol/EventAndErrors.dbg.json index 59faafd..9772ad4 100644 --- a/artifacts/contracts/core/EventAndErrors.sol/EventAndErrors.dbg.json +++ b/artifacts/contracts/core/EventAndErrors.sol/EventAndErrors.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/core/EventAndErrors.sol/EventAndErrors.json b/artifacts/contracts/core/EventAndErrors.sol/EventAndErrors.json index 68d67ee..87a4026 100644 --- a/artifacts/contracts/core/EventAndErrors.sol/EventAndErrors.json +++ b/artifacts/contracts/core/EventAndErrors.sol/EventAndErrors.json @@ -203,9 +203,9 @@ }, { "indexed": false, - "internalType": "uint256", + "internalType": "address", "name": "seller", - "type": "uint256" + "type": "address" }, { "indexed": false, diff --git a/artifacts/contracts/core/OwnerSettings.sol/OwnerSettings.dbg.json b/artifacts/contracts/core/OwnerSettings.sol/OwnerSettings.dbg.json index 59faafd..9772ad4 100644 --- a/artifacts/contracts/core/OwnerSettings.sol/OwnerSettings.dbg.json +++ b/artifacts/contracts/core/OwnerSettings.sol/OwnerSettings.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../build-info/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/core/OwnerSettings.sol/OwnerSettings.json b/artifacts/contracts/core/OwnerSettings.sol/OwnerSettings.json index 6363826..c2f7392 100644 --- a/artifacts/contracts/core/OwnerSettings.sol/OwnerSettings.json +++ b/artifacts/contracts/core/OwnerSettings.sol/OwnerSettings.json @@ -208,9 +208,9 @@ }, { "indexed": false, - "internalType": "uint256", + "internalType": "address", "name": "seller", - "type": "uint256" + "type": "address" }, { "indexed": false, @@ -467,9 +467,9 @@ { "inputs": [ { - "internalType": "uint256", + "internalType": "address", "name": "sellerKey", - "type": "uint256" + "type": "address" } ], "name": "sellerAllowList", diff --git a/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json b/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json index 6ad2ef2..83d0a56 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/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json b/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json index 6ad2ef2..83d0a56 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/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/metatx/ERC2771Context.sol/Context.dbg.json b/artifacts/contracts/lib/metatx/ERC2771Context.sol/Context.dbg.json index 6ad2ef2..83d0a56 100644 --- a/artifacts/contracts/lib/metatx/ERC2771Context.sol/Context.dbg.json +++ b/artifacts/contracts/lib/metatx/ERC2771Context.sol/Context.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/metatx/ERC2771Context.sol/ERC2771Context.dbg.json b/artifacts/contracts/lib/metatx/ERC2771Context.sol/ERC2771Context.dbg.json index 6ad2ef2..83d0a56 100644 --- a/artifacts/contracts/lib/metatx/ERC2771Context.sol/ERC2771Context.dbg.json +++ b/artifacts/contracts/lib/metatx/ERC2771Context.sol/ERC2771Context.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json index 6ad2ef2..83d0a56 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/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json b/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json index 6ad2ef2..83d0a56 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/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/utils/ECDSA.sol/ECDSA.dbg.json b/artifacts/contracts/lib/utils/ECDSA.sol/ECDSA.dbg.json index 6ad2ef2..83d0a56 100644 --- a/artifacts/contracts/lib/utils/ECDSA.sol/ECDSA.dbg.json +++ b/artifacts/contracts/lib/utils/ECDSA.sol/ECDSA.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json b/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json index 6ad2ef2..83d0a56 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/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/utils/Multicall.sol/Multicall.dbg.json b/artifacts/contracts/lib/utils/Multicall.sol/Multicall.dbg.json index 6ad2ef2..83d0a56 100644 --- a/artifacts/contracts/lib/utils/Multicall.sol/Multicall.dbg.json +++ b/artifacts/contracts/lib/utils/Multicall.sol/Multicall.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json b/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json index 6ad2ef2..83d0a56 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/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json b/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json index 6ad2ef2..83d0a56 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/cd64a64b3749ac90866585a6471cc921.json" + "buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.dbg.json b/artifacts/contracts/p2pix.sol/P2PIX.dbg.json index cbd2800..d0e0ae8 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/f220dbc6fa6f1dbf5c2cb562d65f0725.json" + "buildInfo": "../../build-info/3d12978eb8a70621f317c36179381ad8.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.json b/artifacts/contracts/p2pix.sol/P2PIX.json index 292ddc4..e6f953d 100644 --- a/artifacts/contracts/p2pix.sol/P2PIX.json +++ b/artifacts/contracts/p2pix.sol/P2PIX.json @@ -244,9 +244,9 @@ }, { "indexed": false, - "internalType": "uint256", + "internalType": "address", "name": "seller", - "type": "uint256" + "type": "address" }, { "indexed": false, @@ -496,29 +496,36 @@ { "inputs": [ { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_amount", - "type": "uint96" - }, - { - "internalType": "string", - "name": "_pixTarget", - "type": "string" - }, - { - "internalType": "bool", - "name": "_valid", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "allowlistRoot", - "type": "bytes32" + "components": [ + { + "internalType": "string", + "name": "pixTarget", + "type": "string" + }, + { + "internalType": "bytes32", + "name": "allowlistRoot", + "type": "bytes32" + }, + { + "internalType": "contract ERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + }, + { + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "internalType": "struct DataTypes.DepositArgs", + "name": "args", + "type": "tuple" } ], "name": "deposit", @@ -711,29 +718,36 @@ { "inputs": [ { - "internalType": "address", - "name": "_seller", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint80", - "name": "_amount", - "type": "uint80" - }, - { - "internalType": "bytes32[]", - "name": "merkleProof", - "type": "bytes32[]" - }, - { - "internalType": "uint256[]", - "name": "expiredLocks", - "type": "uint256[]" + "components": [ + { + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "internalType": "contract ERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint80", + "name": "amount", + "type": "uint80" + }, + { + "internalType": "bytes32[]", + "name": "merkleProof", + "type": "bytes32[]" + }, + { + "internalType": "uint256[]", + "name": "expiredLocks", + "type": "uint256[]" + } + ], + "internalType": "struct DataTypes.LockArgs", + "name": "args", + "type": "tuple" } ], "name": "lock", @@ -770,11 +784,6 @@ ], "name": "mapLocks", "outputs": [ - { - "internalType": "uint256", - "name": "sellerKey", - "type": "uint256" - }, { "internalType": "uint256", "name": "counter", @@ -804,6 +813,11 @@ "internalType": "address", "name": "buyerAddress", "type": "address" + }, + { + "internalType": "address", + "name": "seller", + "type": "address" } ], "stateMutability": "view", @@ -871,9 +885,9 @@ { "inputs": [ { - "internalType": "uint256", + "internalType": "address", "name": "sellerKey", - "type": "uint256" + "type": "address" } ], "name": "sellerAllowList", @@ -1116,8 +1130,8 @@ "type": "receive" } ], - "bytecode": "0x608060405262002c0a80380380620000178162000126565b928339810160a0828203126200010b5781516020808401519093916001600160401b03918281116200010b5784620000519185016200017f565b9062000060604085016200016a565b9260608501518181116200010b57866200007c9187016200017f565b9460808101519182116200010b57019480601f870112156200010b578551620000af620000a98262000152565b62000126565b96888089848152019260051b8201019283116200010b578801905b828210620000f157505050620000e19550620001e6565b6040516127c89081620004428239f35b815180151581036200010b578152908801908801620000ca565b600080fd5b634e487b7160e01b600052604160045260246000fd5b6040519190601f01601f191682016001600160401b038111838210176200014c57604052565b62000110565b6001600160401b0381116200014c5760051b60200190565b51906001600160a01b03821682036200010b57565b9080601f830112156200010b578151906200019e620000a98362000152565b9182938184526020808095019260051b8201019283116200010b578301905b828210620001cc575050505090565b838091620001da846200016a565b815201910190620001bd565b600080546001600160a01b031916339081178255929695949392817f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768180a3816003556040519182527f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851160208093a18651878301979060051b810183013d1515895b811562000306575b5050506040519280840191818552518092526040840198925b828110620002e85750505050907f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d782620002d593620002db97980390a16001600160a01b031662000337565b62000390565b620002e66001600455565b565b83516001600160a01b03168a52988101989281019260010162000289565b9085826001829697989451600c1b550190838210156200032c5791509493929462000268565b509493929462000270565b6000546001600160a01b0390811633036200037f57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1565b6040516282b42960e81b8152600490fd5b60008054919290916001600160a01b031633036200037f5782519182156200043457815183036200042757602092919284818080970195019360051b0101925b838103620003df575050505050565b84809181600c63cbc9d1c48152825186528651918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8680a301920191620003d0565b63ff633a3890526004601cfd5b63df95788390526004601cfdfe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806304937320146102365780630d2a2d441461023157806313af40351461022c578063367821f014610227578063461f3120146101d757806349ef8448146102225780634b2ae9801461021d578063572b6c0514610218578063574983c8146102135780635fd8c7101461020e57806369cc6af4146102095780636d82d9e01461020457806377cd38a4146101ff5780637f94f65d146101fa57806380e1d302146101f557806384ab1d28146101f05780638da5cb5b146101eb5780638db564c2146101e6578063918dff57146101e15780639872dbfe146101dc57806398a26871146101d75780639b6d694d146101d2578063ad8f2eed146101cd578063b0983d39146101c8578063c52164c6146101c3578063c593dfd8146101be578063d1c07028146101b9578063d1ced2b0146101b4578063d4fac45d146101af578063d6e8b973146101aa578063dc43221c146101a5578063e449c52a146101a0578063f7d0e04b1461019b5763fb8c5ef00361000e57611532565b6114c2565b611487565b6113ec565b61133a565b611321565b611272565b61112c565b610dfb565b610dc7565b610d8d565b610d49565b610cd9565b6105eb565b610c46565b610bbb565b610b7a565b610b46565b610b10565b610af7565b610aa6565b610a6e565b610917565b6108ca565b610847565b6107e3565b610793565b610769565b6106ce565b610559565b6104c7565b61039a565b346102625760206003193601126102625760043560005260076020526020604060002054604051908152f35b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176102d757604052565b610267565b6040519060e0820182811067ffffffffffffffff8211176102d757604052565b67ffffffffffffffff81116102d75760051b60200190565b73ffffffffffffffffffffffffffffffffffffffff81160361026257565b81601f8201121561026257803591610349836102fc565b926103576040519485610296565b808452602092838086019260051b820101928311610262578301905b828210610381575050505090565b838091833561038f81610314565b815201910190610373565b34610262576020806003193601126102625760043567ffffffffffffffff8111610262576103cc903690600401610332565b9073ffffffffffffffffffffffffffffffffffffffff918260005416330361049d57805181830192849160051b830181013d1515855b8115610469575b50505060405192818401908285525180915260408401949160005b828110610453577f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d786880387a1005b8351851687529581019592810192600101610424565b90838260018298969499979951600c1b55019083821015610491579150959395949294610402565b50959395949294610409565b60046040517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576004356104e481610314565b600090815473ffffffffffffffffffffffffffffffffffffffff808216330361049d577fffffffffffffffffffffffff0000000000000000000000000000000000000000921691829116178255337f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768380a380f35b3461026257602060031936011261026257600435600052600660205260e060406000208054906005600182015491600281015460038201549060048301549273ffffffffffffffffffffffffffffffffffffffff9485910154169460405196875260208701526040860152606085015269ffffffffffffffffffff8116608085015260501c1660a083015260c0820152f35b34610262576020600319360112610262576020600435546040519015158152f35b90815180825260208080930193019160005b82811061062c575050505090565b83518552938101939281019260010161061e565b906106539060408352604083019061060c565b81810360209283015282518082529082019282019160009190825b82811061067d57505050505090565b909192939485516004808210156106a25750815282019482019392919060010161066e565b8660216024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b34610262576020806003193601126102625760043567ffffffffffffffff811161026257366023820112156102625780600401359061070c826102fc565b9161071a6040519384610296565b80835260248484019160051b8301019136831161026257602401905b82821061075a576107468461262e565b9061075660405192839283610640565b0390f35b81358152908401908401610736565b3461026257602060031936011261026257602060043561078881610314565b60405190600c1b8152f35b346102625760206003193601126102625773ffffffffffffffffffffffffffffffffffffffff6004356107c581610314565b166000526001602052602060ff604060002054166040519015158152f35b346102625760206003193601126102625760043573ffffffffffffffffffffffffffffffffffffffff60005416330361049d576020817f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851192600355604051908152a1005b34610262576000806003193601126108c75773ffffffffffffffffffffffffffffffffffffffff815416330361049d57478180808084335af1156108ba576040805133815260208101929092527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91a180f35b63b12d13eb82526004601cfd5b80fd5b346102625760206003193601126102625760206109006004356108ec81610314565b63cbc9d1c4600c526000526020600c205490565b6040519015158152f35b3590811515820361026257565b346102625760406003193601126102625760043561093481610314565b602435801515810361026257602082905263739094b1600c9081527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff331660005260349020600101548015610a44577fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4991610a3f918460205263739094b1600c527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff33166000526b3fffffffffffffffffffffff82605f1b91161760016034600c20015560405191829173ffffffffffffffffffffffffffffffffffffffff3396168390929160209073ffffffffffffffffffffffffffffffffffffffff60408401951683521515910152565b0390a2005b60046040517f87138d5c000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576020610a9e6004356374dfee70600c52600c1c60005260206000205490565b604051908152f35b3461026257604060031936011261026257610019600435610ac681610314565b60243590612221565b600319604091011261026257600435610ae781610314565b90602435610af481610314565b90565b34610262576020610900610b0a36610acf565b9061253c565b3461026257602060031936011261026257602060405173ffffffffffffffffffffffffffffffffffffffff600435600c1c168152f35b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b34610262576000600319360112610262576020600554604051908152f35b60005b838110610bab5750506000910152565b8181015183820152602001610b9b565b3461026257610bd2610bcc36610acf565b90612579565b604051906020820190815260208252604082019180831067ffffffffffffffff8411176102d7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60409385855260208652610c3d845180928160608801526080870190610b98565b01168101030190f35b34610262576000600319360112610262576020600354604051908152f35b81601f820112156102625780359067ffffffffffffffff82116102d75760405192610cb760207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8601160185610296565b8284526020838301011161026257816000926020809301838601378301015290565b346102625760a060031936011261026257600435610cf681610314565b602435906bffffffffffffffffffffffff821682036102625760443567ffffffffffffffff811161026257610d2f903690600401610c64565b6064359081151582036102625761001993608435936116cf565b34610262576020610a9e610bcc36610acf565b9181601f840112156102625782359167ffffffffffffffff8311610262576020808501948460051b01011161026257565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610dc1610019913690600401610d5c565b90612023565b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346102625760a06003193601126102625760043560843560ff8116810361026257610e246118c5565b610e38826000526006602052604060002090565b6004810180549169ffffffffffffffffffff83169283156110f15760028201805443116110c75784600584610f5d7f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8996000610fac96610f56610fdf9b610f2e89610ef2610f1e610fc69f6003015460405192839160208301956024359187917fffffffffffffffffffff0000000000000000000000000000000000000000000090604a9492845260b01b166020830152602a8201520190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610296565b5190209560643560443588611ea8565b7fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008154169055565b5560019055565b610f65611e33565b905015610ffa575b019273ffffffffffffffffffffffffffffffffffffffff610fa2855473ffffffffffffffffffffffffffffffffffffffff1690565b9160501c16611f96565b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b60408051948552602085019290925292a26100196001600455565b81810161101e610fc6825473ffffffffffffffffffffffffffffffffffffffff1690565b33146110a45761109d61109561108561107f697fffffffffffffffffff8a60011c169461105833600c1b6000526007602052604060002090565b6110638782546116c2565b90555473ffffffffffffffffffffffffffffffffffffffff1690565b600c1b90565b6000526007602052604060002090565b9182546116c2565b9055610f6d565b506110bc33600c1b6000526007602052604060002090565b61109d8482546116c2565b60046040517ff6fafba0000000000000000000000000000000000000000000000000000000008152fd5b60046040517f63b4904e000000000000000000000000000000000000000000000000000000008152fd5b906020610af492818152019061060c565b346102625760406003193601126102625760043567ffffffffffffffff81116102625761115d903690600401610332565b6024359061116a82610314565b600091815191611179836125cb565b935b8381106111905760405180610756878261111b565b806111bd8473ffffffffffffffffffffffffffffffffffffffff6111b66001958761261a565b5116612502565b6111c7828861261a565b520161117b565b9060406003198301126102625767ffffffffffffffff9160043583811161026257816111fc91600401610332565b92602435908111610262578160238201121561026257806004013591611221836102fc565b9261122f6040519485610296565b80845260209260248486019260051b82010192831161026257602401905b82821061125b575050505090565b8380916112678461090a565b81520191019061124d565b3461026257611280366111ce565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d57825190811561131f57805182036113125790602084818080970194019260051b0101915b8281036112d0578380f35b8480916001825280518652835180604088205581517fbee55516e29d3969d3cb8eb01351eb3c52d06f9e2435bd5a8bfe3647e185df928880a3019101906112c5565b63ff633a3883526004601cfd5bfe5b34610262576020610a9e61133436610acf565b90612502565b3461026257611348366111ce565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156113df57805182036113125790602084818080970194019260051b0101915b828103611398578380f35b84809181600c63cbc9d1c48152825188528551918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8880a30191019061138d565b63df95788383526004601cfd5b346102625760a06003193601126102625760043561140981610314565b6024359061141682610314565b6044359169ffffffffffffffffffff831683036102625767ffffffffffffffff916064358381116102625761144f903690600401610d5c565b90608435948511610262576107569561146f611477963690600401610d5c565b959094611a2f565b6040519081529081906020820190565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610a9e6114bd6020923690600401610c64565b61164a565b34610262576020600319360112610262576004356114df81610314565b73ffffffffffffffffffffffffffffffffffffffff8060005416330361049d57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1005b346102625760606003193601126102625760043561154f81610314565b60243560443567ffffffffffffffff8111610262577f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e916115a861159a611632933690600401610d5c565b906115a36118c5565b612023565b6115b2843361253c565b61163c575b6115f633600c1b85836b3fffffffffffffffffffffff6115f083859060205263739094b1600c52600c1c60005260016034600c20015490565b166124c3565b611601813386611f96565b6040805173ffffffffffffffffffffffffffffffffffffffff95909516855260208501919091523393918291820190565b0390a26001600455005b61164584611959565b6115b7565b604051611674602082816116678183019687815193849201610b98565b8101038084520182610296565b5160201061131f575190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b90600182018092116116bd57565b611680565b919082018092116116bd57565b939273ffffffffffffffffffffffffffffffffffffffff85169333600c1b9484511561189b576117146117108263cbc9d1c4600c526000526020600c205490565b1590565b611871576b3fffffffffffffffffffffff61174882889060205263739094b1600c52600c1c60005260016034600c20015490565b16916117636bffffffffffffffffffffffff861680946116c2565b936a52b7d2dcc80cd2e40000008511611847577f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf97836117eb966117bc6118329a6117e2966117b06118c5565b80611837575b5061164a565b93605f1b17919060205263739094b1600c52600c1c6000526034600c2090600182015555565b30903390611900565b6117f56001600455565b6040805173ffffffffffffffffffffffffffffffffffffffff90951685526bffffffffffffffffffffffff90911660208501523393918291820190565b0390a2565b6118419033612221565b386117b6565b60046040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1578328e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6a3bc53e000000000000000000000000000000000000000000000000000000008152fd5b6002600454146118d6576002600455565b60046040517fab143c06000000000000000000000000000000000000000000000000000000008152fd5b601c600060649281946020966040519860605260405260601b602c526f23b872dd000000000000000000000000600c525af13d1560016000511417161561194b576000606052604052565b637939f4246000526004601cfd5b602081905263739094b1600c9081527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff331660005260349020600101548015610a44576b3fffffffffffffffffffffff908260205263739094b1600c527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff33166000521660016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405191168152600060208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2565b9295611a559073ffffffffffffffffffffffffffffffffffffffff9395966115a36118c5565b1691611a64611710848461253c565b611ce557611a728383612502565b9469ffffffffffffffffffff80831691828810611cbb5784600c1b96611a996005546116af565b946002611ab0876000526006602052604060002090565b0154431115611c9157611ac1611e33565b611ada8a611ad4600398949854436116c2565b9a612579565b611ae26102dc565b998c8b528960208c015260408b015260608a0152611b1060808a0193849069ffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8a1660a08a015273ffffffffffffffffffffffffffffffffffffffff861660c08a01528315611b8e5750505091611b7c91611b819993611b768a6374dfee70600c52600c1c60005260206000205490565b91611d2c565b6122bf565b90611b8c6001600455565b565b9250819450809350611bb468056bc75e2d63100000925169ffffffffffffffffffff1690565b1611611bcb57505050611bc6956122bf565b611b81565b15611bdb575050611bc6956122bf565b611c0c611c07611bf833600c1b6000526007602052604060002090565b54670de0b6b3a7640000900490565b611dba565b81611c2a611c24855169ffffffffffffffffffff1690565b92611d0f565b911611918215611c6e575b5050611c4457611bc6956122bf565b60046040517f1c18f846000000000000000000000000000000000000000000000000000000008152fd5b5169d3c21bcecceda1000000925069ffffffffffffffffffff1616113880611c35565b60046040517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b60046040517f22bbb43c000000000000000000000000000000000000000000000000000000008152fd5b60046040517fb2e532de000000000000000000000000000000000000000000000000000000008152fd5b90670de0b6b3a7640000918281029281840414901517156116bd57565b73ffffffffffffffffffffffffffffffffffffffff8293941692611d7e575b505003611d5457565b60046040517f3b8474be000000000000000000000000000000000000000000000000000000008152fd5b60059291831b8101915b8135808211851b918252602080921852604060002091019282841015611daf579290611d88565b509150503880611d4b565b6040519060208201907f4d2b1791000000000000000000000000000000000000000000000000000000008252602483015260248252606082019082821067ffffffffffffffff8311176102d7576020926000926040525190600254617530fa906000519115611e2557565b63e10bf1cc6000526004601cfd5b611e3b611e61565b90600073ffffffffffffffffffffffffffffffffffffffff83163314610af45750600190565b33600052600160205260ff60406000205416600014611ea4577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b3390565b918254611f6c5760806020927f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1948452600094859384927b19457468657265756d205369676e6564204d6573736167653a0a3332845260ff603c600420996040519a865216875260405280606052105afa508051903d15611f5f576060526040829052600c1b5415611f375750565b807f815e1d640000000000000000000000000000000000000000000000000000000060049252fd5b638baa579f90526004601cfd5b60046040517ff490a6ea000000000000000000000000000000000000000000000000000000008152fd5b60109260209260145260345260446000938480936fa9059cbb00000000000000000000000082525af13d156001835114171615611fd257603452565b6390b8ec1890526004601cfd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b919081101561201e5760051b0190565b611fdf565b6000905b82821061204457501061203657565b63dfb035c96000526004601cfd5b9061206461205382858561200e565b356000526006602052604060002090565b61206d81612270565b80549060048082019081549073ffffffffffffffffffffffffffffffffffffffff94858360501c16916a52b7d2dcc80cd2e40000006120ea69ffffffffffffffffffff6b3fffffffffffffffffffffff6120e087879060205263739094b1600c52600c1c60005260016034600c20015490565b16961680966116c2565b116121f95750936121477f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da594610f2e6121bd9560059560019b9a999060205263739094b1600c52600c1c60005260016034600c2001908154019055565b0161216961107f825473ffffffffffffffffffffffffffffffffffffffff1690565b612187612180826000526007602052604060002090565b5460011c90565b68056bc75e2d6310000081116121de57506121af610fac916000526007602052604060002090565b68056bc75e2d631000009055565b916121c984888861200e565b60405190358152921691602090a20190612027565b906121f3906000526007602052604060002090565b55610fac565b6040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b338103612262576374dfee70600c5280600052816020600020557f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632600080a3565b6385d1f7266000526004601cfd5b60028101544310611c91576004015469ffffffffffffffffffff16156110f157565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146116bd5760010190565b9261244c61240597967f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea65949673ffffffffffffffffffffffffffffffffffffffff94612358978960005260066020526124476040600020875181556020880151600182015560408801516002820155606088015160038201556123e36004820161238f60808b019d8e5169ffffffffffffffffffff1690565b829069ffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffff00000000000000000000825416179055565b60a08a015181547fffff0000000000000000000000000000000000000000ffffffffffffffffffff1660509190911b7dffffffffffffffffffffffffffffffffffffffff0000000000000000000016179055565b600560c089019e8f5173ffffffffffffffffffffffffffffffffffffffff1690565b91019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b6124c3565b61245f61245a600554612292565b600555565b6124be61249761248487995173ffffffffffffffffffffffffffffffffffffffff1690565b9251955169ffffffffffffffffffff1690565b60405193849316958390929169ffffffffffffffffffff6020916040840195845216910152565b0390a3565b9291909280848103119015176124f45760205263739094b1600c52600c1c60005260016034600c2001908154039055565b63ce3a3d376000526004601cfd5b600092913d15612510575050565b9091925060205263739094b1600c5260005260016034600c2001546b3fffffffffffffffffffffff1690565b600092913d1561254a575050565b9091925060205263739094b1600c5260005260016034600c200154605f1c6b3fffffffffffffffffffffff1690565b600092913d15612587575050565b9091925060205263739094b1600c526000526034600c205490565b6040516020810181811067ffffffffffffffff8211176102d75760405260008152906000368137565b906125d5826102fc565b6125e26040519182610296565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061261082946102fc565b0190602036910137565b805182101561201e5760209160051b010190565b9081511561277f5760008092805190612646826125cb565b92612650836125cb565b955b83811061266157505050509190565b806126826126716001938661261a565b516000526006602052604060002090565b546126b257612691818561261a565b5161269c828861261a565b52826126a8828a61261a565b5201925b92612652565b69ffffffffffffffffffff6126e060046126cf612671858961261a565b015469ffffffffffffffffffff1690565b16612715576126ef818561261a565b516126fa828861261a565b5261270e612708828a61261a565b60039052565b01926126ac565b6002612724612671838761261a565b015443111561275657612737818561261a565b51612742828861261a565b5261270e612750828a61261a565b60029052565b612760818561261a565b5161276b828861261a565b5261270e612779828a61261a565b60019052565b90506127896125a2565b90610af46125a256fea2646970667358221220056553307dee1aafd24d123d47fdccee5a2997cae6422e600d53cea9c80a955b64736f6c63430008130033", - "deployedBytecode": "0x6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806304937320146102365780630d2a2d441461023157806313af40351461022c578063367821f014610227578063461f3120146101d757806349ef8448146102225780634b2ae9801461021d578063572b6c0514610218578063574983c8146102135780635fd8c7101461020e57806369cc6af4146102095780636d82d9e01461020457806377cd38a4146101ff5780637f94f65d146101fa57806380e1d302146101f557806384ab1d28146101f05780638da5cb5b146101eb5780638db564c2146101e6578063918dff57146101e15780639872dbfe146101dc57806398a26871146101d75780639b6d694d146101d2578063ad8f2eed146101cd578063b0983d39146101c8578063c52164c6146101c3578063c593dfd8146101be578063d1c07028146101b9578063d1ced2b0146101b4578063d4fac45d146101af578063d6e8b973146101aa578063dc43221c146101a5578063e449c52a146101a0578063f7d0e04b1461019b5763fb8c5ef00361000e57611532565b6114c2565b611487565b6113ec565b61133a565b611321565b611272565b61112c565b610dfb565b610dc7565b610d8d565b610d49565b610cd9565b6105eb565b610c46565b610bbb565b610b7a565b610b46565b610b10565b610af7565b610aa6565b610a6e565b610917565b6108ca565b610847565b6107e3565b610793565b610769565b6106ce565b610559565b6104c7565b61039a565b346102625760206003193601126102625760043560005260076020526020604060002054604051908152f35b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176102d757604052565b610267565b6040519060e0820182811067ffffffffffffffff8211176102d757604052565b67ffffffffffffffff81116102d75760051b60200190565b73ffffffffffffffffffffffffffffffffffffffff81160361026257565b81601f8201121561026257803591610349836102fc565b926103576040519485610296565b808452602092838086019260051b820101928311610262578301905b828210610381575050505090565b838091833561038f81610314565b815201910190610373565b34610262576020806003193601126102625760043567ffffffffffffffff8111610262576103cc903690600401610332565b9073ffffffffffffffffffffffffffffffffffffffff918260005416330361049d57805181830192849160051b830181013d1515855b8115610469575b50505060405192818401908285525180915260408401949160005b828110610453577f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d786880387a1005b8351851687529581019592810192600101610424565b90838260018298969499979951600c1b55019083821015610491579150959395949294610402565b50959395949294610409565b60046040517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576004356104e481610314565b600090815473ffffffffffffffffffffffffffffffffffffffff808216330361049d577fffffffffffffffffffffffff0000000000000000000000000000000000000000921691829116178255337f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768380a380f35b3461026257602060031936011261026257600435600052600660205260e060406000208054906005600182015491600281015460038201549060048301549273ffffffffffffffffffffffffffffffffffffffff9485910154169460405196875260208701526040860152606085015269ffffffffffffffffffff8116608085015260501c1660a083015260c0820152f35b34610262576020600319360112610262576020600435546040519015158152f35b90815180825260208080930193019160005b82811061062c575050505090565b83518552938101939281019260010161061e565b906106539060408352604083019061060c565b81810360209283015282518082529082019282019160009190825b82811061067d57505050505090565b909192939485516004808210156106a25750815282019482019392919060010161066e565b8660216024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b34610262576020806003193601126102625760043567ffffffffffffffff811161026257366023820112156102625780600401359061070c826102fc565b9161071a6040519384610296565b80835260248484019160051b8301019136831161026257602401905b82821061075a576107468461262e565b9061075660405192839283610640565b0390f35b81358152908401908401610736565b3461026257602060031936011261026257602060043561078881610314565b60405190600c1b8152f35b346102625760206003193601126102625773ffffffffffffffffffffffffffffffffffffffff6004356107c581610314565b166000526001602052602060ff604060002054166040519015158152f35b346102625760206003193601126102625760043573ffffffffffffffffffffffffffffffffffffffff60005416330361049d576020817f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851192600355604051908152a1005b34610262576000806003193601126108c75773ffffffffffffffffffffffffffffffffffffffff815416330361049d57478180808084335af1156108ba576040805133815260208101929092527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91a180f35b63b12d13eb82526004601cfd5b80fd5b346102625760206003193601126102625760206109006004356108ec81610314565b63cbc9d1c4600c526000526020600c205490565b6040519015158152f35b3590811515820361026257565b346102625760406003193601126102625760043561093481610314565b602435801515810361026257602082905263739094b1600c9081527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff331660005260349020600101548015610a44577fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4991610a3f918460205263739094b1600c527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff33166000526b3fffffffffffffffffffffff82605f1b91161760016034600c20015560405191829173ffffffffffffffffffffffffffffffffffffffff3396168390929160209073ffffffffffffffffffffffffffffffffffffffff60408401951683521515910152565b0390a2005b60046040517f87138d5c000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576020610a9e6004356374dfee70600c52600c1c60005260206000205490565b604051908152f35b3461026257604060031936011261026257610019600435610ac681610314565b60243590612221565b600319604091011261026257600435610ae781610314565b90602435610af481610314565b90565b34610262576020610900610b0a36610acf565b9061253c565b3461026257602060031936011261026257602060405173ffffffffffffffffffffffffffffffffffffffff600435600c1c168152f35b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b34610262576000600319360112610262576020600554604051908152f35b60005b838110610bab5750506000910152565b8181015183820152602001610b9b565b3461026257610bd2610bcc36610acf565b90612579565b604051906020820190815260208252604082019180831067ffffffffffffffff8411176102d7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60409385855260208652610c3d845180928160608801526080870190610b98565b01168101030190f35b34610262576000600319360112610262576020600354604051908152f35b81601f820112156102625780359067ffffffffffffffff82116102d75760405192610cb760207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8601160185610296565b8284526020838301011161026257816000926020809301838601378301015290565b346102625760a060031936011261026257600435610cf681610314565b602435906bffffffffffffffffffffffff821682036102625760443567ffffffffffffffff811161026257610d2f903690600401610c64565b6064359081151582036102625761001993608435936116cf565b34610262576020610a9e610bcc36610acf565b9181601f840112156102625782359167ffffffffffffffff8311610262576020808501948460051b01011161026257565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610dc1610019913690600401610d5c565b90612023565b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346102625760a06003193601126102625760043560843560ff8116810361026257610e246118c5565b610e38826000526006602052604060002090565b6004810180549169ffffffffffffffffffff83169283156110f15760028201805443116110c75784600584610f5d7f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8996000610fac96610f56610fdf9b610f2e89610ef2610f1e610fc69f6003015460405192839160208301956024359187917fffffffffffffffffffff0000000000000000000000000000000000000000000090604a9492845260b01b166020830152602a8201520190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610296565b5190209560643560443588611ea8565b7fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008154169055565b5560019055565b610f65611e33565b905015610ffa575b019273ffffffffffffffffffffffffffffffffffffffff610fa2855473ffffffffffffffffffffffffffffffffffffffff1690565b9160501c16611f96565b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b60408051948552602085019290925292a26100196001600455565b81810161101e610fc6825473ffffffffffffffffffffffffffffffffffffffff1690565b33146110a45761109d61109561108561107f697fffffffffffffffffff8a60011c169461105833600c1b6000526007602052604060002090565b6110638782546116c2565b90555473ffffffffffffffffffffffffffffffffffffffff1690565b600c1b90565b6000526007602052604060002090565b9182546116c2565b9055610f6d565b506110bc33600c1b6000526007602052604060002090565b61109d8482546116c2565b60046040517ff6fafba0000000000000000000000000000000000000000000000000000000008152fd5b60046040517f63b4904e000000000000000000000000000000000000000000000000000000008152fd5b906020610af492818152019061060c565b346102625760406003193601126102625760043567ffffffffffffffff81116102625761115d903690600401610332565b6024359061116a82610314565b600091815191611179836125cb565b935b8381106111905760405180610756878261111b565b806111bd8473ffffffffffffffffffffffffffffffffffffffff6111b66001958761261a565b5116612502565b6111c7828861261a565b520161117b565b9060406003198301126102625767ffffffffffffffff9160043583811161026257816111fc91600401610332565b92602435908111610262578160238201121561026257806004013591611221836102fc565b9261122f6040519485610296565b80845260209260248486019260051b82010192831161026257602401905b82821061125b575050505090565b8380916112678461090a565b81520191019061124d565b3461026257611280366111ce565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d57825190811561131f57805182036113125790602084818080970194019260051b0101915b8281036112d0578380f35b8480916001825280518652835180604088205581517fbee55516e29d3969d3cb8eb01351eb3c52d06f9e2435bd5a8bfe3647e185df928880a3019101906112c5565b63ff633a3883526004601cfd5bfe5b34610262576020610a9e61133436610acf565b90612502565b3461026257611348366111ce565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156113df57805182036113125790602084818080970194019260051b0101915b828103611398578380f35b84809181600c63cbc9d1c48152825188528551918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8880a30191019061138d565b63df95788383526004601cfd5b346102625760a06003193601126102625760043561140981610314565b6024359061141682610314565b6044359169ffffffffffffffffffff831683036102625767ffffffffffffffff916064358381116102625761144f903690600401610d5c565b90608435948511610262576107569561146f611477963690600401610d5c565b959094611a2f565b6040519081529081906020820190565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610a9e6114bd6020923690600401610c64565b61164a565b34610262576020600319360112610262576004356114df81610314565b73ffffffffffffffffffffffffffffffffffffffff8060005416330361049d57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1005b346102625760606003193601126102625760043561154f81610314565b60243560443567ffffffffffffffff8111610262577f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e916115a861159a611632933690600401610d5c565b906115a36118c5565b612023565b6115b2843361253c565b61163c575b6115f633600c1b85836b3fffffffffffffffffffffff6115f083859060205263739094b1600c52600c1c60005260016034600c20015490565b166124c3565b611601813386611f96565b6040805173ffffffffffffffffffffffffffffffffffffffff95909516855260208501919091523393918291820190565b0390a26001600455005b61164584611959565b6115b7565b604051611674602082816116678183019687815193849201610b98565b8101038084520182610296565b5160201061131f575190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b90600182018092116116bd57565b611680565b919082018092116116bd57565b939273ffffffffffffffffffffffffffffffffffffffff85169333600c1b9484511561189b576117146117108263cbc9d1c4600c526000526020600c205490565b1590565b611871576b3fffffffffffffffffffffff61174882889060205263739094b1600c52600c1c60005260016034600c20015490565b16916117636bffffffffffffffffffffffff861680946116c2565b936a52b7d2dcc80cd2e40000008511611847577f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf97836117eb966117bc6118329a6117e2966117b06118c5565b80611837575b5061164a565b93605f1b17919060205263739094b1600c52600c1c6000526034600c2090600182015555565b30903390611900565b6117f56001600455565b6040805173ffffffffffffffffffffffffffffffffffffffff90951685526bffffffffffffffffffffffff90911660208501523393918291820190565b0390a2565b6118419033612221565b386117b6565b60046040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1578328e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6a3bc53e000000000000000000000000000000000000000000000000000000008152fd5b6002600454146118d6576002600455565b60046040517fab143c06000000000000000000000000000000000000000000000000000000008152fd5b601c600060649281946020966040519860605260405260601b602c526f23b872dd000000000000000000000000600c525af13d1560016000511417161561194b576000606052604052565b637939f4246000526004601cfd5b602081905263739094b1600c9081527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff331660005260349020600101548015610a44576b3fffffffffffffffffffffff908260205263739094b1600c527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff33166000521660016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405191168152600060208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2565b9295611a559073ffffffffffffffffffffffffffffffffffffffff9395966115a36118c5565b1691611a64611710848461253c565b611ce557611a728383612502565b9469ffffffffffffffffffff80831691828810611cbb5784600c1b96611a996005546116af565b946002611ab0876000526006602052604060002090565b0154431115611c9157611ac1611e33565b611ada8a611ad4600398949854436116c2565b9a612579565b611ae26102dc565b998c8b528960208c015260408b015260608a0152611b1060808a0193849069ffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8a1660a08a015273ffffffffffffffffffffffffffffffffffffffff861660c08a01528315611b8e5750505091611b7c91611b819993611b768a6374dfee70600c52600c1c60005260206000205490565b91611d2c565b6122bf565b90611b8c6001600455565b565b9250819450809350611bb468056bc75e2d63100000925169ffffffffffffffffffff1690565b1611611bcb57505050611bc6956122bf565b611b81565b15611bdb575050611bc6956122bf565b611c0c611c07611bf833600c1b6000526007602052604060002090565b54670de0b6b3a7640000900490565b611dba565b81611c2a611c24855169ffffffffffffffffffff1690565b92611d0f565b911611918215611c6e575b5050611c4457611bc6956122bf565b60046040517f1c18f846000000000000000000000000000000000000000000000000000000008152fd5b5169d3c21bcecceda1000000925069ffffffffffffffffffff1616113880611c35565b60046040517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b60046040517f22bbb43c000000000000000000000000000000000000000000000000000000008152fd5b60046040517fb2e532de000000000000000000000000000000000000000000000000000000008152fd5b90670de0b6b3a7640000918281029281840414901517156116bd57565b73ffffffffffffffffffffffffffffffffffffffff8293941692611d7e575b505003611d5457565b60046040517f3b8474be000000000000000000000000000000000000000000000000000000008152fd5b60059291831b8101915b8135808211851b918252602080921852604060002091019282841015611daf579290611d88565b509150503880611d4b565b6040519060208201907f4d2b1791000000000000000000000000000000000000000000000000000000008252602483015260248252606082019082821067ffffffffffffffff8311176102d7576020926000926040525190600254617530fa906000519115611e2557565b63e10bf1cc6000526004601cfd5b611e3b611e61565b90600073ffffffffffffffffffffffffffffffffffffffff83163314610af45750600190565b33600052600160205260ff60406000205416600014611ea4577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b3390565b918254611f6c5760806020927f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1948452600094859384927b19457468657265756d205369676e6564204d6573736167653a0a3332845260ff603c600420996040519a865216875260405280606052105afa508051903d15611f5f576060526040829052600c1b5415611f375750565b807f815e1d640000000000000000000000000000000000000000000000000000000060049252fd5b638baa579f90526004601cfd5b60046040517ff490a6ea000000000000000000000000000000000000000000000000000000008152fd5b60109260209260145260345260446000938480936fa9059cbb00000000000000000000000082525af13d156001835114171615611fd257603452565b6390b8ec1890526004601cfd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b919081101561201e5760051b0190565b611fdf565b6000905b82821061204457501061203657565b63dfb035c96000526004601cfd5b9061206461205382858561200e565b356000526006602052604060002090565b61206d81612270565b80549060048082019081549073ffffffffffffffffffffffffffffffffffffffff94858360501c16916a52b7d2dcc80cd2e40000006120ea69ffffffffffffffffffff6b3fffffffffffffffffffffff6120e087879060205263739094b1600c52600c1c60005260016034600c20015490565b16961680966116c2565b116121f95750936121477f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da594610f2e6121bd9560059560019b9a999060205263739094b1600c52600c1c60005260016034600c2001908154019055565b0161216961107f825473ffffffffffffffffffffffffffffffffffffffff1690565b612187612180826000526007602052604060002090565b5460011c90565b68056bc75e2d6310000081116121de57506121af610fac916000526007602052604060002090565b68056bc75e2d631000009055565b916121c984888861200e565b60405190358152921691602090a20190612027565b906121f3906000526007602052604060002090565b55610fac565b6040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b338103612262576374dfee70600c5280600052816020600020557f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632600080a3565b6385d1f7266000526004601cfd5b60028101544310611c91576004015469ffffffffffffffffffff16156110f157565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146116bd5760010190565b9261244c61240597967f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea65949673ffffffffffffffffffffffffffffffffffffffff94612358978960005260066020526124476040600020875181556020880151600182015560408801516002820155606088015160038201556123e36004820161238f60808b019d8e5169ffffffffffffffffffff1690565b829069ffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffff00000000000000000000825416179055565b60a08a015181547fffff0000000000000000000000000000000000000000ffffffffffffffffffff1660509190911b7dffffffffffffffffffffffffffffffffffffffff0000000000000000000016179055565b600560c089019e8f5173ffffffffffffffffffffffffffffffffffffffff1690565b91019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b6124c3565b61245f61245a600554612292565b600555565b6124be61249761248487995173ffffffffffffffffffffffffffffffffffffffff1690565b9251955169ffffffffffffffffffff1690565b60405193849316958390929169ffffffffffffffffffff6020916040840195845216910152565b0390a3565b9291909280848103119015176124f45760205263739094b1600c52600c1c60005260016034600c2001908154039055565b63ce3a3d376000526004601cfd5b600092913d15612510575050565b9091925060205263739094b1600c5260005260016034600c2001546b3fffffffffffffffffffffff1690565b600092913d1561254a575050565b9091925060205263739094b1600c5260005260016034600c200154605f1c6b3fffffffffffffffffffffff1690565b600092913d15612587575050565b9091925060205263739094b1600c526000526034600c205490565b6040516020810181811067ffffffffffffffff8211176102d75760405260008152906000368137565b906125d5826102fc565b6125e26040519182610296565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061261082946102fc565b0190602036910137565b805182101561201e5760209160051b010190565b9081511561277f5760008092805190612646826125cb565b92612650836125cb565b955b83811061266157505050509190565b806126826126716001938661261a565b516000526006602052604060002090565b546126b257612691818561261a565b5161269c828861261a565b52826126a8828a61261a565b5201925b92612652565b69ffffffffffffffffffff6126e060046126cf612671858961261a565b015469ffffffffffffffffffff1690565b16612715576126ef818561261a565b516126fa828861261a565b5261270e612708828a61261a565b60039052565b01926126ac565b6002612724612671838761261a565b015443111561275657612737818561261a565b51612742828861261a565b5261270e612750828a61261a565b60029052565b612760818561261a565b5161276b828861261a565b5261270e612779828a61261a565b60019052565b90506127896125a2565b90610af46125a256fea2646970667358221220056553307dee1aafd24d123d47fdccee5a2997cae6422e600d53cea9c80a955b64736f6c63430008130033", + "bytecode": "0x608060405262002d4680380380620000178162000126565b928339810160a0828203126200010b5781516020808401519093916001600160401b03918281116200010b5784620000519185016200017f565b9062000060604085016200016a565b9260608501518181116200010b57866200007c9187016200017f565b9460808101519182116200010b57019480601f870112156200010b578551620000af620000a98262000152565b62000126565b96888089848152019260051b8201019283116200010b578801905b828210620000f157505050620000e19550620001e6565b6040516129049081620004428239f35b815180151581036200010b578152908801908801620000ca565b600080fd5b634e487b7160e01b600052604160045260246000fd5b6040519190601f01601f191682016001600160401b038111838210176200014c57604052565b62000110565b6001600160401b0381116200014c5760051b60200190565b51906001600160a01b03821682036200010b57565b9080601f830112156200010b578151906200019e620000a98362000152565b9182938184526020808095019260051b8201019283116200010b578301905b828210620001cc575050505090565b838091620001da846200016a565b815201910190620001bd565b600080546001600160a01b031916339081178255929695949392817f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768180a3816003556040519182527f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851160208093a18651878301979060051b810183013d1515895b811562000306575b5050506040519280840191818552518092526040840198925b828110620002e85750505050907f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d782620002d593620002db97980390a16001600160a01b031662000337565b62000390565b620002e66001600455565b565b83516001600160a01b03168a52988101989281019260010162000289565b9085826001829697989451600c1b550190838210156200032c5791509493929462000268565b509493929462000270565b6000546001600160a01b0390811633036200037f57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1565b6040516282b42960e81b8152600490fd5b60008054919290916001600160a01b031633036200037f5782519182156200043457815183036200042757602092919284818080970195019360051b0101925b838103620003df575050505050565b84809181600c63cbc9d1c48152825186528651918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8680a301920191620003d0565b63ff633a3890526004601cfd5b63df95788390526004601cfdfe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806304937320146102365780630d2a2d441461023157806313af40351461022c5780631e3c017a146102275780631e9bb57314610222578063367821f01461021d5780633c16f0c414610218578063461f3120146101cd57806349ef8448146102135780634b2ae9801461020e578063572b6c0514610209578063574983c8146102045780635fd8c710146101ff57806369cc6af4146101fa5780636d82d9e0146101f55780637f94f65d146101f057806380e1d302146101eb57806384ab1d28146101e65780638da5cb5b146101e15780638db564c2146101dc578063918dff57146101d75780639872dbfe146101d257806398a26871146101cd578063ad8f2eed146101c8578063b0983d39146101c3578063c52164c6146101be578063c593dfd8146101b9578063d1c07028146101b4578063d1ced2b0146101af578063d4fac45d146101aa578063d6e8b973146101a5578063e449c52a146101a0578063f7d0e04b1461019b5763fb8c5ef00361000e576119d1565b611961565b61191a565b611803565b6117f0565b611741565b6115f9565b6112e1565b6112ad565b611279565b611235565b610c81565b611217565b611192565b611151565b61111d565b6110e7565b6110d4565b611083565b610f92565b610f5c565b610ed9565b610e75565b610e25565b610dfb565b610d64565b610c57565b610bb9565b61080b565b61058b565b6104c7565b61039a565b346102625760206003193601126102625760043560005260076020526020604060002054604051908152f35b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176102d757604052565b610267565b6040519060e0820182811067ffffffffffffffff8211176102d757604052565b67ffffffffffffffff81116102d75760051b60200190565b73ffffffffffffffffffffffffffffffffffffffff81160361026257565b81601f8201121561026257803591610349836102fc565b926103576040519485610296565b808452602092838086019260051b820101928311610262578301905b828210610381575050505090565b838091833561038f81610314565b815201910190610373565b34610262576020806003193601126102625760043567ffffffffffffffff8111610262576103cc903690600401610332565b9073ffffffffffffffffffffffffffffffffffffffff918260005416330361049d57805181830192849160051b830181013d1515855b8115610469575b50505060405192818401908285525180915260408401949160005b828110610453577f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d786880387a1005b8351851687529581019592810192600101610424565b90838260018298969499979951600c1b55019083821015610491579150959395949294610402565b50959395949294610409565b60046040517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576004356104e481610314565b600090815473ffffffffffffffffffffffffffffffffffffffff808216330361049d577fffffffffffffffffffffffff0000000000000000000000000000000000000000921691829116178255337f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768380a380f35b60031990602082820112610262576004359167ffffffffffffffff8311610262578260a0920301126102625760040190565b346102625761059936610559565b6105a38180611b19565b9050156107e157604081016105d56105d16105bd83611b6a565b63cbc9d1c4600c526000526020600c205490565b1590565b6107b7576b3fffffffffffffffffffffff61060e6105f283611b6a565b339060205263739094b1600c5260005260016034600c20015490565b169161063b606082019361063561062486611b74565b6bffffffffffffffffffffffff1690565b90611bcf565b916a52b7d2dcc80cd2e4000000831161078d5761073561071c61073b926106eb610778957f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf97610689611be6565b60208201358061077d575b506106bd60806106b66106b16106aa8680611b19565b36916118b5565b611ae3565b9301611bdc565b906106c785611b6a565b91605f1b1790339060205263739094b1600c526000526034600c2090600182015555565b61070d6106f782611b6a565b6107036106248a611b74565b9030903390611c21565b6107176001600455565b611b6a565b73ffffffffffffffffffffffffffffffffffffffff1690565b93611b74565b6040805173ffffffffffffffffffffffffffffffffffffffff90951685526bffffffffffffffffffffffff90911660208501523393918291820190565b0390a2005b6107879033612275565b38610694565b60046040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1578328e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6a3bc53e000000000000000000000000000000000000000000000000000000008152fd5b346102625761081936610559565b610821611be6565b6108376108316080830183611d13565b90612092565b61084081611b6a565b9061085b6105d1602083019361085585611b6a565b90612651565b610b8f5761087a61086b82611b6a565b61087484611b6a565b90612617565b6040918281019061089c61088d83611d67565b69ffffffffffffffffffff1690565b8310610b66576108ad600554611bbc565b9460016108c4876000526006602052604060002090565b0154431115610b3d576109aa906108d9611ea2565b9290946109716108fa6108eb87611b6a565b6108f486611b6a565b9061268e565b61091b61071c61091561090f60035443611bcf565b95611d67565b96611b6a565b9061092588611b6a565b9361092e6102dc565b9c8d5260208d01528a8c015261095460608c0195869069ffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff1660808b0152565b73ffffffffffffffffffffffffffffffffffffffff861660a08a015273ffffffffffffffffffffffffffffffffffffffff1660c0890152565b60608301916109b98385611d13565b159050610a24575050610a209592826109e76109fb6109df610a0195610a069997611d13565b929093611b6a565b6374dfee70600c5260005260206000205490565b91611d9b565b61233d565b905b610a126001600455565b519081529081906020820190565b0390f35b925092505069ffffffffffffffffffff9068056bc75e2d6310000082610a54855169ffffffffffffffffffff1690565b1611610a7057505050610a2092610a6a9161233d565b90610a08565b15610a84575050610a2092610a6a9161233d565b610ab5610ab0610aa133600c1b6000526007602052604060002090565b54670de0b6b3a7640000900490565b611e29565b81610ad3610acd855169ffffffffffffffffffff1690565b92611d7e565b911611918215610b1a575b5050610af157610a2092610a6a9161233d565b600482517f1c18f846000000000000000000000000000000000000000000000000000000008152fd5b5169d3c21bcecceda1000000925069ffffffffffffffffffff1616113880610ade565b600485517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b600484517f22bbb43c000000000000000000000000000000000000000000000000000000008152fd5b60046040517fb2e532de000000000000000000000000000000000000000000000000000000008152fd5b3461026257602060031936011261026257600480356000908152600660209081526040918290208054600182015460028301546003840154968401546005909401548651938452948301919091529381019390935269ffffffffffffffffffff8416606084015273ffffffffffffffffffffffffffffffffffffffff60509490941c84166080840152831660a08301529190911660c082015260e090f35b34610262576020600319360112610262576020610c796004356109e781610314565b604051908152f35b34610262576020600319360112610262576020600435546040519015158152f35b90815180825260208080930193019160005b828110610cc2575050505090565b835185529381019392810192600101610cb4565b90610ce990604083526040830190610ca2565b81810360209283015282518082529082019282019160009190825b828110610d1357505050505090565b90919293948551600480821015610d3857508152820194820193929190600101610d04565b8660216024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b34610262576020806003193601126102625760043567ffffffffffffffff8111610262573660238201121561026257806004013590610da2826102fc565b91610db06040519384610296565b80835260248484019160051b8301019136831161026257602401905b828210610dec57610ddc84612743565b90610a2060405192839283610cd6565b81358152908401908401610dcc565b34610262576020600319360112610262576020600435610e1a81610314565b60405190600c1b8152f35b346102625760206003193601126102625773ffffffffffffffffffffffffffffffffffffffff600435610e5781610314565b166000526001602052602060ff604060002054166040519015158152f35b346102625760206003193601126102625760043573ffffffffffffffffffffffffffffffffffffffff60005416330361049d576020817f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851192600355604051908152a1005b3461026257600080600319360112610f595773ffffffffffffffffffffffffffffffffffffffff815416330361049d57478180808084335af115610f4c576040805133815260208101929092527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91a180f35b63b12d13eb82526004601cfd5b80fd5b34610262576020600319360112610262576020610f7e6004356105bd81610314565b6040519015158152f35b8015150361026257565b3461026257604060031936011261026257600435610faf81610314565b602435610fbb81610f88565b610fdb82339060205263739094b1600c5260005260016034600c20015490565b8015611059578260205263739094b1600c52336000526b3fffffffffffffffffffffff82605f1b91161760016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405192168252151560208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2005b60046040517f87138d5c000000000000000000000000000000000000000000000000000000008152fd5b34610262576040600319360112610262576100196004356110a381610314565b60243590612275565b6003196040910112610262576004356110c481610314565b906024356110d181610314565b90565b34610262576020610f7e610855366110ac565b3461026257602060031936011261026257602060405173ffffffffffffffffffffffffffffffffffffffff600435600c1c168152f35b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b34610262576000600319360112610262576020600554604051908152f35b60005b8381106111825750506000910152565b8181015183820152602001611172565b34610262576111a36108f4366110ac565b604051906020820190815260208252604082019180831067ffffffffffffffff8411176102d7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6040938585526020865261120e84518092816060880152608087019061116f565b01168101030190f35b34610262576000600319360112610262576020600354604051908152f35b34610262576020610c796108f4366110ac565b9181601f840112156102625782359167ffffffffffffffff8311610262576020808501948460051b01011161026257565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610831610019913690600401611248565b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346102625760a06003193601126102625760043560843560ff811681036102625761130a611be6565b61131e826000526006602052604060002090565b6003810180549169ffffffffffffffffffff83169283156115be57600182018054431161159457846004846114437f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede89960006114929661143c6114ac9b611414896113d861140461071c9f6002015460405192839160208301956024359187917fffffffffffffffffffff0000000000000000000000000000000000000000000090604a9492845260b01b166020830152602a8201520190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610296565b5190209560643560443588611f17565b7fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008154169055565b5560019055565b61144b611ea2565b9050156114c7575b019273ffffffffffffffffffffffffffffffffffffffff611488855473ffffffffffffffffffffffffffffffffffffffff1690565b9160501c16612005565b5473ffffffffffffffffffffffffffffffffffffffff1690565b60408051948552602085019290925292a26100196001600455565b8181016114eb61071c825473ffffffffffffffffffffffffffffffffffffffff1690565b33146115715761156a61156261155261154c697fffffffffffffffffff8a60011c169461152533600c1b6000526007602052604060002090565b611530878254611bcf565b90555473ffffffffffffffffffffffffffffffffffffffff1690565b600c1b90565b6000526007602052604060002090565b918254611bcf565b9055611453565b5061158933600c1b6000526007602052604060002090565b61156a848254611bcf565b60046040517ff6fafba0000000000000000000000000000000000000000000000000000000008152fd5b60046040517f63b4904e000000000000000000000000000000000000000000000000000000008152fd5b9060206110d1928181520190610ca2565b346102625760406003193601126102625760043567ffffffffffffffff81116102625761162a903690600401610332565b6024359061163782610314565b600091815191611646836126e0565b935b83811061165d5760405180610a2087826115e8565b8061168a8473ffffffffffffffffffffffffffffffffffffffff6116836001958761272f565b5116612617565b611694828861272f565b5201611648565b9060406003198301126102625767ffffffffffffffff9160043583811161026257816116c991600401610332565b926024359081116102625781602382011215610262578060040135916116ee836102fc565b926116fc6040519485610296565b80845260209260248486019260051b82010192831161026257602401905b828210611728575050505090565b838091833561173681610f88565b81520191019061171a565b346102625761174f3661169b565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156117ee57805182036117e15790602084818080970194019260051b0101915b82810361179f578380f35b8480916001825280518652835180604088205581517fbee55516e29d3969d3cb8eb01351eb3c52d06f9e2435bd5a8bfe3647e185df928880a301910190611794565b63ff633a3883526004601cfd5bfe5b34610262576020610c79610874366110ac565b34610262576118113661169b565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156118a857805182036117e15790602084818080970194019260051b0101915b828103611861578380f35b84809181600c63cbc9d1c48152825188528551918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8880a301910190611856565b63df95788383526004601cfd5b92919267ffffffffffffffff82116102d757604051916118fd60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610296565b829481845281830111610262578281602093846000960137010152565b346102625760206003193601126102625760043567ffffffffffffffff8111610262573660238201121561026257610c796106b160209236906024816004013591016118b5565b346102625760206003193601126102625760043561197e81610314565b73ffffffffffffffffffffffffffffffffffffffff8060005416330361049d57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1005b34610262576060600319360112610262576004356119ee81610314565b60243560443567ffffffffffffffff8111610262577f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e91611a47611a39611acb933690600401611248565b90611a42611be6565b612092565b611a518433612651565b611ad5575b611a8f3385836b3fffffffffffffffffffffff611a8983339060205263739094b1600c5260005260016034600c20015490565b166125db565b611a9a813386612005565b6040805173ffffffffffffffffffffffffffffffffffffffff95909516855260208501919091523393918291820190565b0390a26001600455005b611ade84611c7a565b611a56565b604051611b0d60208281611b00818301968781519384920161116f565b8101038084520182610296565b516020106117ee575190565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610262570180359067ffffffffffffffff82116102625760200191813603831361026257565b356110d181610314565b356bffffffffffffffffffffffff811681036102625790565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9060018201809211611bca57565b611b8d565b91908201809211611bca57565b356110d181610f88565b600260045414611bf7576002600455565b60046040517fab143c06000000000000000000000000000000000000000000000000000000008152fd5b601c600060649281946020966040519860605260405260601b602c526f23b872dd000000000000000000000000600c525af13d15600160005114171615611c6c576000606052604052565b637939f4246000526004601cfd5b611c9a81339060205263739094b1600c5260005260016034600c20015490565b8015611059576b3fffffffffffffffffffffff908260205263739094b1600c52336000521660016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405191168152600060208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610262570180359067ffffffffffffffff821161026257602001918160051b3603831361026257565b3569ffffffffffffffffffff811681036102625790565b90670de0b6b3a764000091828102928184041490151715611bca57565b73ffffffffffffffffffffffffffffffffffffffff8293941692611ded575b505003611dc357565b60046040517f3b8474be000000000000000000000000000000000000000000000000000000008152fd5b60059291831b8101915b8135808211851b918252602080921852604060002091019282841015611e1e579290611df7565b509150503880611dba565b6040519060208201907f4d2b1791000000000000000000000000000000000000000000000000000000008252602483015260248252606082019082821067ffffffffffffffff8311176102d7576020926000926040525190600254617530fa906000519115611e9457565b63e10bf1cc6000526004601cfd5b611eaa611ed0565b90600073ffffffffffffffffffffffffffffffffffffffff831633146110d15750600190565b33600052600160205260ff60406000205416600014611f13577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b3390565b918254611fdb5760806020927f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1948452600094859384927b19457468657265756d205369676e6564204d6573736167653a0a3332845260ff603c600420996040519a865216875260405280606052105afa508051903d15611fce576060526040829052600c1b5415611fa65750565b807f815e1d640000000000000000000000000000000000000000000000000000000060049252fd5b638baa579f90526004601cfd5b60046040517ff490a6ea000000000000000000000000000000000000000000000000000000008152fd5b60109260209260145260345260446000938480936fa9059cbb00000000000000000000000082525af13d15600183511417161561204157603452565b6390b8ec1890526004601cfd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b919081101561208d5760051b0190565b61204e565b6000905b8282106120b35750106120a557565b63dfb035c96000526004601cfd5b906120d36120c282858561207d565b356000526006602052604060002090565b906120dd826122c4565b600582015473ffffffffffffffffffffffffffffffffffffffff166003830180549173ffffffffffffffffffffffffffffffffffffffff92838160501c16956a52b7d2dcc80cd2e400000061216d69ffffffffffffffffffff6b3fffffffffffffffffffffff6121638b889060205263739094b1600c5260005260016034600c20015490565b1694168094611bcf565b1161078d576121c37f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da59461141460049460019a612239979060205263739094b1600c5260005260016034600c2001908154019055565b016121e561154c825473ffffffffffffffffffffffffffffffffffffffff1690565b6122036121fc826000526007602052604060002090565b5460011c90565b68056bc75e2d63100000811161225a575061222b611492916000526007602052604060002090565b68056bc75e2d631000009055565b9161224584888861207d565b60405190358152921691602090a20190612096565b9061226f906000526007602052604060002090565b55611492565b3381036122b6576374dfee70600c5280600052816020600020557f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632600080a3565b6385d1f7266000526004601cfd5b600181015443106122e6576003015469ffffffffffffffffffff16156115be57565b60046040517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611bca5760010190565b612472907fa8fb61052fec8ed6ed923dd5e14b7d6aaae41d44c8870fc4efebf871389a577d61256d94938051600052600660205260406000208151815560208201516001820155604082015160028201556125d6612599612588600384019461253c6005606083019969ffffffffffffffffffff8b5116807fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008b5416178a5561244f612400608087015173ffffffffffffffffffffffffffffffffffffffff1690565b8b547fffff0000000000000000000000000000000000000000ffffffffffffffffffff16605082901b7dffffffffffffffffffffffffffffffffffffffff000000000000000000001617909b55565b6124b660a086019d8e5173ffffffffffffffffffffffffffffffffffffffff1690565b60048b019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b61251e60c08601996124dc8b5173ffffffffffffffffffffffffffffffffffffffff1690565b940180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055565b73ffffffffffffffffffffffffffffffffffffffff809a16916125db565b61254f61254a600554612310565b600555565b51998a985173ffffffffffffffffffffffffffffffffffffffff1690565b935173ffffffffffffffffffffffffffffffffffffffff1690565b955169ffffffffffffffffffff1690565b60405193849316958390929169ffffffffffffffffffff60209173ffffffffffffffffffffffffffffffffffffffff604085019616845216910152565b0390a3565b9291909280848103119015176126095760205263739094b1600c5260005260016034600c2001908154039055565b63ce3a3d376000526004601cfd5b600092913d15612625575050565b9091925060205263739094b1600c5260005260016034600c2001546b3fffffffffffffffffffffff1690565b600092913d1561265f575050565b9091925060205263739094b1600c5260005260016034600c200154605f1c6b3fffffffffffffffffffffff1690565b600092913d1561269c575050565b9091925060205263739094b1600c526000526034600c205490565b6040516020810181811067ffffffffffffffff8211176102d75760405260008152906000368137565b906126ea826102fc565b6126f76040519182610296565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061272582946102fc565b0190602036910137565b805182101561208d5760209160051b010190565b908151156128bb576000918281519061275b826126e0565b92612765836126e0565b955b83811061277657505050509190565b6127b761071c600561279c61278b858761272f565b516000526006602052604060002090565b015473ffffffffffffffffffffffffffffffffffffffff1690565b6127e957806127c86001928461272f565b516127d3828861272f565b52836127df828a61272f565b5201925b92612767565b69ffffffffffffffffffff612817600361280661278b858761272f565b015469ffffffffffffffffffff1690565b1661284f57806128296001928461272f565b51612834828861272f565b52612848612842828a61272f565b60039052565b01926127e3565b6001908161286061278b838661272f565b015443111561289257612873818461272f565b5161287e828861272f565b5261284861288c828a61272f565b60029052565b61289c818461272f565b516128a7828861272f565b526128486128b5828a61272f565b60019052565b90506128c56126b7565b906110d16126b756fea2646970667358221220ed724ed47bcdef6140dc4a66d86c43ecffa97e169222a98775625d6852ec98f964736f6c63430008130033", + "deployedBytecode": "0x6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806304937320146102365780630d2a2d441461023157806313af40351461022c5780631e3c017a146102275780631e9bb57314610222578063367821f01461021d5780633c16f0c414610218578063461f3120146101cd57806349ef8448146102135780634b2ae9801461020e578063572b6c0514610209578063574983c8146102045780635fd8c710146101ff57806369cc6af4146101fa5780636d82d9e0146101f55780637f94f65d146101f057806380e1d302146101eb57806384ab1d28146101e65780638da5cb5b146101e15780638db564c2146101dc578063918dff57146101d75780639872dbfe146101d257806398a26871146101cd578063ad8f2eed146101c8578063b0983d39146101c3578063c52164c6146101be578063c593dfd8146101b9578063d1c07028146101b4578063d1ced2b0146101af578063d4fac45d146101aa578063d6e8b973146101a5578063e449c52a146101a0578063f7d0e04b1461019b5763fb8c5ef00361000e576119d1565b611961565b61191a565b611803565b6117f0565b611741565b6115f9565b6112e1565b6112ad565b611279565b611235565b610c81565b611217565b611192565b611151565b61111d565b6110e7565b6110d4565b611083565b610f92565b610f5c565b610ed9565b610e75565b610e25565b610dfb565b610d64565b610c57565b610bb9565b61080b565b61058b565b6104c7565b61039a565b346102625760206003193601126102625760043560005260076020526020604060002054604051908152f35b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176102d757604052565b610267565b6040519060e0820182811067ffffffffffffffff8211176102d757604052565b67ffffffffffffffff81116102d75760051b60200190565b73ffffffffffffffffffffffffffffffffffffffff81160361026257565b81601f8201121561026257803591610349836102fc565b926103576040519485610296565b808452602092838086019260051b820101928311610262578301905b828210610381575050505090565b838091833561038f81610314565b815201910190610373565b34610262576020806003193601126102625760043567ffffffffffffffff8111610262576103cc903690600401610332565b9073ffffffffffffffffffffffffffffffffffffffff918260005416330361049d57805181830192849160051b830181013d1515855b8115610469575b50505060405192818401908285525180915260408401949160005b828110610453577f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d786880387a1005b8351851687529581019592810192600101610424565b90838260018298969499979951600c1b55019083821015610491579150959395949294610402565b50959395949294610409565b60046040517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576004356104e481610314565b600090815473ffffffffffffffffffffffffffffffffffffffff808216330361049d577fffffffffffffffffffffffff0000000000000000000000000000000000000000921691829116178255337f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768380a380f35b60031990602082820112610262576004359167ffffffffffffffff8311610262578260a0920301126102625760040190565b346102625761059936610559565b6105a38180611b19565b9050156107e157604081016105d56105d16105bd83611b6a565b63cbc9d1c4600c526000526020600c205490565b1590565b6107b7576b3fffffffffffffffffffffff61060e6105f283611b6a565b339060205263739094b1600c5260005260016034600c20015490565b169161063b606082019361063561062486611b74565b6bffffffffffffffffffffffff1690565b90611bcf565b916a52b7d2dcc80cd2e4000000831161078d5761073561071c61073b926106eb610778957f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf97610689611be6565b60208201358061077d575b506106bd60806106b66106b16106aa8680611b19565b36916118b5565b611ae3565b9301611bdc565b906106c785611b6a565b91605f1b1790339060205263739094b1600c526000526034600c2090600182015555565b61070d6106f782611b6a565b6107036106248a611b74565b9030903390611c21565b6107176001600455565b611b6a565b73ffffffffffffffffffffffffffffffffffffffff1690565b93611b74565b6040805173ffffffffffffffffffffffffffffffffffffffff90951685526bffffffffffffffffffffffff90911660208501523393918291820190565b0390a2005b6107879033612275565b38610694565b60046040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1578328e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6a3bc53e000000000000000000000000000000000000000000000000000000008152fd5b346102625761081936610559565b610821611be6565b6108376108316080830183611d13565b90612092565b61084081611b6a565b9061085b6105d1602083019361085585611b6a565b90612651565b610b8f5761087a61086b82611b6a565b61087484611b6a565b90612617565b6040918281019061089c61088d83611d67565b69ffffffffffffffffffff1690565b8310610b66576108ad600554611bbc565b9460016108c4876000526006602052604060002090565b0154431115610b3d576109aa906108d9611ea2565b9290946109716108fa6108eb87611b6a565b6108f486611b6a565b9061268e565b61091b61071c61091561090f60035443611bcf565b95611d67565b96611b6a565b9061092588611b6a565b9361092e6102dc565b9c8d5260208d01528a8c015261095460608c0195869069ffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff1660808b0152565b73ffffffffffffffffffffffffffffffffffffffff861660a08a015273ffffffffffffffffffffffffffffffffffffffff1660c0890152565b60608301916109b98385611d13565b159050610a24575050610a209592826109e76109fb6109df610a0195610a069997611d13565b929093611b6a565b6374dfee70600c5260005260206000205490565b91611d9b565b61233d565b905b610a126001600455565b519081529081906020820190565b0390f35b925092505069ffffffffffffffffffff9068056bc75e2d6310000082610a54855169ffffffffffffffffffff1690565b1611610a7057505050610a2092610a6a9161233d565b90610a08565b15610a84575050610a2092610a6a9161233d565b610ab5610ab0610aa133600c1b6000526007602052604060002090565b54670de0b6b3a7640000900490565b611e29565b81610ad3610acd855169ffffffffffffffffffff1690565b92611d7e565b911611918215610b1a575b5050610af157610a2092610a6a9161233d565b600482517f1c18f846000000000000000000000000000000000000000000000000000000008152fd5b5169d3c21bcecceda1000000925069ffffffffffffffffffff1616113880610ade565b600485517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b600484517f22bbb43c000000000000000000000000000000000000000000000000000000008152fd5b60046040517fb2e532de000000000000000000000000000000000000000000000000000000008152fd5b3461026257602060031936011261026257600480356000908152600660209081526040918290208054600182015460028301546003840154968401546005909401548651938452948301919091529381019390935269ffffffffffffffffffff8416606084015273ffffffffffffffffffffffffffffffffffffffff60509490941c84166080840152831660a08301529190911660c082015260e090f35b34610262576020600319360112610262576020610c796004356109e781610314565b604051908152f35b34610262576020600319360112610262576020600435546040519015158152f35b90815180825260208080930193019160005b828110610cc2575050505090565b835185529381019392810192600101610cb4565b90610ce990604083526040830190610ca2565b81810360209283015282518082529082019282019160009190825b828110610d1357505050505090565b90919293948551600480821015610d3857508152820194820193929190600101610d04565b8660216024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b34610262576020806003193601126102625760043567ffffffffffffffff8111610262573660238201121561026257806004013590610da2826102fc565b91610db06040519384610296565b80835260248484019160051b8301019136831161026257602401905b828210610dec57610ddc84612743565b90610a2060405192839283610cd6565b81358152908401908401610dcc565b34610262576020600319360112610262576020600435610e1a81610314565b60405190600c1b8152f35b346102625760206003193601126102625773ffffffffffffffffffffffffffffffffffffffff600435610e5781610314565b166000526001602052602060ff604060002054166040519015158152f35b346102625760206003193601126102625760043573ffffffffffffffffffffffffffffffffffffffff60005416330361049d576020817f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851192600355604051908152a1005b3461026257600080600319360112610f595773ffffffffffffffffffffffffffffffffffffffff815416330361049d57478180808084335af115610f4c576040805133815260208101929092527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91a180f35b63b12d13eb82526004601cfd5b80fd5b34610262576020600319360112610262576020610f7e6004356105bd81610314565b6040519015158152f35b8015150361026257565b3461026257604060031936011261026257600435610faf81610314565b602435610fbb81610f88565b610fdb82339060205263739094b1600c5260005260016034600c20015490565b8015611059578260205263739094b1600c52336000526b3fffffffffffffffffffffff82605f1b91161760016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405192168252151560208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2005b60046040517f87138d5c000000000000000000000000000000000000000000000000000000008152fd5b34610262576040600319360112610262576100196004356110a381610314565b60243590612275565b6003196040910112610262576004356110c481610314565b906024356110d181610314565b90565b34610262576020610f7e610855366110ac565b3461026257602060031936011261026257602060405173ffffffffffffffffffffffffffffffffffffffff600435600c1c168152f35b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b34610262576000600319360112610262576020600554604051908152f35b60005b8381106111825750506000910152565b8181015183820152602001611172565b34610262576111a36108f4366110ac565b604051906020820190815260208252604082019180831067ffffffffffffffff8411176102d7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6040938585526020865261120e84518092816060880152608087019061116f565b01168101030190f35b34610262576000600319360112610262576020600354604051908152f35b34610262576020610c796108f4366110ac565b9181601f840112156102625782359167ffffffffffffffff8311610262576020808501948460051b01011161026257565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610831610019913690600401611248565b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346102625760a06003193601126102625760043560843560ff811681036102625761130a611be6565b61131e826000526006602052604060002090565b6003810180549169ffffffffffffffffffff83169283156115be57600182018054431161159457846004846114437f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede89960006114929661143c6114ac9b611414896113d861140461071c9f6002015460405192839160208301956024359187917fffffffffffffffffffff0000000000000000000000000000000000000000000090604a9492845260b01b166020830152602a8201520190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610296565b5190209560643560443588611f17565b7fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008154169055565b5560019055565b61144b611ea2565b9050156114c7575b019273ffffffffffffffffffffffffffffffffffffffff611488855473ffffffffffffffffffffffffffffffffffffffff1690565b9160501c16612005565b5473ffffffffffffffffffffffffffffffffffffffff1690565b60408051948552602085019290925292a26100196001600455565b8181016114eb61071c825473ffffffffffffffffffffffffffffffffffffffff1690565b33146115715761156a61156261155261154c697fffffffffffffffffff8a60011c169461152533600c1b6000526007602052604060002090565b611530878254611bcf565b90555473ffffffffffffffffffffffffffffffffffffffff1690565b600c1b90565b6000526007602052604060002090565b918254611bcf565b9055611453565b5061158933600c1b6000526007602052604060002090565b61156a848254611bcf565b60046040517ff6fafba0000000000000000000000000000000000000000000000000000000008152fd5b60046040517f63b4904e000000000000000000000000000000000000000000000000000000008152fd5b9060206110d1928181520190610ca2565b346102625760406003193601126102625760043567ffffffffffffffff81116102625761162a903690600401610332565b6024359061163782610314565b600091815191611646836126e0565b935b83811061165d5760405180610a2087826115e8565b8061168a8473ffffffffffffffffffffffffffffffffffffffff6116836001958761272f565b5116612617565b611694828861272f565b5201611648565b9060406003198301126102625767ffffffffffffffff9160043583811161026257816116c991600401610332565b926024359081116102625781602382011215610262578060040135916116ee836102fc565b926116fc6040519485610296565b80845260209260248486019260051b82010192831161026257602401905b828210611728575050505090565b838091833561173681610f88565b81520191019061171a565b346102625761174f3661169b565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156117ee57805182036117e15790602084818080970194019260051b0101915b82810361179f578380f35b8480916001825280518652835180604088205581517fbee55516e29d3969d3cb8eb01351eb3c52d06f9e2435bd5a8bfe3647e185df928880a301910190611794565b63ff633a3883526004601cfd5bfe5b34610262576020610c79610874366110ac565b34610262576118113661169b565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156118a857805182036117e15790602084818080970194019260051b0101915b828103611861578380f35b84809181600c63cbc9d1c48152825188528551918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8880a301910190611856565b63df95788383526004601cfd5b92919267ffffffffffffffff82116102d757604051916118fd60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610296565b829481845281830111610262578281602093846000960137010152565b346102625760206003193601126102625760043567ffffffffffffffff8111610262573660238201121561026257610c796106b160209236906024816004013591016118b5565b346102625760206003193601126102625760043561197e81610314565b73ffffffffffffffffffffffffffffffffffffffff8060005416330361049d57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1005b34610262576060600319360112610262576004356119ee81610314565b60243560443567ffffffffffffffff8111610262577f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e91611a47611a39611acb933690600401611248565b90611a42611be6565b612092565b611a518433612651565b611ad5575b611a8f3385836b3fffffffffffffffffffffff611a8983339060205263739094b1600c5260005260016034600c20015490565b166125db565b611a9a813386612005565b6040805173ffffffffffffffffffffffffffffffffffffffff95909516855260208501919091523393918291820190565b0390a26001600455005b611ade84611c7a565b611a56565b604051611b0d60208281611b00818301968781519384920161116f565b8101038084520182610296565b516020106117ee575190565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610262570180359067ffffffffffffffff82116102625760200191813603831361026257565b356110d181610314565b356bffffffffffffffffffffffff811681036102625790565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9060018201809211611bca57565b611b8d565b91908201809211611bca57565b356110d181610f88565b600260045414611bf7576002600455565b60046040517fab143c06000000000000000000000000000000000000000000000000000000008152fd5b601c600060649281946020966040519860605260405260601b602c526f23b872dd000000000000000000000000600c525af13d15600160005114171615611c6c576000606052604052565b637939f4246000526004601cfd5b611c9a81339060205263739094b1600c5260005260016034600c20015490565b8015611059576b3fffffffffffffffffffffff908260205263739094b1600c52336000521660016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405191168152600060208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610262570180359067ffffffffffffffff821161026257602001918160051b3603831361026257565b3569ffffffffffffffffffff811681036102625790565b90670de0b6b3a764000091828102928184041490151715611bca57565b73ffffffffffffffffffffffffffffffffffffffff8293941692611ded575b505003611dc357565b60046040517f3b8474be000000000000000000000000000000000000000000000000000000008152fd5b60059291831b8101915b8135808211851b918252602080921852604060002091019282841015611e1e579290611df7565b509150503880611dba565b6040519060208201907f4d2b1791000000000000000000000000000000000000000000000000000000008252602483015260248252606082019082821067ffffffffffffffff8311176102d7576020926000926040525190600254617530fa906000519115611e9457565b63e10bf1cc6000526004601cfd5b611eaa611ed0565b90600073ffffffffffffffffffffffffffffffffffffffff831633146110d15750600190565b33600052600160205260ff60406000205416600014611f13577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b3390565b918254611fdb5760806020927f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1948452600094859384927b19457468657265756d205369676e6564204d6573736167653a0a3332845260ff603c600420996040519a865216875260405280606052105afa508051903d15611fce576060526040829052600c1b5415611fa65750565b807f815e1d640000000000000000000000000000000000000000000000000000000060049252fd5b638baa579f90526004601cfd5b60046040517ff490a6ea000000000000000000000000000000000000000000000000000000008152fd5b60109260209260145260345260446000938480936fa9059cbb00000000000000000000000082525af13d15600183511417161561204157603452565b6390b8ec1890526004601cfd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b919081101561208d5760051b0190565b61204e565b6000905b8282106120b35750106120a557565b63dfb035c96000526004601cfd5b906120d36120c282858561207d565b356000526006602052604060002090565b906120dd826122c4565b600582015473ffffffffffffffffffffffffffffffffffffffff166003830180549173ffffffffffffffffffffffffffffffffffffffff92838160501c16956a52b7d2dcc80cd2e400000061216d69ffffffffffffffffffff6b3fffffffffffffffffffffff6121638b889060205263739094b1600c5260005260016034600c20015490565b1694168094611bcf565b1161078d576121c37f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da59461141460049460019a612239979060205263739094b1600c5260005260016034600c2001908154019055565b016121e561154c825473ffffffffffffffffffffffffffffffffffffffff1690565b6122036121fc826000526007602052604060002090565b5460011c90565b68056bc75e2d63100000811161225a575061222b611492916000526007602052604060002090565b68056bc75e2d631000009055565b9161224584888861207d565b60405190358152921691602090a20190612096565b9061226f906000526007602052604060002090565b55611492565b3381036122b6576374dfee70600c5280600052816020600020557f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632600080a3565b6385d1f7266000526004601cfd5b600181015443106122e6576003015469ffffffffffffffffffff16156115be57565b60046040517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611bca5760010190565b612472907fa8fb61052fec8ed6ed923dd5e14b7d6aaae41d44c8870fc4efebf871389a577d61256d94938051600052600660205260406000208151815560208201516001820155604082015160028201556125d6612599612588600384019461253c6005606083019969ffffffffffffffffffff8b5116807fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008b5416178a5561244f612400608087015173ffffffffffffffffffffffffffffffffffffffff1690565b8b547fffff0000000000000000000000000000000000000000ffffffffffffffffffff16605082901b7dffffffffffffffffffffffffffffffffffffffff000000000000000000001617909b55565b6124b660a086019d8e5173ffffffffffffffffffffffffffffffffffffffff1690565b60048b019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b61251e60c08601996124dc8b5173ffffffffffffffffffffffffffffffffffffffff1690565b940180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055565b73ffffffffffffffffffffffffffffffffffffffff809a16916125db565b61254f61254a600554612310565b600555565b51998a985173ffffffffffffffffffffffffffffffffffffffff1690565b935173ffffffffffffffffffffffffffffffffffffffff1690565b955169ffffffffffffffffffff1690565b60405193849316958390929169ffffffffffffffffffff60209173ffffffffffffffffffffffffffffffffffffffff604085019616845216910152565b0390a3565b9291909280848103119015176126095760205263739094b1600c5260005260016034600c2001908154039055565b63ce3a3d376000526004601cfd5b600092913d15612625575050565b9091925060205263739094b1600c5260005260016034600c2001546b3fffffffffffffffffffffff1690565b600092913d1561265f575050565b9091925060205263739094b1600c5260005260016034600c200154605f1c6b3fffffffffffffffffffffff1690565b600092913d1561269c575050565b9091925060205263739094b1600c526000526034600c205490565b6040516020810181811067ffffffffffffffff8211176102d75760405260008152906000368137565b906126ea826102fc565b6126f76040519182610296565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061272582946102fc565b0190602036910137565b805182101561208d5760209160051b010190565b908151156128bb576000918281519061275b826126e0565b92612765836126e0565b955b83811061277657505050509190565b6127b761071c600561279c61278b858761272f565b516000526006602052604060002090565b015473ffffffffffffffffffffffffffffffffffffffff1690565b6127e957806127c86001928461272f565b516127d3828861272f565b52836127df828a61272f565b5201925b92612767565b69ffffffffffffffffffff612817600361280661278b858761272f565b015469ffffffffffffffffffff1690565b1661284f57806128296001928461272f565b51612834828861272f565b52612848612842828a61272f565b60039052565b01926127e3565b6001908161286061278b838661272f565b015443111561289257612873818461272f565b5161287e828861272f565b5261284861288c828a61272f565b60029052565b61289c818461272f565b516128a7828861272f565b526128486128b5828a61272f565b60019052565b90506128c56126b7565b906110d16126b756fea2646970667358221220ed724ed47bcdef6140dc4a66d86c43ecffa97e169222a98775625d6852ec98f964736f6c63430008130033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/contracts/core/BaseUtils.sol b/contracts/core/BaseUtils.sol index f4bc40a..96216b2 100644 --- a/contracts/core/BaseUtils.sol +++ b/contracts/core/BaseUtils.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import { ERC20, OwnerSettings } from "./OwnerSettings.sol"; +import { ERC20, OwnerSettings } from "contracts/core/OwnerSettings.sol"; -import { ECDSA } from "../lib/utils/ECDSA.sol"; -import { MerkleProofLib as Merkle } from "../lib/utils/MerkleProofLib.sol"; -import { ReentrancyGuard } from "../lib/utils/ReentrancyGuard.sol"; +import { ECDSA } from "contracts/lib/utils/ECDSA.sol"; +import { MerkleProofLib as Merkle } from "contracts/lib/utils/MerkleProofLib.sol"; +import { ReentrancyGuard } from "contracts/lib/utils/ReentrancyGuard.sol"; abstract contract BaseUtils is OwnerSettings, @@ -93,7 +93,7 @@ abstract contract BaseUtils is } function _setSellerBalance( - uint256 _sellerKey, + address _sellerKey, ERC20 _erc20, uint256 _packed, bytes32 _pixTarget @@ -101,7 +101,7 @@ abstract contract BaseUtils is assembly { mstore(0x20, _erc20) mstore(0x0c, _SELLER_BALANCE_SLOT_SEED) - mstore(0x00, shr(0xc, _sellerKey)) + mstore(0x00, _sellerKey) let _loc := keccak256(0x0c, 0x34) sstore(add(_loc, 0x01), _packed) sstore(_loc, _pixTarget) @@ -109,55 +109,55 @@ abstract contract BaseUtils is } function _setValidState( - uint256 _sellerKey, + address _sellerKey, ERC20 _erc20, uint256 _packed ) internal { assembly { mstore(0x20, _erc20) mstore(0x0c, _SELLER_BALANCE_SLOT_SEED) - mstore(0x00, shr(0xc, _sellerKey)) + mstore(0x00, _sellerKey) let _loc := keccak256(0x0c, 0x34) sstore(add(_loc, 0x01), _packed) } } function _addSellerBalance( - uint256 _sellerKey, + address _sellerKey, ERC20 _erc20, uint256 _amount ) internal { assembly { mstore(0x20, _erc20) mstore(0x0c, _SELLER_BALANCE_SLOT_SEED) - mstore(0x00, shr(0xc, _sellerKey)) + mstore(0x00, _sellerKey) let _loc := add(keccak256(0x0c, 0x34), 0x01) sstore(_loc, add(sload(_loc), _amount)) } } function _decSellerBalance( - uint256 _sellerKey, + address _sellerKey, ERC20 _erc20, uint256 _amount ) internal { assembly { mstore(0x20, _erc20) mstore(0x0c, _SELLER_BALANCE_SLOT_SEED) - mstore(0x00, shr(0xc, _sellerKey)) + mstore(0x00, _sellerKey) let _loc := add(keccak256(0x0c, 0x34), 0x01) sstore(_loc, sub(sload(_loc), _amount)) } } function __sellerBalance( - uint256 _sellerKey, + address _sellerKey, ERC20 _erc20 ) internal view returns (uint256 _packed) { assembly { mstore(0x20, _erc20) mstore(0x0c, _SELLER_BALANCE_SLOT_SEED) - mstore(0x00, shr(0xc, _sellerKey)) + mstore(0x00, _sellerKey) _packed := sload(add(keccak256(0x0c, 0x34), 0x01)) } } diff --git a/contracts/core/DataTypes.sol b/contracts/core/DataTypes.sol index 690ee3a..05316c7 100644 --- a/contracts/core/DataTypes.sol +++ b/contracts/core/DataTypes.sol @@ -1,15 +1,33 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; +import { ERC20 } from "contracts/lib/tokens/ERC20.sol"; + library DataTypes { + struct DepositArgs { + string pixTarget; + bytes32 allowlistRoot; + ERC20 token; + uint96 amount; + bool valid; + } + + struct LockArgs { + address seller; + ERC20 token; + uint80 amount; + bytes32[] merkleProof; + uint256[] expiredLocks; + } + struct Lock { - uint256 sellerKey; uint256 counter; uint256 expirationBlock; bytes32 pixTarget; uint80 amount; address token; address buyerAddress; + address seller; } // prettier-ignore diff --git a/contracts/core/EventAndErrors.sol b/contracts/core/EventAndErrors.sol index 6238d5e..b70a468 100644 --- a/contracts/core/EventAndErrors.sol +++ b/contracts/core/EventAndErrors.sol @@ -28,7 +28,7 @@ interface EventAndErrors { event LockAdded( address indexed buyer, uint256 indexed lockID, - uint256 seller, + address seller, uint256 amount ); /// @dev 0x364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8 diff --git a/contracts/core/OwnerSettings.sol b/contracts/core/OwnerSettings.sol index 5cd8043..5f4f7dc 100644 --- a/contracts/core/OwnerSettings.sol +++ b/contracts/core/OwnerSettings.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import { ERC2771Context as ERC2771 } from "../lib/metatx/ERC2771Context.sol"; -import { ERC20, SafeTransferLib } from "../lib/utils/SafeTransferLib.sol"; -import { IReputation } from "../lib/interfaces/IReputation.sol"; -import { EventAndErrors } from "./EventAndErrors.sol"; -import { Constants } from "./Constants.sol"; -import { Owned } from "../lib/auth/Owned.sol"; +import { ERC2771Context as ERC2771 } from "contracts/lib/metatx/ERC2771Context.sol"; +import { ERC20, SafeTransferLib } from "contracts/lib/utils/SafeTransferLib.sol"; +import { IReputation } from "contracts/lib/interfaces/IReputation.sol"; +import { EventAndErrors } from "contracts/core/EventAndErrors.sol"; +import { Constants } from "contracts/core/Constants.sol"; +import { Owned } from "contracts/lib/auth/Owned.sol"; abstract contract OwnerSettings is Constants, @@ -121,7 +121,7 @@ abstract contract OwnerSettings is } iszero(returndatasize()) { /* */ } { - sstore(shl(12, mload(i)), true) + sstore(shl(0xc, mload(i)), true) i := add(i, 0x20) if iszero(lt(i, end)) { @@ -187,11 +187,11 @@ abstract contract OwnerSettings is } function sellerAllowList( - uint256 sellerKey + address sellerKey ) public view returns (bytes32 root) { assembly { mstore(0x0c, _SELLER_ALLOWLIST_SLOT_SEED) - mstore(0x00, shr(12, sellerKey)) + mstore(0x00, sellerKey) root := sload(keccak256(0x00, 0x20)) } } diff --git a/contracts/p2pix.sol b/contracts/p2pix.sol index 56569e5..a89c175 100644 --- a/contracts/p2pix.sol +++ b/contracts/p2pix.sol @@ -8,9 +8,9 @@ pragma solidity 0.8.19; /// |__| |__| /// -import { OwnerSettings, ERC20, SafeTransferLib } from "./core/OwnerSettings.sol"; -import { BaseUtils } from "./core/BaseUtils.sol"; -import { DataTypes as DT } from "./core/DataTypes.sol"; +import { OwnerSettings, ERC20, SafeTransferLib } from "contracts/core/OwnerSettings.sol"; +import { BaseUtils } from "contracts/core/BaseUtils.sol"; +import { DataTypes as DT } from "contracts/core/DataTypes.sol"; contract P2PIX is BaseUtils { @@ -18,6 +18,8 @@ contract P2PIX is BaseUtils { // solhint-disable no-inline-assembly // solhint-disable no-empty-blocks + using DT for DT.DepositArgs; + using DT for DT.LockArgs; using DT for DT.Lock; using DT for DT.LockStatus; @@ -53,55 +55,49 @@ contract P2PIX is BaseUtils { /// @notice Creates a deposit order based on a seller's /// offer of an amount of ERC20 tokens. /// @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. - /// as the deposit identifier. +/* /// @param _pixTarget Pix key destination provided by the offer's seller. */ +/* /// @param allowlistRoot Optional allow list merkleRoot update `bytes32` value. */ +/* /// as the deposit identifier. */ /// @dev Function sighash: 0xbfe07da6. function deposit( - address _token, - uint96 _amount, - string memory _pixTarget, - bool _valid, - bytes32 allowlistRoot + DT.DepositArgs calldata args ) public { - ERC20 t = ERC20(_token); - uint256 k = _castAddrToKey(msg.sender); - if (bytes(_pixTarget).length == 0) revert EmptyPixTarget(); - if (!allowedERC20s(t)) revert TokenDenied(); - uint256 _sellerBalance = __sellerBalance(k,t); + if (bytes(args.pixTarget).length == 0) revert EmptyPixTarget(); + if (!allowedERC20s(args.token)) revert TokenDenied(); + uint256 _sellerBalance = __sellerBalance(msg.sender, args.token); uint256 currBal = _sellerBalance & BITMASK_SB_ENTRY; - uint256 _newBal = uint256(currBal + _amount); + uint256 _newBal = uint256(currBal + args.amount); if (_newBal > MAXBALANCE_UPPERBOUND) revert MaxBalExceeded(); setReentrancyGuard(); - if (allowlistRoot != 0) { - setRoot(msg.sender, allowlistRoot); + if (args.allowlistRoot != 0) { + setRoot(msg.sender, args.allowlistRoot); } - bytes32 pixTargetCasted = getStr(_pixTarget); - uint256 validCasted = _castBool(_valid); + bytes32 pixTargetCasted = getStr(args.pixTarget); + uint256 validCasted = _castBool(args.valid); _setSellerBalance( - k, - t, + msg.sender, + args.token, (_newBal | (validCasted << BITPOS_VALID)), pixTargetCasted ); SafeTransferLib.safeTransferFrom( - t, + args.token, msg.sender, address(this), - _amount + args.amount ); clearReentrancyGuard(); - emit DepositAdded(msg.sender, _token, _amount); + emit DepositAdded(msg.sender, address(args.token), args.amount); } /// @notice Enables seller to invalidate future @@ -109,8 +105,7 @@ contract P2PIX is BaseUtils { /// @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 _sellerBalance = __sellerBalance(key, token); + uint256 _sellerBalance = __sellerBalance(msg.sender, token); if (_sellerBalance != 0) { uint256 _valid = _castBool(state); @@ -119,7 +114,7 @@ contract P2PIX is BaseUtils { (_sellerBalance & BITMASK_SB_ENTRY) | (_valid << BITPOS_VALID); - _setValidState(key, token, _sellerBalance); + _setValidState(msg.sender, token, _sellerBalance); emit ValidSet(msg.sender, address(token), state); } else revert NotInitialized(); @@ -127,78 +122,73 @@ contract P2PIX is BaseUtils { /// @notice Public method designed to lock an remaining amount of /// the deposit order of a seller. + /// @dev Transaction forwarding must leave `merkleProof` empty; + /// otherwise, the trustedForwarder must be previously added + /// to a seller whitelist. /// @dev This method can be performed either by: /// - An user allowed via the seller's allowlist; /// - An user with enough userRecord to lock the wished amount; /// @dev There can only exist a lock per each `_amount` partitioned /// from the total `remaining` value. /// @dev Locks can only be performed in valid orders. - /// @param _amount The deposit's remaining amount wished to be locked. - /// @param merkleProof This value should be: - /// - Provided as a pass if the `msg.sender` is in the seller's allowlist; - /// - Left empty otherwise; - /// @param expiredLocks An array of `bytes32` identifiers to be - /// provided so to unexpire locks using this transaction gas push. +/* /// @param _amount The deposit's remaining amount wished to be locked. */ +/* /// @param merkleProof This value should be: */ +/* /// - Provided as a pass if the `msg.sender` is in the seller's allowlist; */ +/* /// - Left empty otherwise; */ +/* /// @param expiredLocks An array of `bytes32` identifiers to be */ +/* /// provided so to unexpire locks using this transaction gas push. */ /// @return lockID The `bytes32` value returned as the lock identifier. /// @dev Function sighash: 0x03aaf306. function lock( - address _seller, - address _token, - uint80 _amount, - bytes32[] calldata merkleProof, - uint256[] calldata expiredLocks + DT.LockArgs calldata args ) public nonReentrant returns (uint256 lockID) { - unlockExpired(expiredLocks); + unlockExpired(args.expiredLocks); - ERC20 t = ERC20(_token); - if (!getValid(_seller, t)) revert InvalidDeposit(); + if (!getValid(args.seller, args.token)) revert InvalidDeposit(); - uint256 bal = getBalance(_seller, t); - if (bal < _amount) revert NotEnoughTokens(); + uint256 bal = getBalance(args.seller, args.token); + if (bal < args.amount) revert NotEnoughTokens(); - uint256 k = _castAddrToKey(_seller); - - uint256 cCounter = lockCounter + 1; + uint256 c = lockCounter + 1; if ( - mapLocks[cCounter].expirationBlock >= block.number + mapLocks[c].expirationBlock >= block.number ) revert NotExpired(); address sender; uint256 forwarder; (sender, forwarder) = _isTrustedForwarder(); + bytes32 _pixTarget = getPixTarget(args.seller, args.token); DT.Lock memory l = DT.Lock( - k, - cCounter, + c, (block.number + defaultLockBlocks), - getPixTarget(_seller, t), - _amount, - address(t), - sender + _pixTarget, + args.amount, + address(args.token), + sender, + args.seller ); - // transaction forwarding must leave `merkleProof` empty; - // otherwise, the trustedForwarder must be previously added - // to a seller whitelist. - if (merkleProof.length != 0) { - _merkleVerify(merkleProof, sellerAllowList(k), sender); - lockID = _addLock(bal, _amount, cCounter, l, t, k); + if (args.merkleProof.length != 0) { + _merkleVerify(args.merkleProof, sellerAllowList(args.seller), sender); + lockID = _addLock(bal, l); } else { if (l.amount <= REPUTATION_LOWERBOUND) { - lockID = _addLock(bal, _amount, cCounter, l, t, k); + lockID = _addLock(bal, l); } else { if (forwarder != 0) { - lockID = _addLock(bal, _amount, cCounter, l, t, k); + lockID = _addLock(bal, l); } else { - uint256 userCredit = userRecord[_castAddrToKey(msg.sender)]; - uint256 spendLimit; (spendLimit) = _limiter(userCredit / WAD); + uint256 spendLimit; uint256 userCredit = + userRecord[_castAddrToKey(msg.sender)]; + (spendLimit) = _limiter(userCredit / WAD); if ( l.amount > (spendLimit * WAD) || l.amount > LOCKAMOUNT_UPPERBOUND ) revert AmountNotAllowed(); - lockID = _addLock(bal, _amount, cCounter, l, t, k); + lockID = _addLock(bal, l); /* */}/* */}/* */} } @@ -285,12 +275,12 @@ contract P2PIX is BaseUtils { _notExpired(l); uint256 _sellerBalance = - __sellerBalance(l.sellerKey, ERC20(l.token)) & BITMASK_SB_ENTRY; + __sellerBalance(l.seller, ERC20(l.token)) & BITMASK_SB_ENTRY; if ((_sellerBalance + l.amount) > MAXBALANCE_UPPERBOUND) revert MaxBalExceeded(); - _addSellerBalance(l.sellerKey, ERC20(l.token), l.amount); + _addSellerBalance(l.seller, ERC20(l.token), l.amount); l.amount = 0; @@ -335,12 +325,11 @@ contract P2PIX is BaseUtils { if (getValid(msg.sender, token)) setValidState(token, false); - uint256 key = _castAddrToKey(msg.sender); _decBal( - (__sellerBalance(key, token) & BITMASK_SB_ENTRY), + (__sellerBalance(msg.sender, token) & BITMASK_SB_ENTRY), amount, token, - key + msg.sender ); // safeTransfer tokens to seller @@ -400,22 +389,18 @@ contract P2PIX is BaseUtils { function _addLock( uint256 _bal, - uint256 _amount, - uint256 _lockID, - DT.Lock memory _l, - ERC20 _t, - uint256 _k + DT.Lock memory _l ) internal returns(uint256 counter){ - mapLocks[_lockID] = _l; + mapLocks[_l.counter] = _l; - _decBal(_bal, _amount, _t, _k); + _decBal(_bal, _l.amount, ERC20(_l.token), _l.seller); ++lockCounter; - counter = _lockID; + counter = _l.counter; emit LockAdded( _l.buyerAddress, - _lockID, - _l.sellerKey, + _l.counter, + _l.seller, _l.amount ); } @@ -424,7 +409,7 @@ contract P2PIX is BaseUtils { uint256 _bal, uint256 _amount, ERC20 _t, - uint256 _k + address _k ) private { assembly { if iszero( @@ -561,7 +546,7 @@ contract P2PIX is BaseUtils { ); unchecked { for (c; c < len; ) { - if (mapLocks[ids[c]].sellerKey == 0x0) { + if (mapLocks[ids[c]].seller == address(0)) { sortedIDs[c] = ids[c]; status[c] = type(DT.LockStatus).min; ++c; diff --git a/scripts/1-deploy-mockToken.ts b/scripts/1-deploy-mockToken.ts index d2077f2..ee51795 100644 --- a/scripts/1-deploy-mockToken.ts +++ b/scripts/1-deploy-mockToken.ts @@ -5,7 +5,7 @@ import * as fs from "fs"; import { ethers, network } from "hardhat"; import hre from "hardhat"; -import { Deploys } from "../test/utils/fixtures"; +import { Deploys } from "../test/utils/interfaces"; let deploysJson: Deploys; const supply: BigNumber = ethers.utils.parseEther("20000000"); diff --git a/scripts/2-deploy-p2pix.ts b/scripts/2-deploy-p2pix.ts index d308202..b053478 100644 --- a/scripts/2-deploy-p2pix.ts +++ b/scripts/2-deploy-p2pix.ts @@ -4,7 +4,7 @@ import * as fs from "fs"; import { ethers, network } from "hardhat"; import hre from "hardhat"; -import { Deploys } from "../test/utils/fixtures"; +import { Deploys } from "../test/utils/interfaces"; let deploysJson: Deploys; diff --git a/scripts/setDefaultBlocks.ts b/scripts/setDefaultBlocks.ts index 9482af6..7d45330 100644 --- a/scripts/setDefaultBlocks.ts +++ b/scripts/setDefaultBlocks.ts @@ -2,7 +2,7 @@ import "@nomiclabs/hardhat-ethers"; import "@nomiclabs/hardhat-etherscan"; import * as fs from "fs"; import { ethers, network } from "hardhat"; -import { Deploys } from "../test/utils/fixtures"; +import { Deploys } from "../test/utils/interfaces"; import { P2PIX__factory } from "../src/types"; let deploysJson: Deploys; diff --git a/src/types/core/BaseUtils.ts b/src/types/core/BaseUtils.ts index 950cc5a..a1f91f4 100644 --- a/src/types/core/BaseUtils.ts +++ b/src/types/core/BaseUtils.ts @@ -37,7 +37,7 @@ export interface BaseUtilsInterface extends utils.Interface { "isTrustedForwarder(address)": FunctionFragment; "owner()": FunctionFragment; "reputation()": FunctionFragment; - "sellerAllowList(uint256)": FunctionFragment; + "sellerAllowList(address)": FunctionFragment; "setDefaultLockBlocks(uint256)": FunctionFragment; "setOwner(address)": FunctionFragment; "setReputation(address)": FunctionFragment; @@ -102,7 +102,7 @@ export interface BaseUtilsInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "sellerAllowList", - values: [PromiseOrValue] + values: [PromiseOrValue] ): string; encodeFunctionData( functionFragment: "setDefaultLockBlocks", @@ -207,7 +207,7 @@ export interface BaseUtilsInterface extends utils.Interface { "DepositAdded(address,address,uint256)": EventFragment; "DepositWithdrawn(address,address,uint256)": EventFragment; "FundsWithdrawn(address,uint256)": EventFragment; - "LockAdded(address,uint256,uint256,uint256)": EventFragment; + "LockAdded(address,uint256,address,uint256)": EventFragment; "LockBlocksUpdated(uint256)": EventFragment; "LockReleased(address,uint256,uint256)": EventFragment; "LockReturned(address,uint256)": EventFragment; @@ -286,11 +286,11 @@ export type FundsWithdrawnEventFilter = TypedEventFilter; export interface LockAddedEventObject { buyer: string; lockID: BigNumber; - seller: BigNumber; + seller: string; amount: BigNumber; } export type LockAddedEvent = TypedEvent< - [string, BigNumber, BigNumber, BigNumber], + [string, BigNumber, string, BigNumber], LockAddedEventObject >; @@ -457,7 +457,7 @@ export interface BaseUtils extends BaseContract { reputation(overrides?: CallOverrides): Promise<[string]>; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise<[string] & { root: string }>; @@ -540,7 +540,7 @@ export interface BaseUtils extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -623,7 +623,7 @@ export interface BaseUtils extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -710,7 +710,7 @@ export interface BaseUtils extends BaseContract { ): FundsWithdrawnEventFilter; FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter; - "LockAdded(address,uint256,uint256,uint256)"( + "LockAdded(address,uint256,address,uint256)"( buyer?: PromiseOrValue | null, lockID?: PromiseOrValue | null, seller?: null, @@ -828,7 +828,7 @@ export interface BaseUtils extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -912,7 +912,7 @@ export interface BaseUtils extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; diff --git a/src/types/core/EventAndErrors.ts b/src/types/core/EventAndErrors.ts index b988e9a..7dbbe0f 100644 --- a/src/types/core/EventAndErrors.ts +++ b/src/types/core/EventAndErrors.ts @@ -27,7 +27,7 @@ export interface EventAndErrorsInterface extends utils.Interface { "DepositAdded(address,address,uint256)": EventFragment; "DepositWithdrawn(address,address,uint256)": EventFragment; "FundsWithdrawn(address,uint256)": EventFragment; - "LockAdded(address,uint256,uint256,uint256)": EventFragment; + "LockAdded(address,uint256,address,uint256)": EventFragment; "LockBlocksUpdated(uint256)": EventFragment; "LockReleased(address,uint256,uint256)": EventFragment; "LockReturned(address,uint256)": EventFragment; @@ -104,11 +104,11 @@ export type FundsWithdrawnEventFilter = TypedEventFilter; export interface LockAddedEventObject { buyer: string; lockID: BigNumber; - seller: BigNumber; + seller: string; amount: BigNumber; } export type LockAddedEvent = TypedEvent< - [string, BigNumber, BigNumber, BigNumber], + [string, BigNumber, string, BigNumber], LockAddedEventObject >; @@ -273,7 +273,7 @@ export interface EventAndErrors extends BaseContract { ): FundsWithdrawnEventFilter; FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter; - "LockAdded(address,uint256,uint256,uint256)"( + "LockAdded(address,uint256,address,uint256)"( buyer?: PromiseOrValue | null, lockID?: PromiseOrValue | null, seller?: null, diff --git a/src/types/core/OwnerSettings.ts b/src/types/core/OwnerSettings.ts index e75e6b7..7cb9f77 100644 --- a/src/types/core/OwnerSettings.ts +++ b/src/types/core/OwnerSettings.ts @@ -34,7 +34,7 @@ export interface OwnerSettingsInterface extends utils.Interface { "isTrustedForwarder(address)": FunctionFragment; "owner()": FunctionFragment; "reputation()": FunctionFragment; - "sellerAllowList(uint256)": FunctionFragment; + "sellerAllowList(address)": FunctionFragment; "setDefaultLockBlocks(uint256)": FunctionFragment; "setOwner(address)": FunctionFragment; "setReputation(address)": FunctionFragment; @@ -82,7 +82,7 @@ export interface OwnerSettingsInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "sellerAllowList", - values: [PromiseOrValue] + values: [PromiseOrValue] ): string; encodeFunctionData( functionFragment: "setDefaultLockBlocks", @@ -170,7 +170,7 @@ export interface OwnerSettingsInterface extends utils.Interface { "DepositAdded(address,address,uint256)": EventFragment; "DepositWithdrawn(address,address,uint256)": EventFragment; "FundsWithdrawn(address,uint256)": EventFragment; - "LockAdded(address,uint256,uint256,uint256)": EventFragment; + "LockAdded(address,uint256,address,uint256)": EventFragment; "LockBlocksUpdated(uint256)": EventFragment; "LockReleased(address,uint256,uint256)": EventFragment; "LockReturned(address,uint256)": EventFragment; @@ -249,11 +249,11 @@ export type FundsWithdrawnEventFilter = TypedEventFilter; export interface LockAddedEventObject { buyer: string; lockID: BigNumber; - seller: BigNumber; + seller: string; amount: BigNumber; } export type LockAddedEvent = TypedEvent< - [string, BigNumber, BigNumber, BigNumber], + [string, BigNumber, string, BigNumber], LockAddedEventObject >; @@ -405,7 +405,7 @@ export interface OwnerSettings extends BaseContract { reputation(overrides?: CallOverrides): Promise<[string]>; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise<[string] & { root: string }>; @@ -468,7 +468,7 @@ export interface OwnerSettings extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -531,7 +531,7 @@ export interface OwnerSettings extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -613,7 +613,7 @@ export interface OwnerSettings extends BaseContract { ): FundsWithdrawnEventFilter; FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter; - "LockAdded(address,uint256,uint256,uint256)"( + "LockAdded(address,uint256,address,uint256)"( buyer?: PromiseOrValue | null, lockID?: PromiseOrValue | null, seller?: null, @@ -716,7 +716,7 @@ export interface OwnerSettings extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -780,7 +780,7 @@ export interface OwnerSettings extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; diff --git a/src/types/factories/core/BaseUtils__factory.ts b/src/types/factories/core/BaseUtils__factory.ts index 864435a..ba43701 100644 --- a/src/types/factories/core/BaseUtils__factory.ts +++ b/src/types/factories/core/BaseUtils__factory.ts @@ -217,9 +217,9 @@ const _abi = [ }, { indexed: false, - internalType: "uint256", + internalType: "address", name: "seller", - type: "uint256", + type: "address", }, { indexed: false, @@ -533,9 +533,9 @@ const _abi = [ { inputs: [ { - internalType: "uint256", + internalType: "address", name: "sellerKey", - type: "uint256", + type: "address", }, ], name: "sellerAllowList", diff --git a/src/types/factories/core/EventAndErrors__factory.ts b/src/types/factories/core/EventAndErrors__factory.ts index 9039b98..ec7d5d2 100644 --- a/src/types/factories/core/EventAndErrors__factory.ts +++ b/src/types/factories/core/EventAndErrors__factory.ts @@ -210,9 +210,9 @@ const _abi = [ }, { indexed: false, - internalType: "uint256", + internalType: "address", name: "seller", - type: "uint256", + type: "address", }, { indexed: false, diff --git a/src/types/factories/core/OwnerSettings__factory.ts b/src/types/factories/core/OwnerSettings__factory.ts index 0ce0e26..c009df8 100644 --- a/src/types/factories/core/OwnerSettings__factory.ts +++ b/src/types/factories/core/OwnerSettings__factory.ts @@ -215,9 +215,9 @@ const _abi = [ }, { indexed: false, - internalType: "uint256", + internalType: "address", name: "seller", - type: "uint256", + type: "address", }, { indexed: false, @@ -474,9 +474,9 @@ const _abi = [ { inputs: [ { - internalType: "uint256", + internalType: "address", name: "sellerKey", - type: "uint256", + type: "address", }, ], name: "sellerAllowList", diff --git a/src/types/factories/p2pix.sol/P2PIX__factory.ts b/src/types/factories/p2pix.sol/P2PIX__factory.ts index 55d5c36..e808325 100644 --- a/src/types/factories/p2pix.sol/P2PIX__factory.ts +++ b/src/types/factories/p2pix.sol/P2PIX__factory.ts @@ -255,9 +255,9 @@ const _abi = [ }, { indexed: false, - internalType: "uint256", + internalType: "address", name: "seller", - type: "uint256", + type: "address", }, { indexed: false, @@ -507,29 +507,36 @@ const _abi = [ { inputs: [ { - internalType: "address", - name: "_token", - type: "address", - }, - { - internalType: "uint96", - name: "_amount", - type: "uint96", - }, - { - internalType: "string", - name: "_pixTarget", - type: "string", - }, - { - internalType: "bool", - name: "_valid", - type: "bool", - }, - { - internalType: "bytes32", - name: "allowlistRoot", - type: "bytes32", + components: [ + { + internalType: "string", + name: "pixTarget", + type: "string", + }, + { + internalType: "bytes32", + name: "allowlistRoot", + type: "bytes32", + }, + { + internalType: "contract ERC20", + name: "token", + type: "address", + }, + { + internalType: "uint96", + name: "amount", + type: "uint96", + }, + { + internalType: "bool", + name: "valid", + type: "bool", + }, + ], + internalType: "struct DataTypes.DepositArgs", + name: "args", + type: "tuple", }, ], name: "deposit", @@ -722,29 +729,36 @@ const _abi = [ { inputs: [ { - internalType: "address", - name: "_seller", - type: "address", - }, - { - internalType: "address", - name: "_token", - type: "address", - }, - { - internalType: "uint80", - name: "_amount", - type: "uint80", - }, - { - internalType: "bytes32[]", - name: "merkleProof", - type: "bytes32[]", - }, - { - internalType: "uint256[]", - name: "expiredLocks", - type: "uint256[]", + components: [ + { + internalType: "address", + name: "seller", + type: "address", + }, + { + internalType: "contract ERC20", + name: "token", + type: "address", + }, + { + internalType: "uint80", + name: "amount", + type: "uint80", + }, + { + internalType: "bytes32[]", + name: "merkleProof", + type: "bytes32[]", + }, + { + internalType: "uint256[]", + name: "expiredLocks", + type: "uint256[]", + }, + ], + internalType: "struct DataTypes.LockArgs", + name: "args", + type: "tuple", }, ], name: "lock", @@ -781,11 +795,6 @@ const _abi = [ ], name: "mapLocks", outputs: [ - { - internalType: "uint256", - name: "sellerKey", - type: "uint256", - }, { internalType: "uint256", name: "counter", @@ -816,6 +825,11 @@ const _abi = [ name: "buyerAddress", type: "address", }, + { + internalType: "address", + name: "seller", + type: "address", + }, ], stateMutability: "view", type: "function", @@ -882,9 +896,9 @@ const _abi = [ { inputs: [ { - internalType: "uint256", + internalType: "address", name: "sellerKey", - type: "uint256", + type: "address", }, ], name: "sellerAllowList", @@ -1129,7 +1143,7 @@ const _abi = [ ]; const _bytecode = - "0x608060405262002c0a80380380620000178162000126565b928339810160a0828203126200010b5781516020808401519093916001600160401b03918281116200010b5784620000519185016200017f565b9062000060604085016200016a565b9260608501518181116200010b57866200007c9187016200017f565b9460808101519182116200010b57019480601f870112156200010b578551620000af620000a98262000152565b62000126565b96888089848152019260051b8201019283116200010b578801905b828210620000f157505050620000e19550620001e6565b6040516127c89081620004428239f35b815180151581036200010b578152908801908801620000ca565b600080fd5b634e487b7160e01b600052604160045260246000fd5b6040519190601f01601f191682016001600160401b038111838210176200014c57604052565b62000110565b6001600160401b0381116200014c5760051b60200190565b51906001600160a01b03821682036200010b57565b9080601f830112156200010b578151906200019e620000a98362000152565b9182938184526020808095019260051b8201019283116200010b578301905b828210620001cc575050505090565b838091620001da846200016a565b815201910190620001bd565b600080546001600160a01b031916339081178255929695949392817f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768180a3816003556040519182527f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851160208093a18651878301979060051b810183013d1515895b811562000306575b5050506040519280840191818552518092526040840198925b828110620002e85750505050907f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d782620002d593620002db97980390a16001600160a01b031662000337565b62000390565b620002e66001600455565b565b83516001600160a01b03168a52988101989281019260010162000289565b9085826001829697989451600c1b550190838210156200032c5791509493929462000268565b509493929462000270565b6000546001600160a01b0390811633036200037f57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1565b6040516282b42960e81b8152600490fd5b60008054919290916001600160a01b031633036200037f5782519182156200043457815183036200042757602092919284818080970195019360051b0101925b838103620003df575050505050565b84809181600c63cbc9d1c48152825186528651918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8680a301920191620003d0565b63ff633a3890526004601cfd5b63df95788390526004601cfdfe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806304937320146102365780630d2a2d441461023157806313af40351461022c578063367821f014610227578063461f3120146101d757806349ef8448146102225780634b2ae9801461021d578063572b6c0514610218578063574983c8146102135780635fd8c7101461020e57806369cc6af4146102095780636d82d9e01461020457806377cd38a4146101ff5780637f94f65d146101fa57806380e1d302146101f557806384ab1d28146101f05780638da5cb5b146101eb5780638db564c2146101e6578063918dff57146101e15780639872dbfe146101dc57806398a26871146101d75780639b6d694d146101d2578063ad8f2eed146101cd578063b0983d39146101c8578063c52164c6146101c3578063c593dfd8146101be578063d1c07028146101b9578063d1ced2b0146101b4578063d4fac45d146101af578063d6e8b973146101aa578063dc43221c146101a5578063e449c52a146101a0578063f7d0e04b1461019b5763fb8c5ef00361000e57611532565b6114c2565b611487565b6113ec565b61133a565b611321565b611272565b61112c565b610dfb565b610dc7565b610d8d565b610d49565b610cd9565b6105eb565b610c46565b610bbb565b610b7a565b610b46565b610b10565b610af7565b610aa6565b610a6e565b610917565b6108ca565b610847565b6107e3565b610793565b610769565b6106ce565b610559565b6104c7565b61039a565b346102625760206003193601126102625760043560005260076020526020604060002054604051908152f35b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176102d757604052565b610267565b6040519060e0820182811067ffffffffffffffff8211176102d757604052565b67ffffffffffffffff81116102d75760051b60200190565b73ffffffffffffffffffffffffffffffffffffffff81160361026257565b81601f8201121561026257803591610349836102fc565b926103576040519485610296565b808452602092838086019260051b820101928311610262578301905b828210610381575050505090565b838091833561038f81610314565b815201910190610373565b34610262576020806003193601126102625760043567ffffffffffffffff8111610262576103cc903690600401610332565b9073ffffffffffffffffffffffffffffffffffffffff918260005416330361049d57805181830192849160051b830181013d1515855b8115610469575b50505060405192818401908285525180915260408401949160005b828110610453577f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d786880387a1005b8351851687529581019592810192600101610424565b90838260018298969499979951600c1b55019083821015610491579150959395949294610402565b50959395949294610409565b60046040517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576004356104e481610314565b600090815473ffffffffffffffffffffffffffffffffffffffff808216330361049d577fffffffffffffffffffffffff0000000000000000000000000000000000000000921691829116178255337f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768380a380f35b3461026257602060031936011261026257600435600052600660205260e060406000208054906005600182015491600281015460038201549060048301549273ffffffffffffffffffffffffffffffffffffffff9485910154169460405196875260208701526040860152606085015269ffffffffffffffffffff8116608085015260501c1660a083015260c0820152f35b34610262576020600319360112610262576020600435546040519015158152f35b90815180825260208080930193019160005b82811061062c575050505090565b83518552938101939281019260010161061e565b906106539060408352604083019061060c565b81810360209283015282518082529082019282019160009190825b82811061067d57505050505090565b909192939485516004808210156106a25750815282019482019392919060010161066e565b8660216024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b34610262576020806003193601126102625760043567ffffffffffffffff811161026257366023820112156102625780600401359061070c826102fc565b9161071a6040519384610296565b80835260248484019160051b8301019136831161026257602401905b82821061075a576107468461262e565b9061075660405192839283610640565b0390f35b81358152908401908401610736565b3461026257602060031936011261026257602060043561078881610314565b60405190600c1b8152f35b346102625760206003193601126102625773ffffffffffffffffffffffffffffffffffffffff6004356107c581610314565b166000526001602052602060ff604060002054166040519015158152f35b346102625760206003193601126102625760043573ffffffffffffffffffffffffffffffffffffffff60005416330361049d576020817f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851192600355604051908152a1005b34610262576000806003193601126108c75773ffffffffffffffffffffffffffffffffffffffff815416330361049d57478180808084335af1156108ba576040805133815260208101929092527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91a180f35b63b12d13eb82526004601cfd5b80fd5b346102625760206003193601126102625760206109006004356108ec81610314565b63cbc9d1c4600c526000526020600c205490565b6040519015158152f35b3590811515820361026257565b346102625760406003193601126102625760043561093481610314565b602435801515810361026257602082905263739094b1600c9081527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff331660005260349020600101548015610a44577fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4991610a3f918460205263739094b1600c527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff33166000526b3fffffffffffffffffffffff82605f1b91161760016034600c20015560405191829173ffffffffffffffffffffffffffffffffffffffff3396168390929160209073ffffffffffffffffffffffffffffffffffffffff60408401951683521515910152565b0390a2005b60046040517f87138d5c000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576020610a9e6004356374dfee70600c52600c1c60005260206000205490565b604051908152f35b3461026257604060031936011261026257610019600435610ac681610314565b60243590612221565b600319604091011261026257600435610ae781610314565b90602435610af481610314565b90565b34610262576020610900610b0a36610acf565b9061253c565b3461026257602060031936011261026257602060405173ffffffffffffffffffffffffffffffffffffffff600435600c1c168152f35b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b34610262576000600319360112610262576020600554604051908152f35b60005b838110610bab5750506000910152565b8181015183820152602001610b9b565b3461026257610bd2610bcc36610acf565b90612579565b604051906020820190815260208252604082019180831067ffffffffffffffff8411176102d7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60409385855260208652610c3d845180928160608801526080870190610b98565b01168101030190f35b34610262576000600319360112610262576020600354604051908152f35b81601f820112156102625780359067ffffffffffffffff82116102d75760405192610cb760207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8601160185610296565b8284526020838301011161026257816000926020809301838601378301015290565b346102625760a060031936011261026257600435610cf681610314565b602435906bffffffffffffffffffffffff821682036102625760443567ffffffffffffffff811161026257610d2f903690600401610c64565b6064359081151582036102625761001993608435936116cf565b34610262576020610a9e610bcc36610acf565b9181601f840112156102625782359167ffffffffffffffff8311610262576020808501948460051b01011161026257565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610dc1610019913690600401610d5c565b90612023565b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346102625760a06003193601126102625760043560843560ff8116810361026257610e246118c5565b610e38826000526006602052604060002090565b6004810180549169ffffffffffffffffffff83169283156110f15760028201805443116110c75784600584610f5d7f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8996000610fac96610f56610fdf9b610f2e89610ef2610f1e610fc69f6003015460405192839160208301956024359187917fffffffffffffffffffff0000000000000000000000000000000000000000000090604a9492845260b01b166020830152602a8201520190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610296565b5190209560643560443588611ea8565b7fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008154169055565b5560019055565b610f65611e33565b905015610ffa575b019273ffffffffffffffffffffffffffffffffffffffff610fa2855473ffffffffffffffffffffffffffffffffffffffff1690565b9160501c16611f96565b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b60408051948552602085019290925292a26100196001600455565b81810161101e610fc6825473ffffffffffffffffffffffffffffffffffffffff1690565b33146110a45761109d61109561108561107f697fffffffffffffffffff8a60011c169461105833600c1b6000526007602052604060002090565b6110638782546116c2565b90555473ffffffffffffffffffffffffffffffffffffffff1690565b600c1b90565b6000526007602052604060002090565b9182546116c2565b9055610f6d565b506110bc33600c1b6000526007602052604060002090565b61109d8482546116c2565b60046040517ff6fafba0000000000000000000000000000000000000000000000000000000008152fd5b60046040517f63b4904e000000000000000000000000000000000000000000000000000000008152fd5b906020610af492818152019061060c565b346102625760406003193601126102625760043567ffffffffffffffff81116102625761115d903690600401610332565b6024359061116a82610314565b600091815191611179836125cb565b935b8381106111905760405180610756878261111b565b806111bd8473ffffffffffffffffffffffffffffffffffffffff6111b66001958761261a565b5116612502565b6111c7828861261a565b520161117b565b9060406003198301126102625767ffffffffffffffff9160043583811161026257816111fc91600401610332565b92602435908111610262578160238201121561026257806004013591611221836102fc565b9261122f6040519485610296565b80845260209260248486019260051b82010192831161026257602401905b82821061125b575050505090565b8380916112678461090a565b81520191019061124d565b3461026257611280366111ce565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d57825190811561131f57805182036113125790602084818080970194019260051b0101915b8281036112d0578380f35b8480916001825280518652835180604088205581517fbee55516e29d3969d3cb8eb01351eb3c52d06f9e2435bd5a8bfe3647e185df928880a3019101906112c5565b63ff633a3883526004601cfd5bfe5b34610262576020610a9e61133436610acf565b90612502565b3461026257611348366111ce565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156113df57805182036113125790602084818080970194019260051b0101915b828103611398578380f35b84809181600c63cbc9d1c48152825188528551918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8880a30191019061138d565b63df95788383526004601cfd5b346102625760a06003193601126102625760043561140981610314565b6024359061141682610314565b6044359169ffffffffffffffffffff831683036102625767ffffffffffffffff916064358381116102625761144f903690600401610d5c565b90608435948511610262576107569561146f611477963690600401610d5c565b959094611a2f565b6040519081529081906020820190565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610a9e6114bd6020923690600401610c64565b61164a565b34610262576020600319360112610262576004356114df81610314565b73ffffffffffffffffffffffffffffffffffffffff8060005416330361049d57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1005b346102625760606003193601126102625760043561154f81610314565b60243560443567ffffffffffffffff8111610262577f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e916115a861159a611632933690600401610d5c565b906115a36118c5565b612023565b6115b2843361253c565b61163c575b6115f633600c1b85836b3fffffffffffffffffffffff6115f083859060205263739094b1600c52600c1c60005260016034600c20015490565b166124c3565b611601813386611f96565b6040805173ffffffffffffffffffffffffffffffffffffffff95909516855260208501919091523393918291820190565b0390a26001600455005b61164584611959565b6115b7565b604051611674602082816116678183019687815193849201610b98565b8101038084520182610296565b5160201061131f575190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b90600182018092116116bd57565b611680565b919082018092116116bd57565b939273ffffffffffffffffffffffffffffffffffffffff85169333600c1b9484511561189b576117146117108263cbc9d1c4600c526000526020600c205490565b1590565b611871576b3fffffffffffffffffffffff61174882889060205263739094b1600c52600c1c60005260016034600c20015490565b16916117636bffffffffffffffffffffffff861680946116c2565b936a52b7d2dcc80cd2e40000008511611847577f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf97836117eb966117bc6118329a6117e2966117b06118c5565b80611837575b5061164a565b93605f1b17919060205263739094b1600c52600c1c6000526034600c2090600182015555565b30903390611900565b6117f56001600455565b6040805173ffffffffffffffffffffffffffffffffffffffff90951685526bffffffffffffffffffffffff90911660208501523393918291820190565b0390a2565b6118419033612221565b386117b6565b60046040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1578328e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6a3bc53e000000000000000000000000000000000000000000000000000000008152fd5b6002600454146118d6576002600455565b60046040517fab143c06000000000000000000000000000000000000000000000000000000008152fd5b601c600060649281946020966040519860605260405260601b602c526f23b872dd000000000000000000000000600c525af13d1560016000511417161561194b576000606052604052565b637939f4246000526004601cfd5b602081905263739094b1600c9081527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff331660005260349020600101548015610a44576b3fffffffffffffffffffffff908260205263739094b1600c527e0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff33166000521660016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405191168152600060208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2565b9295611a559073ffffffffffffffffffffffffffffffffffffffff9395966115a36118c5565b1691611a64611710848461253c565b611ce557611a728383612502565b9469ffffffffffffffffffff80831691828810611cbb5784600c1b96611a996005546116af565b946002611ab0876000526006602052604060002090565b0154431115611c9157611ac1611e33565b611ada8a611ad4600398949854436116c2565b9a612579565b611ae26102dc565b998c8b528960208c015260408b015260608a0152611b1060808a0193849069ffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8a1660a08a015273ffffffffffffffffffffffffffffffffffffffff861660c08a01528315611b8e5750505091611b7c91611b819993611b768a6374dfee70600c52600c1c60005260206000205490565b91611d2c565b6122bf565b90611b8c6001600455565b565b9250819450809350611bb468056bc75e2d63100000925169ffffffffffffffffffff1690565b1611611bcb57505050611bc6956122bf565b611b81565b15611bdb575050611bc6956122bf565b611c0c611c07611bf833600c1b6000526007602052604060002090565b54670de0b6b3a7640000900490565b611dba565b81611c2a611c24855169ffffffffffffffffffff1690565b92611d0f565b911611918215611c6e575b5050611c4457611bc6956122bf565b60046040517f1c18f846000000000000000000000000000000000000000000000000000000008152fd5b5169d3c21bcecceda1000000925069ffffffffffffffffffff1616113880611c35565b60046040517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b60046040517f22bbb43c000000000000000000000000000000000000000000000000000000008152fd5b60046040517fb2e532de000000000000000000000000000000000000000000000000000000008152fd5b90670de0b6b3a7640000918281029281840414901517156116bd57565b73ffffffffffffffffffffffffffffffffffffffff8293941692611d7e575b505003611d5457565b60046040517f3b8474be000000000000000000000000000000000000000000000000000000008152fd5b60059291831b8101915b8135808211851b918252602080921852604060002091019282841015611daf579290611d88565b509150503880611d4b565b6040519060208201907f4d2b1791000000000000000000000000000000000000000000000000000000008252602483015260248252606082019082821067ffffffffffffffff8311176102d7576020926000926040525190600254617530fa906000519115611e2557565b63e10bf1cc6000526004601cfd5b611e3b611e61565b90600073ffffffffffffffffffffffffffffffffffffffff83163314610af45750600190565b33600052600160205260ff60406000205416600014611ea4577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b3390565b918254611f6c5760806020927f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1948452600094859384927b19457468657265756d205369676e6564204d6573736167653a0a3332845260ff603c600420996040519a865216875260405280606052105afa508051903d15611f5f576060526040829052600c1b5415611f375750565b807f815e1d640000000000000000000000000000000000000000000000000000000060049252fd5b638baa579f90526004601cfd5b60046040517ff490a6ea000000000000000000000000000000000000000000000000000000008152fd5b60109260209260145260345260446000938480936fa9059cbb00000000000000000000000082525af13d156001835114171615611fd257603452565b6390b8ec1890526004601cfd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b919081101561201e5760051b0190565b611fdf565b6000905b82821061204457501061203657565b63dfb035c96000526004601cfd5b9061206461205382858561200e565b356000526006602052604060002090565b61206d81612270565b80549060048082019081549073ffffffffffffffffffffffffffffffffffffffff94858360501c16916a52b7d2dcc80cd2e40000006120ea69ffffffffffffffffffff6b3fffffffffffffffffffffff6120e087879060205263739094b1600c52600c1c60005260016034600c20015490565b16961680966116c2565b116121f95750936121477f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da594610f2e6121bd9560059560019b9a999060205263739094b1600c52600c1c60005260016034600c2001908154019055565b0161216961107f825473ffffffffffffffffffffffffffffffffffffffff1690565b612187612180826000526007602052604060002090565b5460011c90565b68056bc75e2d6310000081116121de57506121af610fac916000526007602052604060002090565b68056bc75e2d631000009055565b916121c984888861200e565b60405190358152921691602090a20190612027565b906121f3906000526007602052604060002090565b55610fac565b6040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b338103612262576374dfee70600c5280600052816020600020557f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632600080a3565b6385d1f7266000526004601cfd5b60028101544310611c91576004015469ffffffffffffffffffff16156110f157565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146116bd5760010190565b9261244c61240597967f8fb3989f70bd172a37d15b41b015e48ea09d59329638377304a4198cd0c4ea65949673ffffffffffffffffffffffffffffffffffffffff94612358978960005260066020526124476040600020875181556020880151600182015560408801516002820155606088015160038201556123e36004820161238f60808b019d8e5169ffffffffffffffffffff1690565b829069ffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffff00000000000000000000825416179055565b60a08a015181547fffff0000000000000000000000000000000000000000ffffffffffffffffffff1660509190911b7dffffffffffffffffffffffffffffffffffffffff0000000000000000000016179055565b600560c089019e8f5173ffffffffffffffffffffffffffffffffffffffff1690565b91019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b6124c3565b61245f61245a600554612292565b600555565b6124be61249761248487995173ffffffffffffffffffffffffffffffffffffffff1690565b9251955169ffffffffffffffffffff1690565b60405193849316958390929169ffffffffffffffffffff6020916040840195845216910152565b0390a3565b9291909280848103119015176124f45760205263739094b1600c52600c1c60005260016034600c2001908154039055565b63ce3a3d376000526004601cfd5b600092913d15612510575050565b9091925060205263739094b1600c5260005260016034600c2001546b3fffffffffffffffffffffff1690565b600092913d1561254a575050565b9091925060205263739094b1600c5260005260016034600c200154605f1c6b3fffffffffffffffffffffff1690565b600092913d15612587575050565b9091925060205263739094b1600c526000526034600c205490565b6040516020810181811067ffffffffffffffff8211176102d75760405260008152906000368137565b906125d5826102fc565b6125e26040519182610296565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061261082946102fc565b0190602036910137565b805182101561201e5760209160051b010190565b9081511561277f5760008092805190612646826125cb565b92612650836125cb565b955b83811061266157505050509190565b806126826126716001938661261a565b516000526006602052604060002090565b546126b257612691818561261a565b5161269c828861261a565b52826126a8828a61261a565b5201925b92612652565b69ffffffffffffffffffff6126e060046126cf612671858961261a565b015469ffffffffffffffffffff1690565b16612715576126ef818561261a565b516126fa828861261a565b5261270e612708828a61261a565b60039052565b01926126ac565b6002612724612671838761261a565b015443111561275657612737818561261a565b51612742828861261a565b5261270e612750828a61261a565b60029052565b612760818561261a565b5161276b828861261a565b5261270e612779828a61261a565b60019052565b90506127896125a2565b90610af46125a256fea2646970667358221220056553307dee1aafd24d123d47fdccee5a2997cae6422e600d53cea9c80a955b64736f6c63430008130033"; + "0x608060405262002d4680380380620000178162000126565b928339810160a0828203126200010b5781516020808401519093916001600160401b03918281116200010b5784620000519185016200017f565b9062000060604085016200016a565b9260608501518181116200010b57866200007c9187016200017f565b9460808101519182116200010b57019480601f870112156200010b578551620000af620000a98262000152565b62000126565b96888089848152019260051b8201019283116200010b578801905b828210620000f157505050620000e19550620001e6565b6040516129049081620004428239f35b815180151581036200010b578152908801908801620000ca565b600080fd5b634e487b7160e01b600052604160045260246000fd5b6040519190601f01601f191682016001600160401b038111838210176200014c57604052565b62000110565b6001600160401b0381116200014c5760051b60200190565b51906001600160a01b03821682036200010b57565b9080601f830112156200010b578151906200019e620000a98362000152565b9182938184526020808095019260051b8201019283116200010b578301905b828210620001cc575050505090565b838091620001da846200016a565b815201910190620001bd565b600080546001600160a01b031916339081178255929695949392817f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768180a3816003556040519182527f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851160208093a18651878301979060051b810183013d1515895b811562000306575b5050506040519280840191818552518092526040840198925b828110620002e85750505050907f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d782620002d593620002db97980390a16001600160a01b031662000337565b62000390565b620002e66001600455565b565b83516001600160a01b03168a52988101989281019260010162000289565b9085826001829697989451600c1b550190838210156200032c5791509493929462000268565b509493929462000270565b6000546001600160a01b0390811633036200037f57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1565b6040516282b42960e81b8152600490fd5b60008054919290916001600160a01b031633036200037f5782519182156200043457815183036200042757602092919284818080970195019360051b0101925b838103620003df575050505050565b84809181600c63cbc9d1c48152825186528651918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8680a301920191620003d0565b63ff633a3890526004601cfd5b63df95788390526004601cfdfe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806304937320146102365780630d2a2d441461023157806313af40351461022c5780631e3c017a146102275780631e9bb57314610222578063367821f01461021d5780633c16f0c414610218578063461f3120146101cd57806349ef8448146102135780634b2ae9801461020e578063572b6c0514610209578063574983c8146102045780635fd8c710146101ff57806369cc6af4146101fa5780636d82d9e0146101f55780637f94f65d146101f057806380e1d302146101eb57806384ab1d28146101e65780638da5cb5b146101e15780638db564c2146101dc578063918dff57146101d75780639872dbfe146101d257806398a26871146101cd578063ad8f2eed146101c8578063b0983d39146101c3578063c52164c6146101be578063c593dfd8146101b9578063d1c07028146101b4578063d1ced2b0146101af578063d4fac45d146101aa578063d6e8b973146101a5578063e449c52a146101a0578063f7d0e04b1461019b5763fb8c5ef00361000e576119d1565b611961565b61191a565b611803565b6117f0565b611741565b6115f9565b6112e1565b6112ad565b611279565b611235565b610c81565b611217565b611192565b611151565b61111d565b6110e7565b6110d4565b611083565b610f92565b610f5c565b610ed9565b610e75565b610e25565b610dfb565b610d64565b610c57565b610bb9565b61080b565b61058b565b6104c7565b61039a565b346102625760206003193601126102625760043560005260076020526020604060002054604051908152f35b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176102d757604052565b610267565b6040519060e0820182811067ffffffffffffffff8211176102d757604052565b67ffffffffffffffff81116102d75760051b60200190565b73ffffffffffffffffffffffffffffffffffffffff81160361026257565b81601f8201121561026257803591610349836102fc565b926103576040519485610296565b808452602092838086019260051b820101928311610262578301905b828210610381575050505090565b838091833561038f81610314565b815201910190610373565b34610262576020806003193601126102625760043567ffffffffffffffff8111610262576103cc903690600401610332565b9073ffffffffffffffffffffffffffffffffffffffff918260005416330361049d57805181830192849160051b830181013d1515855b8115610469575b50505060405192818401908285525180915260408401949160005b828110610453577f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d786880387a1005b8351851687529581019592810192600101610424565b90838260018298969499979951600c1b55019083821015610491579150959395949294610402565b50959395949294610409565b60046040517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b34610262576020600319360112610262576004356104e481610314565b600090815473ffffffffffffffffffffffffffffffffffffffff808216330361049d577fffffffffffffffffffffffff0000000000000000000000000000000000000000921691829116178255337f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d768380a380f35b60031990602082820112610262576004359167ffffffffffffffff8311610262578260a0920301126102625760040190565b346102625761059936610559565b6105a38180611b19565b9050156107e157604081016105d56105d16105bd83611b6a565b63cbc9d1c4600c526000526020600c205490565b1590565b6107b7576b3fffffffffffffffffffffff61060e6105f283611b6a565b339060205263739094b1600c5260005260016034600c20015490565b169161063b606082019361063561062486611b74565b6bffffffffffffffffffffffff1690565b90611bcf565b916a52b7d2dcc80cd2e4000000831161078d5761073561071c61073b926106eb610778957f63d8d7d5e63e9840ec91a12a160d27b7cfab294f6ba070b7359692acfe6b03bf97610689611be6565b60208201358061077d575b506106bd60806106b66106b16106aa8680611b19565b36916118b5565b611ae3565b9301611bdc565b906106c785611b6a565b91605f1b1790339060205263739094b1600c526000526034600c2090600182015555565b61070d6106f782611b6a565b6107036106248a611b74565b9030903390611c21565b6107176001600455565b611b6a565b73ffffffffffffffffffffffffffffffffffffffff1690565b93611b74565b6040805173ffffffffffffffffffffffffffffffffffffffff90951685526bffffffffffffffffffffffff90911660208501523393918291820190565b0390a2005b6107879033612275565b38610694565b60046040517ff3fb0eb9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1578328e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6a3bc53e000000000000000000000000000000000000000000000000000000008152fd5b346102625761081936610559565b610821611be6565b6108376108316080830183611d13565b90612092565b61084081611b6a565b9061085b6105d1602083019361085585611b6a565b90612651565b610b8f5761087a61086b82611b6a565b61087484611b6a565b90612617565b6040918281019061089c61088d83611d67565b69ffffffffffffffffffff1690565b8310610b66576108ad600554611bbc565b9460016108c4876000526006602052604060002090565b0154431115610b3d576109aa906108d9611ea2565b9290946109716108fa6108eb87611b6a565b6108f486611b6a565b9061268e565b61091b61071c61091561090f60035443611bcf565b95611d67565b96611b6a565b9061092588611b6a565b9361092e6102dc565b9c8d5260208d01528a8c015261095460608c0195869069ffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff1660808b0152565b73ffffffffffffffffffffffffffffffffffffffff861660a08a015273ffffffffffffffffffffffffffffffffffffffff1660c0890152565b60608301916109b98385611d13565b159050610a24575050610a209592826109e76109fb6109df610a0195610a069997611d13565b929093611b6a565b6374dfee70600c5260005260206000205490565b91611d9b565b61233d565b905b610a126001600455565b519081529081906020820190565b0390f35b925092505069ffffffffffffffffffff9068056bc75e2d6310000082610a54855169ffffffffffffffffffff1690565b1611610a7057505050610a2092610a6a9161233d565b90610a08565b15610a84575050610a2092610a6a9161233d565b610ab5610ab0610aa133600c1b6000526007602052604060002090565b54670de0b6b3a7640000900490565b611e29565b81610ad3610acd855169ffffffffffffffffffff1690565b92611d7e565b911611918215610b1a575b5050610af157610a2092610a6a9161233d565b600482517f1c18f846000000000000000000000000000000000000000000000000000000008152fd5b5169d3c21bcecceda1000000925069ffffffffffffffffffff1616113880610ade565b600485517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b600484517f22bbb43c000000000000000000000000000000000000000000000000000000008152fd5b60046040517fb2e532de000000000000000000000000000000000000000000000000000000008152fd5b3461026257602060031936011261026257600480356000908152600660209081526040918290208054600182015460028301546003840154968401546005909401548651938452948301919091529381019390935269ffffffffffffffffffff8416606084015273ffffffffffffffffffffffffffffffffffffffff60509490941c84166080840152831660a08301529190911660c082015260e090f35b34610262576020600319360112610262576020610c796004356109e781610314565b604051908152f35b34610262576020600319360112610262576020600435546040519015158152f35b90815180825260208080930193019160005b828110610cc2575050505090565b835185529381019392810192600101610cb4565b90610ce990604083526040830190610ca2565b81810360209283015282518082529082019282019160009190825b828110610d1357505050505090565b90919293948551600480821015610d3857508152820194820193929190600101610d04565b8660216024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b34610262576020806003193601126102625760043567ffffffffffffffff8111610262573660238201121561026257806004013590610da2826102fc565b91610db06040519384610296565b80835260248484019160051b8301019136831161026257602401905b828210610dec57610ddc84612743565b90610a2060405192839283610cd6565b81358152908401908401610dcc565b34610262576020600319360112610262576020600435610e1a81610314565b60405190600c1b8152f35b346102625760206003193601126102625773ffffffffffffffffffffffffffffffffffffffff600435610e5781610314565b166000526001602052602060ff604060002054166040519015158152f35b346102625760206003193601126102625760043573ffffffffffffffffffffffffffffffffffffffff60005416330361049d576020817f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b851192600355604051908152a1005b3461026257600080600319360112610f595773ffffffffffffffffffffffffffffffffffffffff815416330361049d57478180808084335af115610f4c576040805133815260208101929092527feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d91a180f35b63b12d13eb82526004601cfd5b80fd5b34610262576020600319360112610262576020610f7e6004356105bd81610314565b6040519015158152f35b8015150361026257565b3461026257604060031936011261026257600435610faf81610314565b602435610fbb81610f88565b610fdb82339060205263739094b1600c5260005260016034600c20015490565b8015611059578260205263739094b1600c52336000526b3fffffffffffffffffffffff82605f1b91161760016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405192168252151560208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2005b60046040517f87138d5c000000000000000000000000000000000000000000000000000000008152fd5b34610262576040600319360112610262576100196004356110a381610314565b60243590612275565b6003196040910112610262576004356110c481610314565b906024356110d181610314565b90565b34610262576020610f7e610855366110ac565b3461026257602060031936011261026257602060405173ffffffffffffffffffffffffffffffffffffffff600435600c1c168152f35b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b34610262576000600319360112610262576020600554604051908152f35b60005b8381106111825750506000910152565b8181015183820152602001611172565b34610262576111a36108f4366110ac565b604051906020820190815260208252604082019180831067ffffffffffffffff8411176102d7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6040938585526020865261120e84518092816060880152608087019061116f565b01168101030190f35b34610262576000600319360112610262576020600354604051908152f35b34610262576020610c796108f4366110ac565b9181601f840112156102625782359167ffffffffffffffff8311610262576020808501948460051b01011161026257565b346102625760206003193601126102625760043567ffffffffffffffff811161026257610831610019913690600401611248565b3461026257600060031936011261026257602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346102625760a06003193601126102625760043560843560ff811681036102625761130a611be6565b61131e826000526006602052604060002090565b6003810180549169ffffffffffffffffffff83169283156115be57600182018054431161159457846004846114437f364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede89960006114929661143c6114ac9b611414896113d861140461071c9f6002015460405192839160208301956024359187917fffffffffffffffffffff0000000000000000000000000000000000000000000090604a9492845260b01b166020830152602a8201520190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610296565b5190209560643560443588611f17565b7fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008154169055565b5560019055565b61144b611ea2565b9050156114c7575b019273ffffffffffffffffffffffffffffffffffffffff611488855473ffffffffffffffffffffffffffffffffffffffff1690565b9160501c16612005565b5473ffffffffffffffffffffffffffffffffffffffff1690565b60408051948552602085019290925292a26100196001600455565b8181016114eb61071c825473ffffffffffffffffffffffffffffffffffffffff1690565b33146115715761156a61156261155261154c697fffffffffffffffffff8a60011c169461152533600c1b6000526007602052604060002090565b611530878254611bcf565b90555473ffffffffffffffffffffffffffffffffffffffff1690565b600c1b90565b6000526007602052604060002090565b918254611bcf565b9055611453565b5061158933600c1b6000526007602052604060002090565b61156a848254611bcf565b60046040517ff6fafba0000000000000000000000000000000000000000000000000000000008152fd5b60046040517f63b4904e000000000000000000000000000000000000000000000000000000008152fd5b9060206110d1928181520190610ca2565b346102625760406003193601126102625760043567ffffffffffffffff81116102625761162a903690600401610332565b6024359061163782610314565b600091815191611646836126e0565b935b83811061165d5760405180610a2087826115e8565b8061168a8473ffffffffffffffffffffffffffffffffffffffff6116836001958761272f565b5116612617565b611694828861272f565b5201611648565b9060406003198301126102625767ffffffffffffffff9160043583811161026257816116c991600401610332565b926024359081116102625781602382011215610262578060040135916116ee836102fc565b926116fc6040519485610296565b80845260209260248486019260051b82010192831161026257602401905b828210611728575050505090565b838091833561173681610f88565b81520191019061171a565b346102625761174f3661169b565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156117ee57805182036117e15790602084818080970194019260051b0101915b82810361179f578380f35b8480916001825280518652835180604088205581517fbee55516e29d3969d3cb8eb01351eb3c52d06f9e2435bd5a8bfe3647e185df928880a301910190611794565b63ff633a3883526004601cfd5bfe5b34610262576020610c79610874366110ac565b34610262576118113661169b565b60009073ffffffffffffffffffffffffffffffffffffffff825416330361049d5782519081156118a857805182036117e15790602084818080970194019260051b0101915b828103611861578380f35b84809181600c63cbc9d1c48152825188528551918291205581517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a8880a301910190611856565b63df95788383526004601cfd5b92919267ffffffffffffffff82116102d757604051916118fd60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610296565b829481845281830111610262578281602093846000960137010152565b346102625760206003193601126102625760043567ffffffffffffffff8111610262573660238201121561026257610c796106b160209236906024816004013591016118b5565b346102625760206003193601126102625760043561197e81610314565b73ffffffffffffffffffffffffffffffffffffffff8060005416330361049d57816020917fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9360025560405191168152a1005b34610262576060600319360112610262576004356119ee81610314565b60243560443567ffffffffffffffff8111610262577f2cd6435b1b961c13f55202979edd0765a809f69a539d8a477436c94c1211e43e91611a47611a39611acb933690600401611248565b90611a42611be6565b612092565b611a518433612651565b611ad5575b611a8f3385836b3fffffffffffffffffffffff611a8983339060205263739094b1600c5260005260016034600c20015490565b166125db565b611a9a813386612005565b6040805173ffffffffffffffffffffffffffffffffffffffff95909516855260208501919091523393918291820190565b0390a26001600455005b611ade84611c7a565b611a56565b604051611b0d60208281611b00818301968781519384920161116f565b8101038084520182610296565b516020106117ee575190565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610262570180359067ffffffffffffffff82116102625760200191813603831361026257565b356110d181610314565b356bffffffffffffffffffffffff811681036102625790565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9060018201809211611bca57565b611b8d565b91908201809211611bca57565b356110d181610f88565b600260045414611bf7576002600455565b60046040517fab143c06000000000000000000000000000000000000000000000000000000008152fd5b601c600060649281946020966040519860605260405260601b602c526f23b872dd000000000000000000000000600c525af13d15600160005114171615611c6c576000606052604052565b637939f4246000526004601cfd5b611c9a81339060205263739094b1600c5260005260016034600c20015490565b8015611059576b3fffffffffffffffffffffff908260205263739094b1600c52336000521660016034600c20015573ffffffffffffffffffffffffffffffffffffffff60405191168152600060208201527fca585721b6b442dc9183932f7c84dc2880efb67c4da52cc06873e78971105d4960403392a2565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610262570180359067ffffffffffffffff821161026257602001918160051b3603831361026257565b3569ffffffffffffffffffff811681036102625790565b90670de0b6b3a764000091828102928184041490151715611bca57565b73ffffffffffffffffffffffffffffffffffffffff8293941692611ded575b505003611dc357565b60046040517f3b8474be000000000000000000000000000000000000000000000000000000008152fd5b60059291831b8101915b8135808211851b918252602080921852604060002091019282841015611e1e579290611df7565b509150503880611dba565b6040519060208201907f4d2b1791000000000000000000000000000000000000000000000000000000008252602483015260248252606082019082821067ffffffffffffffff8311176102d7576020926000926040525190600254617530fa906000519115611e9457565b63e10bf1cc6000526004601cfd5b611eaa611ed0565b90600073ffffffffffffffffffffffffffffffffffffffff831633146110d15750600190565b33600052600160205260ff60406000205416600014611f13577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b3390565b918254611fdb5760806020927f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1948452600094859384927b19457468657265756d205369676e6564204d6573736167653a0a3332845260ff603c600420996040519a865216875260405280606052105afa508051903d15611fce576060526040829052600c1b5415611fa65750565b807f815e1d640000000000000000000000000000000000000000000000000000000060049252fd5b638baa579f90526004601cfd5b60046040517ff490a6ea000000000000000000000000000000000000000000000000000000008152fd5b60109260209260145260345260446000938480936fa9059cbb00000000000000000000000082525af13d15600183511417161561204157603452565b6390b8ec1890526004601cfd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b919081101561208d5760051b0190565b61204e565b6000905b8282106120b35750106120a557565b63dfb035c96000526004601cfd5b906120d36120c282858561207d565b356000526006602052604060002090565b906120dd826122c4565b600582015473ffffffffffffffffffffffffffffffffffffffff166003830180549173ffffffffffffffffffffffffffffffffffffffff92838160501c16956a52b7d2dcc80cd2e400000061216d69ffffffffffffffffffff6b3fffffffffffffffffffffff6121638b889060205263739094b1600c5260005260016034600c20015490565b1694168094611bcf565b1161078d576121c37f830501e61b8b075e170b22a430e39454bdb12ed3e9620e586430b6ac00079da59461141460049460019a612239979060205263739094b1600c5260005260016034600c2001908154019055565b016121e561154c825473ffffffffffffffffffffffffffffffffffffffff1690565b6122036121fc826000526007602052604060002090565b5460011c90565b68056bc75e2d63100000811161225a575061222b611492916000526007602052604060002090565b68056bc75e2d631000009055565b9161224584888861207d565b60405190358152921691602090a20190612096565b9061226f906000526007602052604060002090565b55611492565b3381036122b6576374dfee70600c5280600052816020600020557f0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632600080a3565b6385d1f7266000526004601cfd5b600181015443106122e6576003015469ffffffffffffffffffff16156115be57565b60046040517fd0404f85000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611bca5760010190565b612472907fa8fb61052fec8ed6ed923dd5e14b7d6aaae41d44c8870fc4efebf871389a577d61256d94938051600052600660205260406000208151815560208201516001820155604082015160028201556125d6612599612588600384019461253c6005606083019969ffffffffffffffffffff8b5116807fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008b5416178a5561244f612400608087015173ffffffffffffffffffffffffffffffffffffffff1690565b8b547fffff0000000000000000000000000000000000000000ffffffffffffffffffff16605082901b7dffffffffffffffffffffffffffffffffffffffff000000000000000000001617909b55565b6124b660a086019d8e5173ffffffffffffffffffffffffffffffffffffffff1690565b60048b019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b61251e60c08601996124dc8b5173ffffffffffffffffffffffffffffffffffffffff1690565b940180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055565b73ffffffffffffffffffffffffffffffffffffffff809a16916125db565b61254f61254a600554612310565b600555565b51998a985173ffffffffffffffffffffffffffffffffffffffff1690565b935173ffffffffffffffffffffffffffffffffffffffff1690565b955169ffffffffffffffffffff1690565b60405193849316958390929169ffffffffffffffffffff60209173ffffffffffffffffffffffffffffffffffffffff604085019616845216910152565b0390a3565b9291909280848103119015176126095760205263739094b1600c5260005260016034600c2001908154039055565b63ce3a3d376000526004601cfd5b600092913d15612625575050565b9091925060205263739094b1600c5260005260016034600c2001546b3fffffffffffffffffffffff1690565b600092913d1561265f575050565b9091925060205263739094b1600c5260005260016034600c200154605f1c6b3fffffffffffffffffffffff1690565b600092913d1561269c575050565b9091925060205263739094b1600c526000526034600c205490565b6040516020810181811067ffffffffffffffff8211176102d75760405260008152906000368137565b906126ea826102fc565b6126f76040519182610296565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061272582946102fc565b0190602036910137565b805182101561208d5760209160051b010190565b908151156128bb576000918281519061275b826126e0565b92612765836126e0565b955b83811061277657505050509190565b6127b761071c600561279c61278b858761272f565b516000526006602052604060002090565b015473ffffffffffffffffffffffffffffffffffffffff1690565b6127e957806127c86001928461272f565b516127d3828861272f565b52836127df828a61272f565b5201925b92612767565b69ffffffffffffffffffff612817600361280661278b858761272f565b015469ffffffffffffffffffff1690565b1661284f57806128296001928461272f565b51612834828861272f565b52612848612842828a61272f565b60039052565b01926127e3565b6001908161286061278b838661272f565b015443111561289257612873818461272f565b5161287e828861272f565b5261284861288c828a61272f565b60029052565b61289c818461272f565b516128a7828861272f565b526128486128b5828a61272f565b60019052565b90506128c56126b7565b906110d16126b756fea2646970667358221220ed724ed47bcdef6140dc4a66d86c43ecffa97e169222a98775625d6852ec98f964736f6c63430008130033"; type P2PIXConstructorParams = | [signer?: Signer] diff --git a/src/types/p2pix.sol/P2PIX.ts b/src/types/p2pix.sol/P2PIX.ts index 2688053..0cba6a7 100644 --- a/src/types/p2pix.sol/P2PIX.ts +++ b/src/types/p2pix.sol/P2PIX.ts @@ -27,13 +27,59 @@ import type { PromiseOrValue, } from "../common"; +export declare namespace DataTypes { + export type DepositArgsStruct = { + pixTarget: PromiseOrValue; + allowlistRoot: PromiseOrValue; + token: PromiseOrValue; + amount: PromiseOrValue; + valid: PromiseOrValue; + }; + + export type DepositArgsStructOutput = [ + string, + string, + string, + BigNumber, + boolean + ] & { + pixTarget: string; + allowlistRoot: string; + token: string; + amount: BigNumber; + valid: boolean; + }; + + export type LockArgsStruct = { + seller: PromiseOrValue; + token: PromiseOrValue; + amount: PromiseOrValue; + merkleProof: PromiseOrValue[]; + expiredLocks: PromiseOrValue[]; + }; + + export type LockArgsStructOutput = [ + string, + string, + BigNumber, + string[], + BigNumber[] + ] & { + seller: string; + token: string; + amount: BigNumber; + merkleProof: string[]; + expiredLocks: BigNumber[]; + }; +} + export interface P2PIXInterface extends utils.Interface { functions: { "_castAddrToKey(address)": FunctionFragment; "_castKeyToAddr(uint256)": FunctionFragment; "allowedERC20s(address)": FunctionFragment; "defaultLockBlocks()": FunctionFragment; - "deposit(address,uint96,string,bool,bytes32)": FunctionFragment; + "deposit((string,bytes32,address,uint96,bool))": FunctionFragment; "getBalance(address,address)": FunctionFragment; "getBalances(address[],address)": FunctionFragment; "getLocksStatus(uint256[])": FunctionFragment; @@ -42,13 +88,13 @@ export interface P2PIXInterface extends utils.Interface { "getStr(string)": FunctionFragment; "getValid(address,address)": FunctionFragment; "isTrustedForwarder(address)": FunctionFragment; - "lock(address,address,uint80,bytes32[],uint256[])": FunctionFragment; + "lock((address,address,uint80,bytes32[],uint256[]))": FunctionFragment; "lockCounter()": FunctionFragment; "mapLocks(uint256)": FunctionFragment; "owner()": FunctionFragment; "release(uint256,bytes32,bytes32,bytes32,uint8)": FunctionFragment; "reputation()": FunctionFragment; - "sellerAllowList(uint256)": FunctionFragment; + "sellerAllowList(address)": FunctionFragment; "setDefaultLockBlocks(uint256)": FunctionFragment; "setOwner(address)": FunctionFragment; "setReputation(address)": FunctionFragment; @@ -121,13 +167,7 @@ export interface P2PIXInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "deposit", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] + values: [DataTypes.DepositArgsStruct] ): string; encodeFunctionData( functionFragment: "getBalance", @@ -163,13 +203,7 @@ export interface P2PIXInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "lock", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue[] - ] + values: [DataTypes.LockArgsStruct] ): string; encodeFunctionData( functionFragment: "lockCounter", @@ -196,7 +230,7 @@ export interface P2PIXInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "sellerAllowList", - values: [PromiseOrValue] + values: [PromiseOrValue] ): string; encodeFunctionData( functionFragment: "setDefaultLockBlocks", @@ -362,7 +396,7 @@ export interface P2PIXInterface extends utils.Interface { "DepositAdded(address,address,uint256)": EventFragment; "DepositWithdrawn(address,address,uint256)": EventFragment; "FundsWithdrawn(address,uint256)": EventFragment; - "LockAdded(address,uint256,uint256,uint256)": EventFragment; + "LockAdded(address,uint256,address,uint256)": EventFragment; "LockBlocksUpdated(uint256)": EventFragment; "LockReleased(address,uint256,uint256)": EventFragment; "LockReturned(address,uint256)": EventFragment; @@ -441,11 +475,11 @@ export type FundsWithdrawnEventFilter = TypedEventFilter; export interface LockAddedEventObject { buyer: string; lockID: BigNumber; - seller: BigNumber; + seller: string; amount: BigNumber; } export type LockAddedEvent = TypedEvent< - [string, BigNumber, BigNumber, BigNumber], + [string, BigNumber, string, BigNumber], LockAddedEventObject >; @@ -598,11 +632,7 @@ export interface P2PIX extends BaseContract { defaultLockBlocks(overrides?: CallOverrides): Promise<[BigNumber]>; deposit( - _token: PromiseOrValue, - _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, - _valid: PromiseOrValue, - allowlistRoot: PromiseOrValue, + args: DataTypes.DepositArgsStruct, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -652,11 +682,7 @@ export interface P2PIX extends BaseContract { ): Promise<[boolean]>; lock( - _seller: PromiseOrValue, - _token: PromiseOrValue, - _amount: PromiseOrValue, - merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + args: DataTypes.LockArgsStruct, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -666,14 +692,14 @@ export interface P2PIX extends BaseContract { arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< - [BigNumber, BigNumber, BigNumber, string, BigNumber, string, string] & { - sellerKey: BigNumber; + [BigNumber, BigNumber, string, BigNumber, string, string, string] & { counter: BigNumber; expirationBlock: BigNumber; pixTarget: string; amount: BigNumber; token: string; buyerAddress: string; + seller: string; } >; @@ -691,7 +717,7 @@ export interface P2PIX extends BaseContract { reputation(overrides?: CallOverrides): Promise<[string]>; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise<[string] & { root: string }>; @@ -789,11 +815,7 @@ export interface P2PIX extends BaseContract { defaultLockBlocks(overrides?: CallOverrides): Promise; deposit( - _token: PromiseOrValue, - _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, - _valid: PromiseOrValue, - allowlistRoot: PromiseOrValue, + args: DataTypes.DepositArgsStruct, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -843,11 +865,7 @@ export interface P2PIX extends BaseContract { ): Promise; lock( - _seller: PromiseOrValue, - _token: PromiseOrValue, - _amount: PromiseOrValue, - merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + args: DataTypes.LockArgsStruct, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -857,14 +875,14 @@ export interface P2PIX extends BaseContract { arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< - [BigNumber, BigNumber, BigNumber, string, BigNumber, string, string] & { - sellerKey: BigNumber; + [BigNumber, BigNumber, string, BigNumber, string, string, string] & { counter: BigNumber; expirationBlock: BigNumber; pixTarget: string; amount: BigNumber; token: string; buyerAddress: string; + seller: string; } >; @@ -882,7 +900,7 @@ export interface P2PIX extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -980,11 +998,7 @@ export interface P2PIX extends BaseContract { defaultLockBlocks(overrides?: CallOverrides): Promise; deposit( - _token: PromiseOrValue, - _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, - _valid: PromiseOrValue, - allowlistRoot: PromiseOrValue, + args: DataTypes.DepositArgsStruct, overrides?: CallOverrides ): Promise; @@ -1034,11 +1048,7 @@ export interface P2PIX extends BaseContract { ): Promise; lock( - _seller: PromiseOrValue, - _token: PromiseOrValue, - _amount: PromiseOrValue, - merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + args: DataTypes.LockArgsStruct, overrides?: CallOverrides ): Promise; @@ -1048,14 +1058,14 @@ export interface P2PIX extends BaseContract { arg0: PromiseOrValue, overrides?: CallOverrides ): Promise< - [BigNumber, BigNumber, BigNumber, string, BigNumber, string, string] & { - sellerKey: BigNumber; + [BigNumber, BigNumber, string, BigNumber, string, string, string] & { counter: BigNumber; expirationBlock: BigNumber; pixTarget: string; amount: BigNumber; token: string; buyerAddress: string; + seller: string; } >; @@ -1073,7 +1083,7 @@ export interface P2PIX extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -1189,7 +1199,7 @@ export interface P2PIX extends BaseContract { ): FundsWithdrawnEventFilter; FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter; - "LockAdded(address,uint256,uint256,uint256)"( + "LockAdded(address,uint256,address,uint256)"( buyer?: PromiseOrValue | null, lockID?: PromiseOrValue | null, seller?: null, @@ -1293,11 +1303,7 @@ export interface P2PIX extends BaseContract { defaultLockBlocks(overrides?: CallOverrides): Promise; deposit( - _token: PromiseOrValue, - _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, - _valid: PromiseOrValue, - allowlistRoot: PromiseOrValue, + args: DataTypes.DepositArgsStruct, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1347,11 +1353,7 @@ export interface P2PIX extends BaseContract { ): Promise; lock( - _seller: PromiseOrValue, - _token: PromiseOrValue, - _amount: PromiseOrValue, - merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + args: DataTypes.LockArgsStruct, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1376,7 +1378,7 @@ export interface P2PIX extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -1475,11 +1477,7 @@ export interface P2PIX extends BaseContract { defaultLockBlocks(overrides?: CallOverrides): Promise; deposit( - _token: PromiseOrValue, - _amount: PromiseOrValue, - _pixTarget: PromiseOrValue, - _valid: PromiseOrValue, - allowlistRoot: PromiseOrValue, + args: DataTypes.DepositArgsStruct, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1529,11 +1527,7 @@ export interface P2PIX extends BaseContract { ): Promise; lock( - _seller: PromiseOrValue, - _token: PromiseOrValue, - _amount: PromiseOrValue, - merkleProof: PromiseOrValue[], - expiredLocks: PromiseOrValue[], + args: DataTypes.LockArgsStruct, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1558,7 +1552,7 @@ export interface P2PIX extends BaseContract { reputation(overrides?: CallOverrides): Promise; sellerAllowList( - sellerKey: PromiseOrValue, + sellerKey: PromiseOrValue, overrides?: CallOverrides ): Promise; diff --git a/test/p2pix.test.ts b/test/p2pix.test.ts index 607c98e..bc1af8d 100644 --- a/test/p2pix.test.ts +++ b/test/p2pix.test.ts @@ -17,7 +17,6 @@ import { network, /* tracer */ } from "hardhat"; - import { MockToken, Multicall, @@ -25,15 +24,21 @@ import { Reputation, } from "../src/types"; import { P2PixErrors } from "./utils/errors"; +import { + // LockArgs, + // DepositArgs, + Call, + Lock, + Result +} from "./utils/interfaces"; import { - Call, - Lock, - Result, getBnFrom, getLockData, getSignerAddrs, p2pixFixture, randomSigners, + createDepositArgs, + createLockArgs, } from "./utils/fixtures"; describe("P2PIX", () => { @@ -306,12 +311,17 @@ describe("P2PIX", () => { const root = ethers.utils.keccak256( ethers.utils.toUtf8Bytes("root"), ); + // const txArgs: DepositArgs = { + // pixTarget: pTarget, + // allowlistRoot: root, + // token: owner.address, + // amount: ethers.constants.One, + // valid: true, + // }; + const txArgs = createDepositArgs(pTarget, root, owner.address, ethers.constants.One, true); + const tx = p2pix.deposit( - owner.address, - 1, - pTarget, - true, - root, + txArgs ); await expect(tx).to.be.revertedWithCustomError( @@ -323,13 +333,10 @@ describe("P2PIX", () => { const root = ethers.utils.keccak256( ethers.utils.toUtf8Bytes("root"), ); - const tx = p2pix.deposit( - erc20.address, - 1, - "", - true, - root, - ); + + const txArgs = createDepositArgs("", root, erc20.address, ethers.constants.One, true); + + const tx = p2pix.deposit(txArgs); await expect(tx).to.be.revertedWithCustomError( p2pix, @@ -341,13 +348,8 @@ describe("P2PIX", () => { const root = ethers.utils.keccak256( ethers.utils.toUtf8Bytes("root"), ); - const tx = p2pix.deposit( - erc20.address, - ethers.utils.parseEther("100000001"), - pTarget, - true, - root, - ); + const txArgs = createDepositArgs(pTarget, root, erc20.address, ethers.utils.parseEther("100000001"), true); + const tx = p2pix.deposit(txArgs); await expect(tx).to.be.revertedWithCustomError( p2pix, @@ -359,12 +361,15 @@ describe("P2PIX", () => { // 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( + createDepositArgs( + pTarget, + root, erc20.address, price, - pTarget, true, - root, + ), ); const storage = await p2pix.callStatic.getBalance( owner.address, @@ -378,10 +383,8 @@ describe("P2PIX", () => { owner.address, erc20.address, ); - const ownerKey = await p2pix.callStatic._castAddrToKey( - owner.address, - ); - const allowList = await p2pix.sellerAllowList(ownerKey); + + const allowList = await p2pix.sellerAllowList(owner.address); const balances = await p2pix.callStatic.getBalances( [owner.address, acc01.address], erc20.address, @@ -406,18 +409,16 @@ describe("P2PIX", () => { }); // 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 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 = "7ce3339x4133301u8f63pn71a5333118"; const pTarget2 = "12312333321"; @@ -456,27 +457,39 @@ describe("P2PIX", () => { const tx = await p2pix .connect(owner) - .deposit(erc20.address, price, pTarget, true, root); + .deposit(createDepositArgs(pTarget, root, erc20.address, price, true)); const tx2 = await p2pix .connect(acc01) .deposit( - erc20.address, - price2, - pTarget2, - false, - nullRoot, + createDepositArgs( + pTarget2, + nullRoot, + erc20.address, + price2, + false, + ), ); const tx3 = await p2pix .connect(acc02) - .deposit(erc20.address, price3, pTarget3, true, root); + .deposit( + createDepositArgs( + pTarget3, + root, + erc20.address, + price3, + true, + ), + ); const tx4 = await p2pix .connect(acc03) .deposit( - erc20.address, - price4, - pTarget, - false, - nullRoot, + createDepositArgs( + pTarget, + nullRoot, + erc20.address, + price4, + false, + ), ); const balances = await p2pix.callStatic.getBalances( @@ -541,16 +554,16 @@ describe("P2PIX", () => { ); const allowList1 = await p2pix.sellerAllowList( - ownerKey, + owner.address, ); const allowList2 = await p2pix.sellerAllowList( - acc01Key, + acc01.address, ); const allowList3 = await p2pix.sellerAllowList( - acc02Key, + acc02.address, ); const allowList4 = await p2pix.sellerAllowList( - acc03Key, + acc03.address, ); expect(tx).to.be.ok; @@ -614,32 +627,34 @@ describe("P2PIX", () => { const pTarget = "7ce3339x4133301u8f63pn71a5333118"; await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - pTarget, - true, - ethers.constants.HashZero, + createDepositArgs( + pTarget, + ethers.constants.HashZero, + erc20.address, + price, + true, + ), ); await p2pix.setValidState(erc20.address, false); const fail = p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - price, - // acc02.address, - // 0, - [], - [], + createLockArgs( + owner.address, + erc20.address, + price, + [], + [], + ), ); const fail2 = p2pix.lock( - zero, - zero, - // zero, - // 0, - price, - [], - [], + createLockArgs( + zero, + zero, + price, + [], + [], + ), ); await expect(fail).to.be.revertedWithCustomError( @@ -655,22 +670,24 @@ describe("P2PIX", () => { await erc20.approve(p2pix.address, price); const pTarget = "7ce3339x4133301u8f63pn71a5333118"; await p2pix.deposit( - erc20.address, - price, - pTarget, - true, - ethers.constants.HashZero, + createDepositArgs( + pTarget, + ethers.constants.HashZero, + erc20.address, + price, + true, + ), ); const fail = p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - price.mul(ethers.BigNumber.from(2)), - [], - [], + createLockArgs( + owner.address, + erc20.address, + price.mul(ethers.BigNumber.from(2)), + [], + [], + ), ); await expect(fail).to.be.revertedWithCustomError( @@ -682,26 +699,24 @@ describe("P2PIX", () => { it("should revert if an invalid allowlist merkleproof is provided", async () => { await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - "7ce3339x4133301u8f63pn71a5333118", - true, - merkleRoot, + createDepositArgs( + "7ce3339x4133301u8f63pn71a5333118", + merkleRoot, + erc20.address, + price, + true, + ), ); const fail = p2pix .connect(acc02) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - 1000, - [ - ethers.utils.keccak256( - ethers.utils.toUtf8Bytes("wrong"), - ), - ], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(1000), + [ethers.utils.keccak256(ethers.utils.toUtf8Bytes("wrong"))], + [], + ), ); await expect(fail).to.be.revertedWithCustomError( @@ -715,22 +730,24 @@ describe("P2PIX", () => { price.mul(BigNumber.from("3")), ); await p2pix.deposit( - erc20.address, - price.mul(BigNumber.from("3")), - "1", - true, - merkleRoot, + createDepositArgs( + "1", + merkleRoot, + erc20.address, + price.mul(BigNumber.from("3")), + true, + ), ); const fail = p2pix .connect(acc02) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - price.mul(BigNumber.from("2")), - [], - [], + createLockArgs( + owner.address, + erc20.address, + price.mul(BigNumber.from("2")), + [], + [], + ), ); await expect(fail).to.be.revertedWithCustomError( @@ -742,22 +759,24 @@ describe("P2PIX", () => { const target = "333"; await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - merkleRoot, + createDepositArgs( + target, + merkleRoot, + erc20.address, + price, + true, + ), ); const tx = await p2pix .connect(acc01) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - price, - proof, - [], + createLockArgs( + owner.address, + erc20.address, + price, + proof, + [], + ), ); const storage: Lock = await p2pix.callStatic.mapLocks( 1, @@ -765,29 +784,22 @@ describe("P2PIX", () => { 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( acc01.address, ethers.constants.One, - key, + owner.address, price, ); expect(tx).to.be.ok; - expect(storage.sellerKey).to.eq(key); + expect(storage.seller).to.eq(owner.address); 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(await p2pix.callStatic.getStr(target)); expect(storage.buyerAddress).to.eq(acc01.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 1", async () => { @@ -795,22 +807,24 @@ describe("P2PIX", () => { const target = "101"; await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - root, + createDepositArgs( + target, + root, + erc20.address, + price, + true, + ), ); const tx = await p2pix .connect(acc01) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - price, - [], - [], + createLockArgs( + owner.address, + erc20.address, + price, + [], + [], + ), ); const storage: Lock = await p2pix.callStatic.mapLocks( 1, @@ -827,21 +841,17 @@ describe("P2PIX", () => { expect(tx).to.be.ok; expect(castBack).to.eq(owner.address); - expect(storage.sellerKey).to.eq(key); + expect(storage.seller).to.eq(owner.address); 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(await p2pix.callStatic.getStr(target)); expect(storage.buyerAddress).to.eq(acc01.address); - // expect(storage.relayerAddress).to.eq(acc01.address); expect(storage.token).to.eq(erc20.address); await expect(tx) .to.emit(p2pix, "LockAdded") - .withArgs(acc01.address, 1, key, storage.amount); + .withArgs(acc01.address, 1, owner.address, storage.amount); }); it("should create a lock, update storage and emit events via the reputation path 2", async () => { const root = ethers.constants.HashZero; @@ -862,22 +872,24 @@ describe("P2PIX", () => { const sig = ethers.utils.splitSignature(flatSig); await erc20.approve(p2pix.address, newPrice); await p2pix.deposit( - erc20.address, - newPrice, - target, - true, - root, + createDepositArgs( + target, + root, + erc20.address, + newPrice, + true, + ), ); await p2pix .connect(acc01) .lock( - owner.address, - erc20.address, - // acc02.address, - // price, - price, - [], - [], + createLockArgs( + owner.address, + erc20.address, + price, + [], + [], + ), ); await p2pix .connect(acc01) @@ -891,13 +903,13 @@ describe("P2PIX", () => { const tx = await p2pix .connect(acc01) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - price.add(ethers.constants.One), - [], - [], + createLockArgs( + owner.address, + erc20.address, + price.add(ethers.constants.One), + [], + [], + ), ); const storage: Lock = await p2pix.callStatic.mapLocks( 2, @@ -914,23 +926,19 @@ describe("P2PIX", () => { expect(tx).to.be.ok; expect(castBack).to.eq(owner.address); - expect(storage.sellerKey).to.eq(key); + expect(storage.seller).to.eq(owner.address); 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(await p2pix.callStatic.getStr(target)); expect(storage.buyerAddress).to.eq(acc01.address); - // expect(storage.relayerAddress).to.eq(acc01.address); expect(storage.token).to.eq(erc20.address); await expect(tx) .to.emit(p2pix, "LockAdded") - .withArgs(acc01.address, 2, key, storage.amount); + .withArgs(acc01.address, 2, owner.address, storage.amount); }); // edge case test it("should create multiple locks", async () => { @@ -938,22 +946,24 @@ describe("P2PIX", () => { const target = ethers.BigNumber.from(101).toString(); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - merkleRoot, + createDepositArgs( + target, + merkleRoot, + erc20.address, + price, + true, + ), ); const tx1 = await p2pix .connect(acc01) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - newPrice, - proof, - [], + createLockArgs( + owner.address, + erc20.address, + newPrice, + proof, + [], + ), ); const storage1: Lock = await p2pix.callStatic.mapLocks( 1, @@ -965,13 +975,13 @@ describe("P2PIX", () => { const tx2 = await p2pix .connect(acc01) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); const storage2: Lock = await p2pix.callStatic.mapLocks( 2, @@ -983,13 +993,13 @@ describe("P2PIX", () => { const tx3 = await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc03.address, - // 0, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); const storage3: Lock = await p2pix.callStatic.mapLocks( 3, @@ -998,9 +1008,9 @@ describe("P2PIX", () => { const rc3: ContractReceipt = await tx3.wait(); const expiration3 = rc3.blockNumber + 10; - const key = await p2pix.callStatic._castAddrToKey( - owner.address, - ); + // const key = await p2pix.callStatic._castAddrToKey( + // owner.address, + // ); // const lockStatus1 = await p2pix.callStatic.getLocksStatus([1,7,7,2,3,4,5,5,2,3]); // const lockStatus2 = await p2pix.callStatic.getLocksStatus([0,1,2,3]); @@ -1066,20 +1076,15 @@ describe("P2PIX", () => { expect(ls3Res).to.deep.equal(ls3); expect(ls4Res).to.deep.equal(ls4); - expect(key) - .to.eq(storage1.sellerKey) - .and.to.eq(storage2.sellerKey) - .and.to.eq(storage3.sellerKey); + expect(owner.address) + .to.eq(storage1.seller) + .and.to.eq(storage2.seller) + .and.to.eq(storage3.seller); 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) @@ -1099,16 +1104,6 @@ describe("P2PIX", () => { .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) @@ -1116,13 +1111,13 @@ describe("P2PIX", () => { await expect(tx1) .to.emit(p2pix, "LockAdded") - .withArgs(acc01.address, 1, key, storage1.amount); + .withArgs(acc01.address, 1, owner.address, storage1.amount); await expect(tx2) .to.emit(p2pix, "LockAdded") - .withArgs(acc01.address, 2, key, storage2.amount); + .withArgs(acc01.address, 2, owner.address, storage2.amount); await expect(tx3) .to.emit(p2pix, "LockAdded") - .withArgs(acc03.address, 3, key, storage3.amount); + .withArgs(acc03.address, 3, owner.address, storage3.amount); }); }); describe("Set sellerBalance Valid State", async () => { @@ -1137,11 +1132,13 @@ describe("P2PIX", () => { 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).toString(), - true, - merkleRoot, + createDepositArgs( + ethers.BigNumber.from(10101).toString(), + merkleRoot, + erc20.address, + price, + true, + ), ); const state1 = await p2pix.callStatic.getValid( owner.address, @@ -1169,11 +1166,13 @@ describe("P2PIX", () => { const target = ethers.BigNumber.from("1").toString(); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - hashZero, + createDepositArgs( + target, + hashZero, + erc20.address, + price, + true, + ), ); await erc20 .connect(acc01) @@ -1181,11 +1180,13 @@ describe("P2PIX", () => { await p2pix .connect(acc01) .deposit( + createDepositArgs( + target, + hashZero, erc20.address, price, - target, false, - hashZero, + ), ); await erc20 .connect(acc02) @@ -1193,11 +1194,13 @@ describe("P2PIX", () => { await p2pix .connect(acc02) .deposit( + createDepositArgs( + target, + hashZero, erc20.address, price, - target, true, - hashZero, + ), ); const oldState1 = await p2pix.callStatic.getValid( owner.address, @@ -1267,22 +1270,24 @@ describe("P2PIX", () => { const sig = ethers.utils.splitSignature(flatSig); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - merkleRoot, + createDepositArgs( + target, + merkleRoot, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 6, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); const lockID = ethers.constants.One; await mine(13); @@ -1312,22 +1317,24 @@ describe("P2PIX", () => { const sig = ethers.utils.splitSignature(flatSig); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - merkleRoot, + createDepositArgs( + target, + merkleRoot, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 6, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); const lockID = ethers.constants.One; await p2pix.release( @@ -1362,22 +1369,24 @@ describe("P2PIX", () => { const sig = ethers.utils.splitSignature(flatSig); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - ethers.constants.HashZero, + createDepositArgs( + target, + ethers.constants.HashZero, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 6, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); await p2pix @@ -1392,13 +1401,13 @@ describe("P2PIX", () => { await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 6, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); const fail = p2pix .connect(acc01) @@ -1428,22 +1437,24 @@ describe("P2PIX", () => { await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - ethers.constants.HashZero, + createDepositArgs( + target, + ethers.constants.HashZero, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 6, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); const fail = p2pix .connect(acc01) @@ -1488,22 +1499,24 @@ describe("P2PIX", () => { await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - pixTarget, - true, - root, + createDepositArgs( + pixTarget, + root, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 6, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); const acc01Key = await p2pix.callStatic._castAddrToKey( acc01.address, @@ -1656,44 +1669,46 @@ describe("P2PIX", () => { const sig3 = ethers.utils.splitSignature(flatSig3); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - pixTarget, - true, - root, + createDepositArgs( + pixTarget, + root, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - 100, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [], + ), ); await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 6, - 50, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(50), + [], + [], + ), ); await p2pix .connect(acc03) .lock( - owner.address, - erc20.address, - // acc02.address, - // 10, - 25, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(25), + [], + [], + ), ); const lockStatus1 = @@ -1855,22 +1870,24 @@ describe("P2PIX", () => { const target = ethers.BigNumber.from(101).toString(); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - merkleRoot, + createDepositArgs( + target, + merkleRoot, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc02) .lock( + createLockArgs( owner.address, erc20.address, - // acc02.address, - // 0, - 1, + ethers.constants.One, [], [], + ), ); const lockID = ethers.constants.One; const fail = p2pix.unlockExpired([lockID]); @@ -1895,22 +1912,24 @@ describe("P2PIX", () => { const sig = ethers.utils.splitSignature(flatSig); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - pixTarget, - true, - merkleRoot, + createDepositArgs( + pixTarget, + merkleRoot, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc02) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - 1, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.constants.One, + [], + [], + ), ); const lockID = ethers.constants.One; // await mine(10); @@ -1932,22 +1951,24 @@ describe("P2PIX", () => { const target = ethers.BigNumber.from(101).toString(); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - merkleRoot, + createDepositArgs( + target, + merkleRoot, + erc20.address, + price, + true, + ), ); await p2pix .connect(acc02) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - 1, - [], - [], + createLockArgs( + owner.address, + erc20.address, + ethers.constants.One, + [], + [], + ), ); const lockID = ethers.constants.One; await mine(11); @@ -1997,22 +2018,24 @@ describe("P2PIX", () => { // test method through lock fx await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - merkleRoot, + createDepositArgs( + target, + merkleRoot, + erc20.address, + price, + true, + ), ); const lock1: ContractTransaction = await p2pix .connect(acc01) .lock( - owner.address, - erc20.address, - // acc02.address, - // 0, - price, - proof, - [], + createLockArgs( + owner.address, + erc20.address, + price, + proof, + [], + ), ); // as return values of non view functions can't be accessed // outside the evm, we fetch the lockID from the emitted event. @@ -2047,13 +2070,13 @@ describe("P2PIX", () => { // 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, - // 0, - 100, - [], - [lockID], + createLockArgs( + owner.address, + erc20.address, + ethers.BigNumber.from(100), + [], + [lockID], + ), ); const remaining = await p2pix.callStatic.getBalance( owner.address, @@ -2073,22 +2096,24 @@ describe("P2PIX", () => { // test method through withdraw fx await erc20.approve(p2pix.address, price); await p2pix.deposit( + createDepositArgs( + target, + merkleRoot, erc20.address, price, - target, true, - merkleRoot, + ), ); await p2pix .connect(acc01) .lock( + createLockArgs( owner.address, erc20.address, - // acc02.address, - // 0, price, proof, [], + ), ); const lockID = ethers.constants.One; // mine blocks to expire lock @@ -2114,11 +2139,13 @@ describe("P2PIX", () => { const target = ethers.BigNumber.from(101).toString(); await erc20.approve(p2pix.address, price); await p2pix.deposit( - erc20.address, - price, - target, - true, - merkleRoot, + createDepositArgs( + target, + merkleRoot, + erc20.address, + price, + true, + ), ); const fail = p2pix .connect(acc02) @@ -2137,11 +2164,13 @@ describe("P2PIX", () => { 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).toString(), - true, - merkleRoot, + createDepositArgs( + ethers.BigNumber.from(101).toString(), + merkleRoot, + erc20.address, + price, + true, + ), ); const tx = await p2pix.withdraw( erc20.address, @@ -2190,17 +2219,15 @@ describe("P2PIX", () => { ); }); 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, + owner.address, ); const tx = await p2pix .connect(owner) .setRoot(owner.address, merkleRoot); const newState = await p2pix.callStatic.sellerAllowList( - ownerKey, + owner.address, ); expect(tx).to.be.ok; diff --git a/test/utils/fixtures.ts b/test/utils/fixtures.ts index d63917b..8873405 100644 --- a/test/utils/fixtures.ts +++ b/test/utils/fixtures.ts @@ -12,53 +12,26 @@ import { Reputation, } from "../../src/types"; -// exported interfaces -export interface Deploys { - signers: string[]; - p2pix: string; - token: string; -} +import { Call, RepFixture, P2PixAndReputation, DepositArgs, LockArgs } from "./interfaces"; -export interface Lock { - sellerKey: BigNumber; - counter: BigNumber; - expirationBlock: BigNumber; - pixTarget: string; - token: string; - buyerAddress: string; - amount: BigNumber; -} - -export interface Call { - target: string; - callData: string; -} - -export interface Result { - success: boolean; - returnData: string; -} - -export interface P2pixFixture { - p2pix: P2PIX; - erc20: MockToken; - proof: string[]; - merkleRoot: string; -} - -export interface RepFixture { - reputation: Reputation; -} - -export interface MtcFixture { - multicall: Multicall; -} - -type P2PixAndReputation = P2pixFixture & - RepFixture & - MtcFixture; // exported constants +export const createDepositArgs = (pixTarget: string, allowlistRoot: string, token: string, amount: BigNumber, valid:boolean): DepositArgs => ({ + pixTarget, + allowlistRoot, + token, + amount, + valid, +}); + +export const createLockArgs = (seller: string, token: string, amount: BigNumber, merkleProof: string[], expiredLocks: BigNumber[]): LockArgs => ({ + seller, + token, + amount, + merkleProof, + expiredLocks, +}); + export const getSignerAddrs = ( amount: number, addrs: SignerWithAddress[], diff --git a/test/utils/interfaces.ts b/test/utils/interfaces.ts new file mode 100644 index 0000000..bb99a6e --- /dev/null +++ b/test/utils/interfaces.ts @@ -0,0 +1,71 @@ +import { BigNumber } from "ethers"; + +import { + MockToken, + Multicall, + P2PIX, + Reputation, +} from "../../src/types"; + + +// exported interfaces +export interface Deploys { + signers: string[]; + p2pix: string; + token: string; +} + +export interface DepositArgs { + pixTarget: string; + allowlistRoot: string; + token: string; + amount: BigNumber; + valid: boolean; +} + +export interface LockArgs { + seller: string; + token: string; + amount: BigNumber; + merkleProof: string[]; + expiredLocks: BigNumber[]; +} + +export interface Lock { + counter: BigNumber; + expirationBlock: BigNumber; + pixTarget: string; + amount: BigNumber; + token: string; + buyerAddress: string; + seller: string; +} + +export interface Call { + target: string; + callData: string; +} + +export interface Result { + success: boolean; + returnData: string; +} + +export interface P2pixFixture { + p2pix: P2PIX; + erc20: MockToken; + proof: string[]; + merkleRoot: string; +} + +export interface RepFixture { + reputation: Reputation; +} + +export interface MtcFixture { + multicall: Multicall; +} + +export type P2PixAndReputation = P2pixFixture & + RepFixture & + MtcFixture; \ No newline at end of file