Compare commits
10 Commits
8e2323a099
...
4568cad8f0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4568cad8f0 | ||
|
|
55fc45fc73 | ||
|
|
8310e013f6 | ||
|
|
4c8016080d | ||
|
|
8f51b7841c | ||
|
|
d946c239dc | ||
|
|
ce28faae9d | ||
|
|
bb10cf953f | ||
|
|
6fe1e794d0 | ||
|
|
0d612572c6 |
@@ -9,4 +9,4 @@ POLYGONSCAN_API_KEY="{INSERT_API_KEY}"
|
||||
GASPRICE_API_ENDPOINT="https://api.etherscan.io/api?module=proxy&action=eth_gasPrice"
|
||||
COINMARKETCAP_API_KEY="{INSERT_API_KEY}"
|
||||
|
||||
REPORT_GAS="true"
|
||||
REPORT_GAS="true"
|
||||
@@ -18,4 +18,6 @@
|
||||
coverage.json
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
yarn-error.log*
|
||||
|
||||
contracts/p2pix.sol
|
||||
30
README.md
30
README.md
@@ -18,7 +18,6 @@
|
||||
│ ├── tokens
|
||||
│ │ └── ERC20.sol
|
||||
│ └── utils
|
||||
│ ├── Counters.sol
|
||||
│ ├── MerkleProofLib.sol
|
||||
│ ├── ReentrancyGuard.sol
|
||||
│ └── SafeTransferLib.sol
|
||||
@@ -32,10 +31,12 @@
|
||||
|
||||
## Current Deployment addresses
|
||||
|
||||
| Testnet | Token Address | P2pix Address |
|
||||
|--------- |-------------------------------------------- |-------------------------------------------- |
|
||||
| Goerli | 0x294003F602c321627152c6b7DED3EAb5bEa853Ee | 0x5f3EFA9A90532914545CEf527C530658af87e196 |
|
||||
| Mumbai | 0x294003F602c321627152c6b7DED3EAb5bEa853Ee | 0x5f3EFA9A90532914545CEf527C530658af87e196 |
|
||||
### V1
|
||||
|
||||
| Testnet | Token Address | P2pix Address |
|
||||
| ------- | ------------------------------------------ | ------------------------------------------ |
|
||||
| Goerli | 0x294003F602c321627152c6b7DED3EAb5bEa853Ee | 0x5f3EFA9A90532914545CEf527C530658af87e196 |
|
||||
| Mumbai | 0x294003F602c321627152c6b7DED3EAb5bEa853Ee | 0x5f3EFA9A90532914545CEf527C530658af87e196 |
|
||||
|
||||
<!-- All contracts deployed by 0x8dC06F985C131166570825F52447E8c88d64aE20 -->
|
||||
|
||||
@@ -47,6 +48,24 @@
|
||||
|
||||
<!-- https://mumbai.polygonscan.com/address/0x5f3EFA9A90532914545CEf527C530658af87e196#code -->
|
||||
|
||||
### V2
|
||||
|
||||
| Testnet | Token Address | P2pix Address | Reputation Address | Multicall Address |
|
||||
| ------- | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
|
||||
| Goerli | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0x2414817FF64A114d91eCFA16a834d3fCf69103d4 | 0x2CFD9354Ec7614fEf036EFd6A730dA1d5fC2762A | 0x8FE009992d96A86c7f0Bccdaf1eC3471E302a8a6 |
|
||||
| Mumbai | 0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29 | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0x570445E3eF413bCDb5De79ed27B1c3840683e385 | 0x718B2C4DE4F9654E1349F610ff561249bfe1c418 |
|
||||
|
||||
<!-- All contracts deployed by 0x8dC06F985C131166570825F52447E8c88d64aE20 -->
|
||||
<!-- https://goerli.etherscan.io/address/0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00#code -->
|
||||
<!-- https://goerli.etherscan.io/address/0x2414817FF64A114d91eCFA16a834d3fCf69103d4#code -->
|
||||
<!-- https://goerli.etherscan.io/address/0x2CFD9354Ec7614fEf036EFd6A730dA1d5fC2762A#code -->
|
||||
<!-- https://goerli.etherscan.io/address/0x8FE009992d96A86c7f0Bccdaf1eC3471E302a8a6#code -->
|
||||
|
||||
<!-- https://mumbai.polygonscan.com/address/0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29#code -->
|
||||
<!-- https://mumbai.polygonscan.com/address/0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00#code -->
|
||||
<!-- https://mumbai.polygonscan.com/address/0x570445e3ef413bcdb5de79ed27b1c3840683e385#code -->
|
||||
<!-- https://mumbai.polygonscan.com/address/0x718B2C4DE4F9654E1349F610ff561249bfe1c418#code -->
|
||||
|
||||
## Usage
|
||||
|
||||
### Pre Requisites
|
||||
@@ -121,7 +140,6 @@ yarn deploy2:localhost
|
||||
**_NOTE_:** The second script transfers 2M tokens to the first wallet of the node.
|
||||
To use the P2Pix smart contract first transfer some of the tokens to other wallets.
|
||||
|
||||
|
||||
## Deploying to testnets
|
||||
|
||||
Deploy to Ethereum's Goerli testnet:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -18,11 +18,21 @@
|
||||
"name": "AmountNotAllowed",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "DecOverflow",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "DepositAlreadyExists",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "EmptyPixTarget",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "InvalidDeposit",
|
||||
@@ -48,6 +58,11 @@
|
||||
"name": "LoopOverflow",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "MaxBalExceeded",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NoTokens",
|
||||
@@ -63,6 +78,11 @@
|
||||
"name": "NotExpired",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "NotInitialized",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "OnlySeller",
|
||||
@@ -111,12 +131,6 @@
|
||||
"name": "seller",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "depositID",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
@@ -144,29 +158,10 @@
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "depositID",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "DepositClosed",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "seller",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "depositID",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
@@ -207,14 +202,14 @@
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "bytes32",
|
||||
"internalType": "uint256",
|
||||
"name": "lockID",
|
||||
"type": "bytes32"
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "depositID",
|
||||
"name": "seller",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
@@ -251,9 +246,9 @@
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "bytes32",
|
||||
"internalType": "uint256",
|
||||
"name": "lockId",
|
||||
"type": "bytes32"
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
@@ -276,9 +271,9 @@
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "bytes32",
|
||||
"internalType": "uint256",
|
||||
"name": "lockId",
|
||||
"type": "bytes32"
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "LockReturned",
|
||||
@@ -316,6 +311,31 @@
|
||||
"name": "RootUpdated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "seller",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "bool",
|
||||
"name": "state",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "ValidSet",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "Counters",
|
||||
"sourceName": "contracts/lib/utils/Counters.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "DecOverflow",
|
||||
"type": "error"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x602d6037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c6343000809000a",
|
||||
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c6343000809000a",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
116
artifacts/contracts/lib/utils/Multicall.sol/Multicall.json
Normal file
116
artifacts/contracts/lib/utils/Multicall.sol/Multicall.json
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "Multicall",
|
||||
"sourceName": "contracts/lib/utils/Multicall.sol",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "reason",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "CallFailed",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "callData",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Multicall.Call[]",
|
||||
"name": "calls",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"name": "mtc1",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes[]",
|
||||
"name": "",
|
||||
"type": "bytes[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "callData",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Multicall.Call[]",
|
||||
"name": "calls",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"name": "mtc2",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "returnData",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Multicall.Result[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x60806040526108ec806100136000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80631b57b72f1461003b57806386575ee914610066575b600080fd5b61004e610049366004610438565b610087565b60405161005d93929190610527565b60405180910390f35b610079610074366004610438565b610227565b60405161005d9291906105cb565b600080606043804085848167ffffffffffffffff8111156100aa576100aa610653565b6040519080825280602002602001820160405280156100f057816020015b6040805180820190915260008152606060208201528152602001906001900390816100c85790505b50905060005b82811015610217576000808b8b8481811061011357610113610682565b905060200281019061012591906106b1565b6101339060208101906106ef565b73ffffffffffffffffffffffffffffffffffffffff168c8c8581811061015b5761015b610682565b905060200281019061016d91906106b1565b61017b90602081019061072c565b604051610189929190610791565b6000604051808303816000865af19150503d80600081146101c6576040519150601f19603f3d011682016040523d82523d6000602084013e6101cb565b606091505b509150915060405180604001604052808315158152602001828152508484815181106101f9576101f9610682565b60200260200101819052508261020e906107a1565b925050506100f6565b5092989197509195509350505050565b600060604383838167ffffffffffffffff81111561024757610247610653565b60405190808252806020026020018201604052801561027a57816020015b60608152602001906001900390816102655790505b50905060005b828110156104285760008089898481811061029d5761029d610682565b90506020028101906102af91906106b1565b6102bd9060208101906106ef565b73ffffffffffffffffffffffffffffffffffffffff168a8a858181106102e5576102e5610682565b90506020028101906102f791906106b1565b61030590602081019061072c565b604051610313929190610791565b6000604051808303816000865af19150503d8060008114610350576040519150601f19603f3d011682016040523d82523d6000602084013e610355565b606091505b5091509150816103f7576044815110156103aa576040517fb5e1dc2d00000000000000000000000000000000000000000000000000000000815260206004820152600060248201526044015b60405180910390fd5b600481019050808060200190518101906103c49190610801565b6040517fb5e1dc2d0000000000000000000000000000000000000000000000000000000081526004016103a191906108cc565b8084848151811061040a5761040a610682565b60200260200101819052508261041f906107a1565b92505050610280565b50919350909150505b9250929050565b6000806020838503121561044b57600080fd5b823567ffffffffffffffff8082111561046357600080fd5b818501915085601f83011261047757600080fd5b81358181111561048657600080fd5b8660208260051b850101111561049b57600080fd5b60209290920196919550909350505050565b60005b838110156104c85781810151838201526020016104b0565b838111156104d7576000848401525b50505050565b600081518084526104f58160208601602086016104ad565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60006060820185835260208581850152604060608186015282865180855260808701915060808160051b880101945083880160005b828110156105bb578887037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8001845281518051151588528601518688018690526105a8868901826104dd565b975050928501929085019060010161055c565b50949a9950505050505050505050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610645577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526106338683516104dd565b955092840192908401906001016105f9565b509398975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126106e557600080fd5b9190910192915050565b60006020828403121561070157600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461072557600080fd5b9392505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261076157600080fd5b83018035915067ffffffffffffffff82111561077c57600080fd5b60200191503681900382131561043157600080fd5b8183823760009101908152919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156107fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60006020828403121561081357600080fd5b815167ffffffffffffffff8082111561082b57600080fd5b818401915084601f83011261083f57600080fd5b81518181111561085157610851610653565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561089757610897610653565b816040528281528760208487010111156108b057600080fd5b6108c18360208301602088016104ad565b979650505050505050565b60208152600061072560208301846104dd56fea164736f6c6343000809000a",
|
||||
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80631b57b72f1461003b57806386575ee914610066575b600080fd5b61004e610049366004610438565b610087565b60405161005d93929190610527565b60405180910390f35b610079610074366004610438565b610227565b60405161005d9291906105cb565b600080606043804085848167ffffffffffffffff8111156100aa576100aa610653565b6040519080825280602002602001820160405280156100f057816020015b6040805180820190915260008152606060208201528152602001906001900390816100c85790505b50905060005b82811015610217576000808b8b8481811061011357610113610682565b905060200281019061012591906106b1565b6101339060208101906106ef565b73ffffffffffffffffffffffffffffffffffffffff168c8c8581811061015b5761015b610682565b905060200281019061016d91906106b1565b61017b90602081019061072c565b604051610189929190610791565b6000604051808303816000865af19150503d80600081146101c6576040519150601f19603f3d011682016040523d82523d6000602084013e6101cb565b606091505b509150915060405180604001604052808315158152602001828152508484815181106101f9576101f9610682565b60200260200101819052508261020e906107a1565b925050506100f6565b5092989197509195509350505050565b600060604383838167ffffffffffffffff81111561024757610247610653565b60405190808252806020026020018201604052801561027a57816020015b60608152602001906001900390816102655790505b50905060005b828110156104285760008089898481811061029d5761029d610682565b90506020028101906102af91906106b1565b6102bd9060208101906106ef565b73ffffffffffffffffffffffffffffffffffffffff168a8a858181106102e5576102e5610682565b90506020028101906102f791906106b1565b61030590602081019061072c565b604051610313929190610791565b6000604051808303816000865af19150503d8060008114610350576040519150601f19603f3d011682016040523d82523d6000602084013e610355565b606091505b5091509150816103f7576044815110156103aa576040517fb5e1dc2d00000000000000000000000000000000000000000000000000000000815260206004820152600060248201526044015b60405180910390fd5b600481019050808060200190518101906103c49190610801565b6040517fb5e1dc2d0000000000000000000000000000000000000000000000000000000081526004016103a191906108cc565b8084848151811061040a5761040a610682565b60200260200101819052508261041f906107a1565b92505050610280565b50919350909150505b9250929050565b6000806020838503121561044b57600080fd5b823567ffffffffffffffff8082111561046357600080fd5b818501915085601f83011261047757600080fd5b81358181111561048657600080fd5b8660208260051b850101111561049b57600080fd5b60209290920196919550909350505050565b60005b838110156104c85781810151838201526020016104b0565b838111156104d7576000848401525b50505050565b600081518084526104f58160208601602086016104ad565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60006060820185835260208581850152604060608186015282865180855260808701915060808160051b880101945083880160005b828110156105bb578887037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8001845281518051151588528601518688018690526105a8868901826104dd565b975050928501929085019060010161055c565b50949a9950505050505050505050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610645577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526106338683516104dd565b955092840192908401906001016105f9565b509398975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126106e557600080fd5b9190910192915050565b60006020828403121561070157600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461072557600080fd5b9392505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261076157600080fd5b83018035915067ffffffffffffffff82111561077c57600080fd5b60200191503681900382131561043157600080fd5b8183823760009101908152919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156107fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60006020828403121561081357600080fd5b815167ffffffffffffffff8082111561082b57600080fd5b818401915084601f83011261083f57600080fd5b81518181111561085157610851610653565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561089757610897610653565b816040528281528760208487010111156108b057600080fd5b6108c18360208301602088016104ad565b979650505050505050565b60208152600061072560208301846104dd56fea164736f6c6343000809000a",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"_format": "hh-sol-dbg-1",
|
||||
"buildInfo": "../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
||||
"buildInfo": "../../build-info/901b067f80b6616939e558d795c555e5.json"
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,26 +2,16 @@
|
||||
pragma solidity 0.8.9;
|
||||
|
||||
library DataTypes {
|
||||
struct Deposit {
|
||||
/// @dev Remaining tokens available.
|
||||
uint256 remaining;
|
||||
/// @dev The PIX account for the seller receive transactions.
|
||||
string pixTarget;
|
||||
address seller;
|
||||
/// @dev ERC20 stable token address.
|
||||
address token;
|
||||
/// @dev Could be invalidated by the seller.
|
||||
bool valid;
|
||||
}
|
||||
|
||||
struct Lock {
|
||||
uint256 depositID;
|
||||
uint256 sellerKey;
|
||||
uint256 counter;
|
||||
/// @dev Amount to be paid for relayer.
|
||||
uint256 relayerPremium;
|
||||
/// @dev Amount to be tranfered via PIX.
|
||||
uint256 amount;
|
||||
/// @dev If not paid at this block will be expired.
|
||||
uint256 expirationBlock;
|
||||
uint160 pixTarget;
|
||||
/// @dev Where the tokens are sent the when order gets validated.
|
||||
address buyerAddress;
|
||||
/// @dev Relayer's target address that receives `relayerPremium` funds.
|
||||
@@ -29,5 +19,14 @@ library DataTypes {
|
||||
/// @dev Relayer address (msg.sender) that facilitated this transaction.
|
||||
/// @dev Reputation points accruer.
|
||||
address relayerAddress;
|
||||
address token;
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
enum LockStatus {
|
||||
Inexistent, // 0 := Uninitialized Lock.
|
||||
Active, // 1 := Valid Lock.
|
||||
Expired, // 2 := Expired Lock.
|
||||
Released // 3 := Already released Lock.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,33 +7,34 @@ interface EventAndErrors {
|
||||
|
||||
event DepositAdded(
|
||||
address indexed seller,
|
||||
uint256 depositID,
|
||||
// uint256 depositID,
|
||||
address token,
|
||||
uint256 amount
|
||||
);
|
||||
event DepositClosed(
|
||||
event ValidSet(
|
||||
address indexed seller,
|
||||
uint256 depositID
|
||||
address token,
|
||||
bool state
|
||||
);
|
||||
event DepositWithdrawn(
|
||||
address indexed seller,
|
||||
uint256 depositID,
|
||||
address token,
|
||||
uint256 amount
|
||||
);
|
||||
event LockAdded(
|
||||
address indexed buyer,
|
||||
bytes32 indexed lockID,
|
||||
uint256 depositID,
|
||||
uint256 indexed lockID,
|
||||
uint256 seller,
|
||||
uint256 amount
|
||||
);
|
||||
event LockReleased(
|
||||
address indexed buyer,
|
||||
bytes32 lockId,
|
||||
uint256 lockId,
|
||||
uint256 amount
|
||||
);
|
||||
event LockReturned(
|
||||
address indexed buyer,
|
||||
bytes32 lockId
|
||||
uint256 lockId
|
||||
);
|
||||
event FundsWithdrawn(
|
||||
address owner,
|
||||
@@ -104,4 +105,13 @@ interface EventAndErrors {
|
||||
/// @dev Reverts on an expired lock.
|
||||
/// @dev 0xf6fafba0
|
||||
error LockExpired();
|
||||
|
||||
/// @dev 0xce3a3d37
|
||||
error DecOverflow();
|
||||
/// @dev 0xf3fb0eb9
|
||||
error MaxBalExceeded();
|
||||
/// @dev 0x6a3bc53e
|
||||
error EmptyPixTarget();
|
||||
/// @dev 0x87138d5c
|
||||
error NotInitialized();
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity >=0.8.4;
|
||||
|
||||
/// @title Counters
|
||||
/// @author buf0t9
|
||||
/// @author Modified from OpenZeppelin Contracts
|
||||
/// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol)
|
||||
/// @notice Provides counters that can only be incremented, decrementedor reset.
|
||||
/// @dev Include with `using Counters for Counters.Counter;`
|
||||
library Counters {
|
||||
// solhint-disable no-inline-assembly
|
||||
struct Counter {
|
||||
/// @dev Interactions must be restricted to the library's function.
|
||||
uint256 _val; // := 0
|
||||
}
|
||||
|
||||
/// @dev 0xce3a3d37
|
||||
error DecOverflow();
|
||||
|
||||
function current(
|
||||
Counter storage counter
|
||||
) internal view returns (uint256 _val) {
|
||||
assembly {
|
||||
_val := sload(counter.slot)
|
||||
}
|
||||
}
|
||||
|
||||
function increment(Counter storage counter) internal {
|
||||
assembly {
|
||||
let _val := sload(counter.slot)
|
||||
sstore(counter.slot, add(_val, 0x01))
|
||||
}
|
||||
}
|
||||
|
||||
function decrement(Counter storage counter) internal {
|
||||
assembly {
|
||||
let _val := sload(counter.slot)
|
||||
if or(iszero(_val), lt(_val, 0x00)) {
|
||||
mstore(0x00, 0xce3a3d37)
|
||||
revert(0x1c, 0x04)
|
||||
}
|
||||
sstore(counter.slot, sub(_val, 0x01))
|
||||
}
|
||||
}
|
||||
|
||||
function reset(Counter storage counter) internal {
|
||||
assembly {
|
||||
sstore(counter.slot, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
80
contracts/lib/utils/Multicall.sol
Normal file
80
contracts/lib/utils/Multicall.sol
Normal file
@@ -0,0 +1,80 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity >=0.8.4;
|
||||
|
||||
/// @title Multicall.
|
||||
/// @notice Contract that batches view function calls and aggregates their results.
|
||||
/// @author Adapted from Makerdao's Multicall2 (https://github.com/makerdao/multicall/blob/master/src/Multicall2.sol).
|
||||
|
||||
contract Multicall {
|
||||
/// @dev 0x
|
||||
error CallFailed(string reason);
|
||||
|
||||
struct Call {
|
||||
address target;
|
||||
bytes callData;
|
||||
}
|
||||
struct Result {
|
||||
bool success;
|
||||
bytes returnData;
|
||||
}
|
||||
|
||||
//prettier-ignore
|
||||
constructor(/* */) payable {/* */}
|
||||
|
||||
function mtc1(Call[] calldata calls)
|
||||
external
|
||||
returns (uint256, bytes[] memory)
|
||||
{
|
||||
uint256 bn = block.number;
|
||||
uint256 len = calls.length;
|
||||
bytes[] memory res = new bytes[](len);
|
||||
uint256 j;
|
||||
|
||||
while (j < len) {
|
||||
(bool success, bytes memory ret) = calls[j]
|
||||
.target
|
||||
.call(calls[j].callData);
|
||||
if (!success) {
|
||||
if (ret.length < 0x44) revert CallFailed("");
|
||||
assembly {
|
||||
ret := add(ret, 0x04)
|
||||
}
|
||||
revert CallFailed({
|
||||
reason: abi.decode(ret, (string))
|
||||
});
|
||||
}
|
||||
res[j] = ret;
|
||||
++j;
|
||||
}
|
||||
return (bn, res);
|
||||
}
|
||||
|
||||
function mtc2(Call[] calldata calls)
|
||||
external
|
||||
returns (
|
||||
uint256,
|
||||
bytes32,
|
||||
Result[] memory
|
||||
)
|
||||
{
|
||||
uint256 bn = block.number;
|
||||
// µ 0 s [0] ≡ P(IHp , µs [0], 0) ∴ P is the hash of a block of a particular number, up to a maximum age.
|
||||
// 0 is left on the stack if the looked for `block.number` is >= to the current `block.number` or more than 256
|
||||
// blocks behind the current block (Yellow Paper, p. 33, https://ethereum.github.io/yellowpaper/paper.pdf).
|
||||
bytes32 bh = blockhash(
|
||||
bn /* - 1 */
|
||||
);
|
||||
uint256 len = calls.length;
|
||||
Result[] memory res = new Result[](len);
|
||||
uint256 i;
|
||||
for (i; i < len; ) {
|
||||
(bool success, bytes memory ret) = calls[i]
|
||||
.target
|
||||
.call(calls[i].callData);
|
||||
|
||||
res[i] = Result(success, ret);
|
||||
++i;
|
||||
}
|
||||
return (bn, bh, res);
|
||||
}
|
||||
}
|
||||
@@ -114,46 +114,4 @@ library SafeTransferLib {
|
||||
|
||||
require(success, "TRANSFER_FAILED");
|
||||
}
|
||||
|
||||
function safeApprove(
|
||||
ERC20 token,
|
||||
address to,
|
||||
uint256 amount
|
||||
) internal {
|
||||
bool success;
|
||||
|
||||
assembly {
|
||||
// We'll write our calldata to this slot below, but restore it later.
|
||||
let memPointer := mload(0x40)
|
||||
|
||||
// Write the abi-encoded calldata into memory, beginning with the function selector.
|
||||
mstore(
|
||||
0,
|
||||
0x095ea7b300000000000000000000000000000000000000000000000000000000
|
||||
)
|
||||
mstore(4, to) // Append the "to" argument.
|
||||
mstore(36, amount) // Append the "amount" argument.
|
||||
|
||||
success := and(
|
||||
// Set success to whether the call reverted, if not we check it either
|
||||
// returned exactly 1 (can't just be non-zero data), or had no return data.
|
||||
or(
|
||||
and(
|
||||
eq(mload(0), 1),
|
||||
gt(returndatasize(), 31)
|
||||
),
|
||||
iszero(returndatasize())
|
||||
),
|
||||
// We use 68 because that's the total length of our calldata (4 + 32 * 2)
|
||||
// Counterintuitively, this call() must be positioned after the or() in the
|
||||
// surrounding and() because and() evaluates its arguments from right to left.
|
||||
call(gas(), token, 0, 0, 68, 0, 32)
|
||||
)
|
||||
|
||||
mstore(0x60, 0) // Restore the zero slot to zero.
|
||||
mstore(0x40, memPointer) // Restore the memPointer.
|
||||
}
|
||||
|
||||
require(success, "APPROVE_FAILED");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ pragma solidity 0.8.9;
|
||||
///
|
||||
|
||||
import { Owned } from "./lib/auth/Owned.sol";
|
||||
import { Counters } from "./lib/utils/Counters.sol";
|
||||
import { ERC20, SafeTransferLib } from "./lib/utils/SafeTransferLib.sol";
|
||||
import { IReputation } from "./lib/interfaces/IReputation.sol";
|
||||
import { MerkleProofLib as Merkle } from "./lib/utils/MerkleProofLib.sol";
|
||||
@@ -24,36 +23,55 @@ contract P2PIX is
|
||||
{
|
||||
// solhint-disable use-forbidden-name
|
||||
// solhint-disable no-inline-assembly
|
||||
// solhint-disable no-empty-blocks
|
||||
|
||||
using Counters for Counters.Counter;
|
||||
using DT for DT.Deposit;
|
||||
using DT for DT.Lock;
|
||||
using DT for DT.LockStatus;
|
||||
|
||||
/// ███ Constants ██████████████████████████████████████████████████████████
|
||||
|
||||
/// @dev The bitmask of `sellerBalance` entry.
|
||||
uint256 private constant BITMASK_SB_ENTRY = (1 << 94) - 1;
|
||||
/// @dev The bit position of `pixTarget` in `sellerBalance`.
|
||||
uint256 private constant BITPOS_PIXTARGET = 95;
|
||||
/// @dev The bit position of `valid` in `sellerBalance`.
|
||||
uint256 private constant BITPOS_VALID = 255;
|
||||
/// @dev The bitmask of all 256 bits of `sellerBalance` except for the last one.
|
||||
uint256 private constant BITMASK_VALID = (1 << 255) - 1;
|
||||
/// @dev The scalar of BRZ token.
|
||||
uint256 public constant WAD = 1e18;
|
||||
|
||||
/// ███ Storage ████████████████████████████████████████████████████████████
|
||||
|
||||
IReputation public reputation;
|
||||
Counters.Counter public depositCount;
|
||||
|
||||
/// @dev Default blocks that lock will hold tokens.
|
||||
uint256 public defaultLockBlocks;
|
||||
/// @dev The scalar of BRZ token.
|
||||
uint256 public constant WAD = 1e18;
|
||||
uint256 public lockCounter;
|
||||
|
||||
/// @dev List of Locks.
|
||||
mapping(uint256 => DT.Lock) public mapLocks;
|
||||
/// @dev Seller casted to key => Seller's allowlist merkleroot.
|
||||
mapping(uint256 => bytes32) public sellerAllowList;
|
||||
/// @dev Stores an relayer's last computed credit.
|
||||
mapping(uint256 => uint256) public userRecord;
|
||||
/// @dev List of valid Bacen signature addresses
|
||||
mapping(uint256 => bool) public validBacenSigners;
|
||||
/// @dev Seller list of deposits
|
||||
mapping(uint256 => DT.Deposit) public mapDeposits;
|
||||
/// @dev List of Locks.
|
||||
mapping(bytes32 => DT.Lock) public mapLocks;
|
||||
/// @dev List of Pix transactions already signed.
|
||||
mapping(bytes32 => bool) public usedTransactions;
|
||||
/// @dev Seller casted to key => Seller's allowlist merkleroot.
|
||||
mapping(uint256 => bytes32) public sellerAllowList;
|
||||
/// @dev Tokens allowed to serve as the underlying amount of a deposit.
|
||||
mapping(ERC20 => bool) public allowedERC20s;
|
||||
|
||||
// BITS LAYOUT
|
||||
// `uint96` [0...94] := balance
|
||||
// `uint160` [95...254] := pixTarget
|
||||
// `bool` [255] := valid
|
||||
|
||||
/// @dev `balance` max. value = 10**26.
|
||||
/// @dev `pixTarget` keys are restricted to 160 bits.
|
||||
mapping(uint256 => mapping(ERC20 => uint256))
|
||||
public sellerBalance;
|
||||
|
||||
/// ███ Constructor ████████████████████████████████████████████████████████
|
||||
|
||||
constructor(
|
||||
@@ -76,27 +94,25 @@ contract P2PIX is
|
||||
/// @dev Seller needs to send his tokens to the P2PIX smart contract.
|
||||
/// @param _pixTarget Pix key destination provided by the offer's seller.
|
||||
/// @param allowlistRoot Optional allow list merkleRoot update `bytes32` value.
|
||||
/// @return depositID The `uint256` return value provided
|
||||
/// as the deposit identifier.
|
||||
/// @dev Function sighash: 0xbfe07da6.
|
||||
function deposit(
|
||||
address _token,
|
||||
uint256 _amount,
|
||||
string calldata _pixTarget,
|
||||
uint96 _amount,
|
||||
uint160 _pixTarget,
|
||||
bool _valid,
|
||||
bytes32 allowlistRoot
|
||||
) public returns (uint256 depositID) {
|
||||
) public {
|
||||
ERC20 t = ERC20(_token);
|
||||
uint256 k = _castAddrToKey(msg.sender);
|
||||
|
||||
if (_pixTarget == 0) revert EmptyPixTarget();
|
||||
if (!allowedERC20s[t]) revert TokenDenied();
|
||||
uint256 _sellerBalance = sellerBalance[k][t];
|
||||
|
||||
(depositID) = _encodeDepositID();
|
||||
|
||||
DT.Deposit memory d = DT.Deposit({
|
||||
remaining: _amount,
|
||||
pixTarget: _pixTarget,
|
||||
seller: msg.sender,
|
||||
token: _token,
|
||||
valid: true
|
||||
});
|
||||
uint256 currBal = _sellerBalance & BITMASK_SB_ENTRY;
|
||||
if ((currBal + _amount) > 1e8 ether)
|
||||
revert MaxBalExceeded();
|
||||
|
||||
setReentrancyGuard();
|
||||
|
||||
@@ -104,8 +120,19 @@ contract P2PIX is
|
||||
setRoot(msg.sender, allowlistRoot);
|
||||
}
|
||||
|
||||
mapDeposits[depositID] = d;
|
||||
depositCount.increment();
|
||||
uint256 amountCasted;
|
||||
uint256 pixTargetCasted;
|
||||
uint256 validCasted;
|
||||
(
|
||||
amountCasted,
|
||||
pixTargetCasted,
|
||||
validCasted
|
||||
) = _castToUint(_amount, _pixTarget, _valid);
|
||||
|
||||
sellerBalance[k][t] =
|
||||
(currBal + amountCasted) |
|
||||
(pixTargetCasted << BITPOS_PIXTARGET) |
|
||||
(validCasted << BITPOS_VALID);
|
||||
|
||||
SafeTransferLib.safeTransferFrom(
|
||||
t,
|
||||
@@ -116,26 +143,31 @@ contract P2PIX is
|
||||
|
||||
clearReentrancyGuard();
|
||||
|
||||
emit DepositAdded(
|
||||
msg.sender,
|
||||
depositID,
|
||||
_token,
|
||||
_amount
|
||||
);
|
||||
emit DepositAdded(msg.sender, _token, _amount);
|
||||
}
|
||||
|
||||
/// @notice Enables seller to invalidate future
|
||||
/// locks made to his/her token offering order.
|
||||
/// @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];
|
||||
|
||||
function cancelDeposit(uint256 depositID) public {
|
||||
_onlySeller(depositID);
|
||||
mapDeposits[depositID].valid = false;
|
||||
emit DepositClosed(
|
||||
mapDeposits[depositID].seller,
|
||||
depositID
|
||||
);
|
||||
if (_sellerBalance != 0) {
|
||||
uint256 _valid;
|
||||
assembly {
|
||||
_valid := state
|
||||
}
|
||||
|
||||
_sellerBalance =
|
||||
(_sellerBalance & BITMASK_VALID) |
|
||||
(_valid << BITPOS_VALID);
|
||||
|
||||
sellerBalance[key][token] = _sellerBalance;
|
||||
|
||||
emit ValidSet(msg.sender, address(token), state);
|
||||
} else revert NotInitialized();
|
||||
}
|
||||
|
||||
/// @notice Public method designed to lock an remaining amount of
|
||||
@@ -158,57 +190,70 @@ contract P2PIX is
|
||||
/// @return lockID The `bytes32` value returned as the lock identifier.
|
||||
/// @dev Function sighash: 0x03aaf306.
|
||||
function lock(
|
||||
uint256 _depositID,
|
||||
address _seller,
|
||||
address _token,
|
||||
address _buyerAddress,
|
||||
address _relayerTarget,
|
||||
uint256 _relayerPremium,
|
||||
uint256 _amount,
|
||||
bytes32[] calldata merkleProof,
|
||||
bytes32[] calldata expiredLocks
|
||||
) public nonReentrant returns (bytes32 lockID) {
|
||||
uint256[] calldata expiredLocks
|
||||
) public nonReentrant returns (uint256) {
|
||||
unlockExpired(expiredLocks);
|
||||
DT.Deposit storage d = mapDeposits[_depositID];
|
||||
|
||||
if (!d.valid) revert InvalidDeposit();
|
||||
if (d.remaining < _amount) revert NotEnoughTokens();
|
||||
ERC20 t = ERC20(_token);
|
||||
if (!getValid(_seller, t)) revert InvalidDeposit();
|
||||
|
||||
(lockID) = _encodeLockID(
|
||||
_depositID,
|
||||
uint256 bal = getBalance(_seller, t);
|
||||
if (bal < _amount) revert NotEnoughTokens();
|
||||
|
||||
uint256 k = _castAddrToKey(_seller);
|
||||
|
||||
uint256 cCounter = lockCounter + 1;
|
||||
|
||||
if (
|
||||
mapLocks[cCounter].expirationBlock >= block.number
|
||||
) revert NotExpired();
|
||||
|
||||
DT.Lock memory l = DT.Lock(
|
||||
k,
|
||||
cCounter,
|
||||
_relayerPremium,
|
||||
_amount,
|
||||
_buyerAddress
|
||||
(block.number + defaultLockBlocks),
|
||||
uint160(sellerBalance[k][t] >> BITPOS_PIXTARGET),
|
||||
_buyerAddress,
|
||||
_relayerTarget,
|
||||
msg.sender,
|
||||
address(t)
|
||||
);
|
||||
|
||||
DT.Lock memory l = DT.Lock({
|
||||
depositID: _depositID,
|
||||
relayerPremium: _relayerPremium,
|
||||
amount: _amount,
|
||||
expirationBlock: (block.number +
|
||||
defaultLockBlocks),
|
||||
buyerAddress: _buyerAddress,
|
||||
relayerTarget: _relayerTarget,
|
||||
relayerAddress: msg.sender
|
||||
});
|
||||
|
||||
if (merkleProof.length != 0) {
|
||||
merkleVerify(
|
||||
merkleProof,
|
||||
sellerAllowList[_castAddrToKey(d.seller)],
|
||||
sellerAllowList[k],
|
||||
msg.sender
|
||||
);
|
||||
|
||||
_addLock(lockID, l, d);
|
||||
_addLock(bal, _amount, cCounter, l, t, k);
|
||||
|
||||
lockCounter++;
|
||||
|
||||
// Halt execution and output `lockID`.
|
||||
return lockID;
|
||||
return cCounter;
|
||||
} else {
|
||||
if (l.amount <= 1e2 ether) {
|
||||
_addLock(lockID, l, d);
|
||||
_addLock(bal, _amount, cCounter, l, t, k);
|
||||
|
||||
lockCounter++;
|
||||
|
||||
// Halt execution and output `lockID`.
|
||||
return lockID;
|
||||
return cCounter;
|
||||
} else {
|
||||
uint256 userCredit = userRecord[
|
||||
_castAddrToKey(msg.sender)
|
||||
];
|
||||
|
||||
uint256 spendLimit;
|
||||
(spendLimit) = _limiter(userCredit / WAD);
|
||||
|
||||
@@ -217,9 +262,12 @@ contract P2PIX is
|
||||
l.amount > 1e6 ether
|
||||
) revert AmountNotAllowed();
|
||||
|
||||
_addLock(lockID, l, d);
|
||||
_addLock(bal, _amount, cCounter, l, t, k);
|
||||
|
||||
lockCounter++;
|
||||
|
||||
// Halt execution and output `lockID`.
|
||||
return lockID;
|
||||
return cCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,10 +283,10 @@ contract P2PIX is
|
||||
/// In case of they differing:
|
||||
/// - `lock` caller gets accrued with `l.amount` as userRecord credit;
|
||||
/// - `release` caller gets accrued with `l.relayerPremium` as userRecord credit;
|
||||
/// @param _relayerTarget Target address entitled to the `relayerPremim`.
|
||||
/// @param _relayerTarget Target address entitled to the `relayerPremium`.
|
||||
/// @dev Function sighash: 0x4e1389ed.
|
||||
function release(
|
||||
bytes32 lockID,
|
||||
uint256 lockID,
|
||||
address _relayerTarget,
|
||||
bytes32 pixTimestamp,
|
||||
bytes32 r,
|
||||
@@ -251,10 +299,9 @@ contract P2PIX is
|
||||
if (l.expirationBlock < block.number)
|
||||
revert LockExpired();
|
||||
|
||||
DT.Deposit storage d = mapDeposits[l.depositID];
|
||||
bytes32 message = keccak256(
|
||||
abi.encodePacked(
|
||||
d.pixTarget,
|
||||
l.pixTarget,
|
||||
l.amount,
|
||||
pixTimestamp
|
||||
)
|
||||
@@ -276,7 +323,7 @@ contract P2PIX is
|
||||
if (!validBacenSigners[signer])
|
||||
revert InvalidSigner();
|
||||
|
||||
ERC20 t = ERC20(d.token);
|
||||
ERC20 t = ERC20(l.token);
|
||||
|
||||
// We cache values before zeroing them out.
|
||||
uint256 lockAmount = l.amount;
|
||||
@@ -334,7 +381,7 @@ contract P2PIX is
|
||||
/// @dev For each successfull unexpired lock recovered,
|
||||
/// `userRecord[_castAddrToKey(l.relayerAddress)]` is decreased by half of its value.
|
||||
/// @dev Function sighash: 0x8e2749d6.
|
||||
function unlockExpired(bytes32[] calldata lockIDs)
|
||||
function unlockExpired(uint256[] calldata lockIDs)
|
||||
public
|
||||
{
|
||||
uint256 i;
|
||||
@@ -345,7 +392,16 @@ contract P2PIX is
|
||||
|
||||
_notExpired(l);
|
||||
|
||||
mapDeposits[l.depositID].remaining += l.amount;
|
||||
uint256 _sellerBalance = sellerBalance[
|
||||
l.sellerKey
|
||||
][ERC20(l.token)] & BITMASK_SB_ENTRY;
|
||||
|
||||
if ((_sellerBalance + l.amount) > 1e8 ether)
|
||||
revert MaxBalExceeded();
|
||||
|
||||
sellerBalance[l.sellerKey][ERC20(l.token)] += l
|
||||
.amount;
|
||||
|
||||
l.amount = 0;
|
||||
|
||||
uint256 userKey = _castAddrToKey(
|
||||
@@ -380,28 +436,36 @@ contract P2PIX is
|
||||
/// tokens from expired deposits.
|
||||
/// @dev Function sighash: 0x36317972.
|
||||
function withdraw(
|
||||
uint256 depositID,
|
||||
bytes32[] calldata expiredLocks
|
||||
ERC20 token,
|
||||
uint256 amount,
|
||||
uint256[] calldata expiredLocks
|
||||
) public nonReentrant {
|
||||
_onlySeller(depositID);
|
||||
unlockExpired(expiredLocks);
|
||||
|
||||
DT.Deposit storage d = mapDeposits[depositID];
|
||||
|
||||
if (d.valid == true) {
|
||||
cancelDeposit(depositID);
|
||||
if (getValid(msg.sender, token) == true) {
|
||||
setValidState(token, false);
|
||||
}
|
||||
|
||||
ERC20 token = ERC20(d.token);
|
||||
|
||||
// Withdraw remaining tokens from mapDeposit[depositID]
|
||||
uint256 amount = d.remaining;
|
||||
d.remaining = 0;
|
||||
uint256 key = _castAddrToKey(msg.sender);
|
||||
_decBal(
|
||||
(sellerBalance[key][token] & BITMASK_SB_ENTRY),
|
||||
amount,
|
||||
token,
|
||||
key
|
||||
);
|
||||
|
||||
// safeTransfer tokens to seller
|
||||
SafeTransferLib.safeTransfer(token, d.seller, amount);
|
||||
SafeTransferLib.safeTransfer(
|
||||
token,
|
||||
msg.sender,
|
||||
amount
|
||||
);
|
||||
|
||||
emit DepositWithdrawn(msg.sender, depositID, amount);
|
||||
emit DepositWithdrawn(
|
||||
msg.sender,
|
||||
address(token),
|
||||
amount
|
||||
);
|
||||
}
|
||||
|
||||
function setRoot(address addr, bytes32 merkleroot)
|
||||
@@ -484,7 +548,7 @@ contract P2PIX is
|
||||
let tLoc := add(_tokens, 0x20)
|
||||
let sLoc := add(_states, 0x20)
|
||||
for {
|
||||
let end := add(tLoc, mul(tLen, 0x20))
|
||||
let end := add(tLoc, shl(5, tLen))
|
||||
} iszero(eq(tLoc, end)) {
|
||||
tLoc := add(tLoc, 0x20)
|
||||
sLoc := add(sLoc, 0x20)
|
||||
@@ -511,14 +575,6 @@ contract P2PIX is
|
||||
// solhint-disable-next-line no-empty-blocks
|
||||
receive() external payable {}
|
||||
|
||||
/// @notice Access control private view method that
|
||||
/// performs auth check on an deposit's seller.
|
||||
/// @dev Function sighash: 0x4125a4d9.
|
||||
function _onlySeller(uint256 _depositID) private view {
|
||||
if (mapDeposits[_depositID].seller != msg.sender)
|
||||
revert OnlySeller();
|
||||
}
|
||||
|
||||
/// @notice Private view auxiliar logic that reverts
|
||||
/// on a not expired lock passed as argument of the function.
|
||||
/// @dev Called exclusively by the `unlockExpired` method.
|
||||
@@ -529,55 +585,26 @@ contract P2PIX is
|
||||
if (_l.amount == 0) revert AlreadyReleased();
|
||||
}
|
||||
|
||||
/// @notice Internal view auxiliar logic that returns a new valid `_depositID`.
|
||||
/// @dev It reverts on an already valid counter (`uint256`) value.
|
||||
/// @dev Function sighash: 0xdb51d697.
|
||||
function _encodeDepositID()
|
||||
internal
|
||||
view
|
||||
returns (uint256 _depositID)
|
||||
{
|
||||
(_depositID) = depositCount.current();
|
||||
}
|
||||
|
||||
function _addLock(
|
||||
bytes32 _lockID,
|
||||
uint256 _bal,
|
||||
uint256 _amount,
|
||||
uint256 _lockID,
|
||||
DT.Lock memory _l,
|
||||
DT.Deposit storage _d
|
||||
ERC20 _t,
|
||||
uint256 _k
|
||||
) internal {
|
||||
mapLocks[_lockID] = _l;
|
||||
_d.remaining -= _l.amount;
|
||||
|
||||
_decBal(_bal, _amount, _t, _k);
|
||||
|
||||
emit LockAdded(
|
||||
_l.buyerAddress,
|
||||
_lockID,
|
||||
_l.depositID,
|
||||
_l.sellerKey,
|
||||
_l.amount
|
||||
);
|
||||
}
|
||||
|
||||
/// @notice Private view auxiliar logic that encodes/returns
|
||||
/// the `bytes32` identifier of an lock.
|
||||
/// @dev reverts on a not expired lock with the same ID passed
|
||||
/// as argument of the function.
|
||||
/// @dev Called exclusively by the `lock` method.
|
||||
/// @dev Function sighash: 0x3fc5fb52.
|
||||
function _encodeLockID(
|
||||
uint256 _depositID,
|
||||
uint256 _amount,
|
||||
address _buyerAddress
|
||||
) private view returns (bytes32 _lockID) {
|
||||
_lockID = keccak256(
|
||||
abi.encodePacked(
|
||||
_depositID,
|
||||
_amount,
|
||||
_buyerAddress
|
||||
)
|
||||
);
|
||||
if (mapLocks[_lockID].expirationBlock >= block.number)
|
||||
revert NotExpired();
|
||||
}
|
||||
|
||||
function merkleVerify(
|
||||
bytes32[] calldata _merkleProof,
|
||||
bytes32 root,
|
||||
@@ -633,6 +660,207 @@ contract P2PIX is
|
||||
}
|
||||
}
|
||||
|
||||
function _castToUint(
|
||||
uint96 _amount,
|
||||
uint160 _pixTarget,
|
||||
bool _valid
|
||||
)
|
||||
private
|
||||
pure
|
||||
returns (
|
||||
uint256 _amountCasted,
|
||||
uint256 _pixTargetCasted,
|
||||
uint256 _validCasted
|
||||
)
|
||||
{
|
||||
assembly {
|
||||
_amountCasted := _amount
|
||||
_pixTargetCasted := _pixTarget
|
||||
_validCasted := _valid
|
||||
}
|
||||
}
|
||||
|
||||
function _decBal(
|
||||
uint256 _bal,
|
||||
uint256 _amount,
|
||||
ERC20 _t,
|
||||
uint256 _k
|
||||
) private {
|
||||
assembly {
|
||||
if iszero(
|
||||
iszero(
|
||||
or(
|
||||
iszero(_bal),
|
||||
lt(sub(_bal, _amount), 0x0)
|
||||
)
|
||||
)
|
||||
) {
|
||||
// DecOverflow()
|
||||
mstore(0x00, 0xce3a3d37)
|
||||
revert(0x1c, 0x04)
|
||||
}
|
||||
}
|
||||
|
||||
// we can directly dec from packed uint entry value
|
||||
sellerBalance[_k][_t] -= _amount;
|
||||
}
|
||||
|
||||
function getBalance(address seller, ERC20 token)
|
||||
public
|
||||
view
|
||||
returns (uint256 bal)
|
||||
{
|
||||
// bal =
|
||||
// sellerBalance[_castAddrToKey(seller)][token] &
|
||||
// BITMASK_SB_ENTRY;
|
||||
assembly {
|
||||
for {
|
||||
/* */
|
||||
} iszero(0x0) {
|
||||
/* */
|
||||
} {
|
||||
mstore(0x00, shl(0xC, seller))
|
||||
mstore(0x20, sellerBalance.slot)
|
||||
let sbkslot := keccak256(0x00, 0x40)
|
||||
mstore(0x00, token)
|
||||
mstore(0x20, sbkslot)
|
||||
bal := and(
|
||||
BITMASK_SB_ENTRY,
|
||||
sload(keccak256(0x00, 0x40))
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getValid(address seller, ERC20 token)
|
||||
public
|
||||
view
|
||||
returns (bool valid)
|
||||
{
|
||||
// uint256 b = sellerBalance[
|
||||
// _castAddrToKey(seller)
|
||||
// ][token];
|
||||
// ] >> BITPOS_VALID) & BITMASK_SB_ENTRY;
|
||||
assembly {
|
||||
for {
|
||||
/* */
|
||||
} iszero(0x0) {
|
||||
/* */
|
||||
} {
|
||||
mstore(0x00, shl(0xC, seller))
|
||||
mstore(0x20, sellerBalance.slot)
|
||||
let sbkslot := keccak256(0x00, 0x40)
|
||||
mstore(0x00, token)
|
||||
mstore(0x20, sbkslot)
|
||||
valid := and(
|
||||
BITMASK_SB_ENTRY,
|
||||
shr(
|
||||
BITPOS_VALID,
|
||||
sload(keccak256(0x00, 0x40))
|
||||
)
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getPixTarget(address seller, ERC20 token)
|
||||
public
|
||||
view
|
||||
returns (uint160 pixTarget)
|
||||
{
|
||||
// pixTarget = uint160(
|
||||
// sellerBalance[_castAddrToKey(seller)][token] >>
|
||||
// BITPOS_PIXTARGET
|
||||
// );
|
||||
assembly {
|
||||
for {
|
||||
/* */
|
||||
} iszero(0) {
|
||||
/* */
|
||||
} {
|
||||
mstore(0, shl(12, seller))
|
||||
mstore(32, sellerBalance.slot)
|
||||
let sbkslot := keccak256(0, 64)
|
||||
mstore(0, token)
|
||||
mstore(32, sbkslot)
|
||||
pixTarget := shr(
|
||||
BITPOS_PIXTARGET,
|
||||
sload(keccak256(0, 64))
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getBalances(
|
||||
address[] memory sellers,
|
||||
ERC20 token
|
||||
) external view returns (uint256[] memory) {
|
||||
uint256 j;
|
||||
uint256 len = sellers.length;
|
||||
uint256[] memory balances = new uint256[](len);
|
||||
while (j < len) {
|
||||
uint256 bal = getBalance(sellers[j], token);
|
||||
balances[j] = bal;
|
||||
unchecked {
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
return balances;
|
||||
}
|
||||
|
||||
/// @notice External getter that returns the status of a lockIDs array.
|
||||
/// @dev Call will not revert if provided with an empty array as parameter.
|
||||
/// @dev Function sighash: 0x49ef8448
|
||||
function getLocksStatus(uint256[] memory ids)
|
||||
external
|
||||
view
|
||||
returns (uint256[] memory, DT.LockStatus[] memory)
|
||||
{
|
||||
if (ids.length == 0) {
|
||||
uint256[] memory null1 = new uint256[](0);
|
||||
DT.LockStatus[]
|
||||
memory null2 = new DT.LockStatus[](0);
|
||||
return (null1, null2);
|
||||
}
|
||||
|
||||
uint256 c;
|
||||
uint256 len = ids.length;
|
||||
|
||||
uint256[] memory sortedIDs = new uint256[](len);
|
||||
DT.LockStatus[] memory status = new DT.LockStatus[](
|
||||
len
|
||||
);
|
||||
unchecked {
|
||||
for (c; c < len; ) {
|
||||
if (mapLocks[ids[c]].sellerKey == 0x0) {
|
||||
sortedIDs[c] = ids[c];
|
||||
status[c] = type(DT.LockStatus).min;
|
||||
++c;
|
||||
} else if (mapLocks[ids[c]].amount == 0x0) {
|
||||
sortedIDs[c] = ids[c];
|
||||
status[c] = type(DT.LockStatus).max;
|
||||
++c;
|
||||
} else if (
|
||||
mapLocks[ids[c]].expirationBlock <
|
||||
block.number
|
||||
) {
|
||||
sortedIDs[c] = ids[c];
|
||||
status[c] = DT.LockStatus.Expired;
|
||||
++c;
|
||||
} else {
|
||||
sortedIDs[c] = ids[c];
|
||||
status[c] = DT.LockStatus.Active;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (sortedIDs, status);
|
||||
}
|
||||
|
||||
/// @notice Public method that handles `address`
|
||||
/// to `uint256` safe type casting.
|
||||
/// @dev Function sighash: 0x4b2ae980.
|
||||
@@ -641,6 +869,20 @@ contract P2PIX is
|
||||
pure
|
||||
returns (uint256 _key)
|
||||
{
|
||||
_key = uint256(uint160(address(_addr))) << 12;
|
||||
// _key = uint256(uint160(address(_addr))) << 12;
|
||||
assembly {
|
||||
_key := shl(12, _addr)
|
||||
}
|
||||
}
|
||||
|
||||
function _castKeyToAddr(uint256 _key)
|
||||
public
|
||||
pure
|
||||
returns (address _addr)
|
||||
{
|
||||
// _addr = address(uint160(uint256(_key >> 12)));
|
||||
assembly {
|
||||
_addr := shr(12, _key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
||||
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||
],
|
||||
"p2pix": "0x5f3EFA9A90532914545CEf527C530658af87e196",
|
||||
"token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
|
||||
"p2pix": "0x2414817FF64A114d91eCFA16a834d3fCf69103d4",
|
||||
"token": "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00"
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
||||
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||
],
|
||||
"p2pix": "0x37c856F4d5bC2597da60f607b1335738468453F3",
|
||||
"token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
|
||||
"p2pix": "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29",
|
||||
"token": "0xD38D6367f452D097ccBfDe4490b7de570B6A72Db"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
||||
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||
],
|
||||
"p2pix": "0x5f3EFA9A90532914545CEf527C530658af87e196",
|
||||
"token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
|
||||
"p2pix": "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00",
|
||||
"token": "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29"
|
||||
}
|
||||
1021
docs/callgraph.svg
1021
docs/callgraph.svg
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 66 KiB |
@@ -34,7 +34,7 @@ const chainIds = {
|
||||
hardhat: 31337,
|
||||
mainnet: 1,
|
||||
sepolia: 11155111,
|
||||
goerli : 5,
|
||||
goerli: 5,
|
||||
"polygon-mumbai": 80001,
|
||||
};
|
||||
|
||||
@@ -44,8 +44,10 @@ function getChainConfig(
|
||||
let jsonRpcUrl: string;
|
||||
switch (chain) {
|
||||
case "polygon-mumbai":
|
||||
jsonRpcUrl = "https://polygon-mumbai.g.alchemy.com/v2/" + alchemyApiKey;
|
||||
break;
|
||||
jsonRpcUrl =
|
||||
"https://polygon-mumbai.g.alchemy.com/v2/" +
|
||||
alchemyApiKey;
|
||||
break;
|
||||
default:
|
||||
jsonRpcUrl =
|
||||
"https://" + chain + ".infura.io/v3/" + infuraApiKey;
|
||||
@@ -121,12 +123,14 @@ const config: HardhatUserConfig = {
|
||||
solidity: {
|
||||
version: "0.8.9",
|
||||
settings: {
|
||||
// viaIR: true,
|
||||
metadata: {
|
||||
bytecodeHash: "none",
|
||||
},
|
||||
optimizer: {
|
||||
enabled: true,
|
||||
runs: 2000,
|
||||
// max val = 4_294_967_295
|
||||
runs: 20_000,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "p2pix-smart-contracts",
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Repository for P2Pix EVM contracts to be imported by the project.",
|
||||
"homepage": "https://github.com/doiim/p2pix-smart-contracts#readme",
|
||||
"author": "Filipe Soccol (doiim)",
|
||||
@@ -64,7 +64,7 @@
|
||||
"fs-extra": "^10.1.0",
|
||||
"hardhat": "^2.12.2",
|
||||
"hardhat-gas-reporter": "^1.0.9",
|
||||
"hardhat-tracer": "^1.2.0",
|
||||
"hardhat-tracer": "beta",
|
||||
"husky": "^8.0.1",
|
||||
"keccak256": "^1.0.6",
|
||||
"lint-staged": "^13.0.3",
|
||||
|
||||
@@ -3,11 +3,10 @@ import "@nomiclabs/hardhat-etherscan";
|
||||
import { BigNumber } from "ethers";
|
||||
import * as fs from "fs";
|
||||
import { ethers, network } from "hardhat";
|
||||
import hre from "hardhat";
|
||||
|
||||
import { Deploys } from "../test/utils/fixtures";
|
||||
|
||||
import hre from "hardhat";
|
||||
|
||||
let deploysJson: Deploys;
|
||||
const supply: BigNumber = ethers.utils.parseEther("20000000");
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@ import "@nomiclabs/hardhat-ethers";
|
||||
import "@nomiclabs/hardhat-etherscan";
|
||||
import * as fs from "fs";
|
||||
import { ethers, network } from "hardhat";
|
||||
import hre from "hardhat";
|
||||
|
||||
import { Deploys } from "../test/utils/fixtures";
|
||||
|
||||
import hre from "hardhat";
|
||||
|
||||
let deploysJson: Deploys;
|
||||
|
||||
const main = async () => {
|
||||
@@ -27,8 +26,13 @@ const main = async () => {
|
||||
const Reputation = await ethers.getContractFactory(
|
||||
"Reputation",
|
||||
);
|
||||
const Multicall = await ethers.getContractFactory(
|
||||
"Multicall",
|
||||
);
|
||||
const reputation = await Reputation.deploy();
|
||||
await reputation.deployed();
|
||||
const mutlicall = await Multicall.deploy();
|
||||
await mutlicall.deployed();
|
||||
|
||||
const P2PIX = await ethers.getContractFactory("P2PIX");
|
||||
const p2pix = await P2PIX.deploy(
|
||||
@@ -42,6 +46,8 @@ const main = async () => {
|
||||
|
||||
deploysJson.p2pix = p2pix.address;
|
||||
console.log("🚀 P2PIX Deployed:", p2pix.address);
|
||||
console.log("🌠 Reputation Deployed:", reputation.address);
|
||||
console.log("🛰 Multicall Deployed:", mutlicall.address);
|
||||
await p2pix.deployTransaction.wait(6);
|
||||
|
||||
fs.writeFileSync(
|
||||
@@ -53,15 +59,22 @@ const main = async () => {
|
||||
//verify
|
||||
await hre.run("verify:verify", {
|
||||
address: p2pix.address,
|
||||
constructorArguments:
|
||||
[
|
||||
10,
|
||||
deploysJson.signers,
|
||||
constructorArguments: [
|
||||
10,
|
||||
deploysJson.signers,
|
||||
reputation.address,
|
||||
[deploysJson.token],
|
||||
[true],
|
||||
],
|
||||
});
|
||||
await hre.run("verify:verify", {
|
||||
address: reputation.address,
|
||||
constructorArguments: [],
|
||||
});
|
||||
await hre.run("verify:verify", {
|
||||
address: mutlicall.address,
|
||||
constructorArguments: [],
|
||||
});
|
||||
};
|
||||
|
||||
main()
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { BaseContract, BigNumber, BytesLike, Signer, utils } from "ethers";
|
||||
import type {
|
||||
BaseContract,
|
||||
BigNumber,
|
||||
BigNumberish,
|
||||
Signer,
|
||||
utils,
|
||||
} from "ethers";
|
||||
import type { EventFragment } from "@ethersproject/abi";
|
||||
import type { Listener, Provider } from "@ethersproject/providers";
|
||||
import type {
|
||||
@@ -17,22 +23,21 @@ export interface EventAndErrorsInterface extends utils.Interface {
|
||||
|
||||
events: {
|
||||
"AllowedERC20Updated(address,bool)": EventFragment;
|
||||
"DepositAdded(address,uint256,address,uint256)": EventFragment;
|
||||
"DepositClosed(address,uint256)": EventFragment;
|
||||
"DepositWithdrawn(address,uint256,uint256)": EventFragment;
|
||||
"DepositAdded(address,address,uint256)": EventFragment;
|
||||
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
||||
"FundsWithdrawn(address,uint256)": EventFragment;
|
||||
"LockAdded(address,bytes32,uint256,uint256)": EventFragment;
|
||||
"LockAdded(address,uint256,uint256,uint256)": EventFragment;
|
||||
"LockBlocksUpdated(uint256)": EventFragment;
|
||||
"LockReleased(address,bytes32,uint256)": EventFragment;
|
||||
"LockReturned(address,bytes32)": EventFragment;
|
||||
"LockReleased(address,uint256,uint256)": EventFragment;
|
||||
"LockReturned(address,uint256)": EventFragment;
|
||||
"ReputationUpdated(address)": EventFragment;
|
||||
"RootUpdated(address,bytes32)": EventFragment;
|
||||
"ValidSet(address,address,bool)": EventFragment;
|
||||
"ValidSignersUpdated(address[])": EventFragment;
|
||||
};
|
||||
|
||||
getEvent(nameOrSignatureOrTopic: "AllowedERC20Updated"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "DepositAdded"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "DepositClosed"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "DepositWithdrawn"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "FundsWithdrawn"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "LockAdded"): EventFragment;
|
||||
@@ -41,6 +46,7 @@ export interface EventAndErrorsInterface extends utils.Interface {
|
||||
getEvent(nameOrSignatureOrTopic: "LockReturned"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "ReputationUpdated"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "RootUpdated"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "ValidSet"): EventFragment;
|
||||
getEvent(nameOrSignatureOrTopic: "ValidSignersUpdated"): EventFragment;
|
||||
}
|
||||
|
||||
@@ -58,35 +64,23 @@ export type AllowedERC20UpdatedEventFilter =
|
||||
|
||||
export interface DepositAddedEventObject {
|
||||
seller: string;
|
||||
depositID: BigNumber;
|
||||
token: string;
|
||||
amount: BigNumber;
|
||||
}
|
||||
export type DepositAddedEvent = TypedEvent<
|
||||
[string, BigNumber, string, BigNumber],
|
||||
[string, string, BigNumber],
|
||||
DepositAddedEventObject
|
||||
>;
|
||||
|
||||
export type DepositAddedEventFilter = TypedEventFilter<DepositAddedEvent>;
|
||||
|
||||
export interface DepositClosedEventObject {
|
||||
seller: string;
|
||||
depositID: BigNumber;
|
||||
}
|
||||
export type DepositClosedEvent = TypedEvent<
|
||||
[string, BigNumber],
|
||||
DepositClosedEventObject
|
||||
>;
|
||||
|
||||
export type DepositClosedEventFilter = TypedEventFilter<DepositClosedEvent>;
|
||||
|
||||
export interface DepositWithdrawnEventObject {
|
||||
seller: string;
|
||||
depositID: BigNumber;
|
||||
token: string;
|
||||
amount: BigNumber;
|
||||
}
|
||||
export type DepositWithdrawnEvent = TypedEvent<
|
||||
[string, BigNumber, BigNumber],
|
||||
[string, string, BigNumber],
|
||||
DepositWithdrawnEventObject
|
||||
>;
|
||||
|
||||
@@ -106,12 +100,12 @@ export type FundsWithdrawnEventFilter = TypedEventFilter<FundsWithdrawnEvent>;
|
||||
|
||||
export interface LockAddedEventObject {
|
||||
buyer: string;
|
||||
lockID: string;
|
||||
depositID: BigNumber;
|
||||
lockID: BigNumber;
|
||||
seller: BigNumber;
|
||||
amount: BigNumber;
|
||||
}
|
||||
export type LockAddedEvent = TypedEvent<
|
||||
[string, string, BigNumber, BigNumber],
|
||||
[string, BigNumber, BigNumber, BigNumber],
|
||||
LockAddedEventObject
|
||||
>;
|
||||
|
||||
@@ -130,11 +124,11 @@ export type LockBlocksUpdatedEventFilter =
|
||||
|
||||
export interface LockReleasedEventObject {
|
||||
buyer: string;
|
||||
lockId: string;
|
||||
lockId: BigNumber;
|
||||
amount: BigNumber;
|
||||
}
|
||||
export type LockReleasedEvent = TypedEvent<
|
||||
[string, string, BigNumber],
|
||||
[string, BigNumber, BigNumber],
|
||||
LockReleasedEventObject
|
||||
>;
|
||||
|
||||
@@ -142,10 +136,10 @@ export type LockReleasedEventFilter = TypedEventFilter<LockReleasedEvent>;
|
||||
|
||||
export interface LockReturnedEventObject {
|
||||
buyer: string;
|
||||
lockId: string;
|
||||
lockId: BigNumber;
|
||||
}
|
||||
export type LockReturnedEvent = TypedEvent<
|
||||
[string, string],
|
||||
[string, BigNumber],
|
||||
LockReturnedEventObject
|
||||
>;
|
||||
|
||||
@@ -173,6 +167,18 @@ export type RootUpdatedEvent = TypedEvent<
|
||||
|
||||
export type RootUpdatedEventFilter = TypedEventFilter<RootUpdatedEvent>;
|
||||
|
||||
export interface ValidSetEventObject {
|
||||
seller: string;
|
||||
token: string;
|
||||
state: boolean;
|
||||
}
|
||||
export type ValidSetEvent = TypedEvent<
|
||||
[string, string, boolean],
|
||||
ValidSetEventObject
|
||||
>;
|
||||
|
||||
export type ValidSetEventFilter = TypedEventFilter<ValidSetEvent>;
|
||||
|
||||
export interface ValidSignersUpdatedEventObject {
|
||||
signers: string[];
|
||||
}
|
||||
@@ -224,36 +230,25 @@ export interface EventAndErrors extends BaseContract {
|
||||
state?: PromiseOrValue<boolean> | null
|
||||
): AllowedERC20UpdatedEventFilter;
|
||||
|
||||
"DepositAdded(address,uint256,address,uint256)"(
|
||||
"DepositAdded(address,address,uint256)"(
|
||||
seller?: PromiseOrValue<string> | null,
|
||||
depositID?: null,
|
||||
token?: null,
|
||||
amount?: null
|
||||
): DepositAddedEventFilter;
|
||||
DepositAdded(
|
||||
seller?: PromiseOrValue<string> | null,
|
||||
depositID?: null,
|
||||
token?: null,
|
||||
amount?: null
|
||||
): DepositAddedEventFilter;
|
||||
|
||||
"DepositClosed(address,uint256)"(
|
||||
"DepositWithdrawn(address,address,uint256)"(
|
||||
seller?: PromiseOrValue<string> | null,
|
||||
depositID?: null
|
||||
): DepositClosedEventFilter;
|
||||
DepositClosed(
|
||||
seller?: PromiseOrValue<string> | null,
|
||||
depositID?: null
|
||||
): DepositClosedEventFilter;
|
||||
|
||||
"DepositWithdrawn(address,uint256,uint256)"(
|
||||
seller?: PromiseOrValue<string> | null,
|
||||
depositID?: null,
|
||||
token?: null,
|
||||
amount?: null
|
||||
): DepositWithdrawnEventFilter;
|
||||
DepositWithdrawn(
|
||||
seller?: PromiseOrValue<string> | null,
|
||||
depositID?: null,
|
||||
token?: null,
|
||||
amount?: null
|
||||
): DepositWithdrawnEventFilter;
|
||||
|
||||
@@ -263,23 +258,23 @@ export interface EventAndErrors extends BaseContract {
|
||||
): FundsWithdrawnEventFilter;
|
||||
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
||||
|
||||
"LockAdded(address,bytes32,uint256,uint256)"(
|
||||
"LockAdded(address,uint256,uint256,uint256)"(
|
||||
buyer?: PromiseOrValue<string> | null,
|
||||
lockID?: PromiseOrValue<BytesLike> | null,
|
||||
depositID?: null,
|
||||
lockID?: PromiseOrValue<BigNumberish> | null,
|
||||
seller?: null,
|
||||
amount?: null
|
||||
): LockAddedEventFilter;
|
||||
LockAdded(
|
||||
buyer?: PromiseOrValue<string> | null,
|
||||
lockID?: PromiseOrValue<BytesLike> | null,
|
||||
depositID?: null,
|
||||
lockID?: PromiseOrValue<BigNumberish> | null,
|
||||
seller?: null,
|
||||
amount?: null
|
||||
): LockAddedEventFilter;
|
||||
|
||||
"LockBlocksUpdated(uint256)"(blocks?: null): LockBlocksUpdatedEventFilter;
|
||||
LockBlocksUpdated(blocks?: null): LockBlocksUpdatedEventFilter;
|
||||
|
||||
"LockReleased(address,bytes32,uint256)"(
|
||||
"LockReleased(address,uint256,uint256)"(
|
||||
buyer?: PromiseOrValue<string> | null,
|
||||
lockId?: null,
|
||||
amount?: null
|
||||
@@ -290,7 +285,7 @@ export interface EventAndErrors extends BaseContract {
|
||||
amount?: null
|
||||
): LockReleasedEventFilter;
|
||||
|
||||
"LockReturned(address,bytes32)"(
|
||||
"LockReturned(address,uint256)"(
|
||||
buyer?: PromiseOrValue<string> | null,
|
||||
lockId?: null
|
||||
): LockReturnedEventFilter;
|
||||
@@ -310,6 +305,17 @@ export interface EventAndErrors extends BaseContract {
|
||||
): RootUpdatedEventFilter;
|
||||
RootUpdated(seller?: null, merkleRoot?: null): RootUpdatedEventFilter;
|
||||
|
||||
"ValidSet(address,address,bool)"(
|
||||
seller?: PromiseOrValue<string> | null,
|
||||
token?: null,
|
||||
state?: null
|
||||
): ValidSetEventFilter;
|
||||
ValidSet(
|
||||
seller?: PromiseOrValue<string> | null,
|
||||
token?: null,
|
||||
state?: null
|
||||
): ValidSetEventFilter;
|
||||
|
||||
"ValidSignersUpdated(address[])"(
|
||||
signers?: null
|
||||
): ValidSignersUpdatedEventFilter;
|
||||
|
||||
@@ -25,11 +25,21 @@ const _abi = [
|
||||
name: "AmountNotAllowed",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: "DecOverflow",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: "DepositAlreadyExists",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: "EmptyPixTarget",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: "InvalidDeposit",
|
||||
@@ -55,6 +65,11 @@ const _abi = [
|
||||
name: "LoopOverflow",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: "MaxBalExceeded",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: "NoTokens",
|
||||
@@ -70,6 +85,11 @@ const _abi = [
|
||||
name: "NotExpired",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: "NotInitialized",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: "OnlySeller",
|
||||
@@ -118,12 +138,6 @@ const _abi = [
|
||||
name: "seller",
|
||||
type: "address",
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "uint256",
|
||||
name: "depositID",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "address",
|
||||
@@ -151,29 +165,10 @@ const _abi = [
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "uint256",
|
||||
name: "depositID",
|
||||
type: "uint256",
|
||||
},
|
||||
],
|
||||
name: "DepositClosed",
|
||||
type: "event",
|
||||
},
|
||||
{
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
{
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
name: "seller",
|
||||
name: "token",
|
||||
type: "address",
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "uint256",
|
||||
name: "depositID",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "uint256",
|
||||
@@ -214,14 +209,14 @@ const _abi = [
|
||||
},
|
||||
{
|
||||
indexed: true,
|
||||
internalType: "bytes32",
|
||||
internalType: "uint256",
|
||||
name: "lockID",
|
||||
type: "bytes32",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "uint256",
|
||||
name: "depositID",
|
||||
name: "seller",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
@@ -258,9 +253,9 @@ const _abi = [
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "bytes32",
|
||||
internalType: "uint256",
|
||||
name: "lockId",
|
||||
type: "bytes32",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
@@ -283,9 +278,9 @@ const _abi = [
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "bytes32",
|
||||
internalType: "uint256",
|
||||
name: "lockId",
|
||||
type: "bytes32",
|
||||
type: "uint256",
|
||||
},
|
||||
],
|
||||
name: "LockReturned",
|
||||
@@ -323,6 +318,31 @@ const _abi = [
|
||||
name: "RootUpdated",
|
||||
type: "event",
|
||||
},
|
||||
{
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
{
|
||||
indexed: true,
|
||||
internalType: "address",
|
||||
name: "seller",
|
||||
type: "address",
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "address",
|
||||
name: "token",
|
||||
type: "address",
|
||||
},
|
||||
{
|
||||
indexed: false,
|
||||
internalType: "bool",
|
||||
name: "state",
|
||||
type: "bool",
|
||||
},
|
||||
],
|
||||
name: "ValidSet",
|
||||
type: "event",
|
||||
},
|
||||
{
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,65 +0,0 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers";
|
||||
import type { Provider, TransactionRequest } from "@ethersproject/providers";
|
||||
import type { PromiseOrValue } from "../../../common";
|
||||
import type { Counters, CountersInterface } from "../../../lib/utils/Counters";
|
||||
|
||||
const _abi = [
|
||||
{
|
||||
inputs: [],
|
||||
name: "DecOverflow",
|
||||
type: "error",
|
||||
},
|
||||
];
|
||||
|
||||
const _bytecode =
|
||||
"0x602d6037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c6343000809000a";
|
||||
|
||||
type CountersConstructorParams =
|
||||
| [signer?: Signer]
|
||||
| ConstructorParameters<typeof ContractFactory>;
|
||||
|
||||
const isSuperArgs = (
|
||||
xs: CountersConstructorParams
|
||||
): xs is ConstructorParameters<typeof ContractFactory> => xs.length > 1;
|
||||
|
||||
export class Counters__factory extends ContractFactory {
|
||||
constructor(...args: CountersConstructorParams) {
|
||||
if (isSuperArgs(args)) {
|
||||
super(...args);
|
||||
} else {
|
||||
super(_abi, _bytecode, args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
override deploy(
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<Counters> {
|
||||
return super.deploy(overrides || {}) as Promise<Counters>;
|
||||
}
|
||||
override getDeployTransaction(
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): TransactionRequest {
|
||||
return super.getDeployTransaction(overrides || {});
|
||||
}
|
||||
override attach(address: string): Counters {
|
||||
return super.attach(address) as Counters;
|
||||
}
|
||||
override connect(signer: Signer): Counters__factory {
|
||||
return super.connect(signer) as Counters__factory;
|
||||
}
|
||||
|
||||
static readonly bytecode = _bytecode;
|
||||
static readonly abi = _abi;
|
||||
static createInterface(): CountersInterface {
|
||||
return new utils.Interface(_abi) as CountersInterface;
|
||||
}
|
||||
static connect(
|
||||
address: string,
|
||||
signerOrProvider: Signer | Provider
|
||||
): Counters {
|
||||
return new Contract(address, _abi, signerOrProvider) as Counters;
|
||||
}
|
||||
}
|
||||
174
src/types/factories/lib/utils/Multicall__factory.ts
Normal file
174
src/types/factories/lib/utils/Multicall__factory.ts
Normal file
@@ -0,0 +1,174 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import {
|
||||
Signer,
|
||||
utils,
|
||||
Contract,
|
||||
ContractFactory,
|
||||
PayableOverrides,
|
||||
} from "ethers";
|
||||
import type { Provider, TransactionRequest } from "@ethersproject/providers";
|
||||
import type { PromiseOrValue } from "../../../common";
|
||||
import type {
|
||||
Multicall,
|
||||
MulticallInterface,
|
||||
} from "../../../lib/utils/Multicall";
|
||||
|
||||
const _abi = [
|
||||
{
|
||||
inputs: [],
|
||||
stateMutability: "payable",
|
||||
type: "constructor",
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: "string",
|
||||
name: "reason",
|
||||
type: "string",
|
||||
},
|
||||
],
|
||||
name: "CallFailed",
|
||||
type: "error",
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
components: [
|
||||
{
|
||||
internalType: "address",
|
||||
name: "target",
|
||||
type: "address",
|
||||
},
|
||||
{
|
||||
internalType: "bytes",
|
||||
name: "callData",
|
||||
type: "bytes",
|
||||
},
|
||||
],
|
||||
internalType: "struct Multicall.Call[]",
|
||||
name: "calls",
|
||||
type: "tuple[]",
|
||||
},
|
||||
],
|
||||
name: "mtc1",
|
||||
outputs: [
|
||||
{
|
||||
internalType: "uint256",
|
||||
name: "",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
internalType: "bytes[]",
|
||||
name: "",
|
||||
type: "bytes[]",
|
||||
},
|
||||
],
|
||||
stateMutability: "nonpayable",
|
||||
type: "function",
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
components: [
|
||||
{
|
||||
internalType: "address",
|
||||
name: "target",
|
||||
type: "address",
|
||||
},
|
||||
{
|
||||
internalType: "bytes",
|
||||
name: "callData",
|
||||
type: "bytes",
|
||||
},
|
||||
],
|
||||
internalType: "struct Multicall.Call[]",
|
||||
name: "calls",
|
||||
type: "tuple[]",
|
||||
},
|
||||
],
|
||||
name: "mtc2",
|
||||
outputs: [
|
||||
{
|
||||
internalType: "uint256",
|
||||
name: "",
|
||||
type: "uint256",
|
||||
},
|
||||
{
|
||||
internalType: "bytes32",
|
||||
name: "",
|
||||
type: "bytes32",
|
||||
},
|
||||
{
|
||||
components: [
|
||||
{
|
||||
internalType: "bool",
|
||||
name: "success",
|
||||
type: "bool",
|
||||
},
|
||||
{
|
||||
internalType: "bytes",
|
||||
name: "returnData",
|
||||
type: "bytes",
|
||||
},
|
||||
],
|
||||
internalType: "struct Multicall.Result[]",
|
||||
name: "",
|
||||
type: "tuple[]",
|
||||
},
|
||||
],
|
||||
stateMutability: "nonpayable",
|
||||
type: "function",
|
||||
},
|
||||
];
|
||||
|
||||
const _bytecode =
|
||||
"0x60806040526108ec806100136000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80631b57b72f1461003b57806386575ee914610066575b600080fd5b61004e610049366004610438565b610087565b60405161005d93929190610527565b60405180910390f35b610079610074366004610438565b610227565b60405161005d9291906105cb565b600080606043804085848167ffffffffffffffff8111156100aa576100aa610653565b6040519080825280602002602001820160405280156100f057816020015b6040805180820190915260008152606060208201528152602001906001900390816100c85790505b50905060005b82811015610217576000808b8b8481811061011357610113610682565b905060200281019061012591906106b1565b6101339060208101906106ef565b73ffffffffffffffffffffffffffffffffffffffff168c8c8581811061015b5761015b610682565b905060200281019061016d91906106b1565b61017b90602081019061072c565b604051610189929190610791565b6000604051808303816000865af19150503d80600081146101c6576040519150601f19603f3d011682016040523d82523d6000602084013e6101cb565b606091505b509150915060405180604001604052808315158152602001828152508484815181106101f9576101f9610682565b60200260200101819052508261020e906107a1565b925050506100f6565b5092989197509195509350505050565b600060604383838167ffffffffffffffff81111561024757610247610653565b60405190808252806020026020018201604052801561027a57816020015b60608152602001906001900390816102655790505b50905060005b828110156104285760008089898481811061029d5761029d610682565b90506020028101906102af91906106b1565b6102bd9060208101906106ef565b73ffffffffffffffffffffffffffffffffffffffff168a8a858181106102e5576102e5610682565b90506020028101906102f791906106b1565b61030590602081019061072c565b604051610313929190610791565b6000604051808303816000865af19150503d8060008114610350576040519150601f19603f3d011682016040523d82523d6000602084013e610355565b606091505b5091509150816103f7576044815110156103aa576040517fb5e1dc2d00000000000000000000000000000000000000000000000000000000815260206004820152600060248201526044015b60405180910390fd5b600481019050808060200190518101906103c49190610801565b6040517fb5e1dc2d0000000000000000000000000000000000000000000000000000000081526004016103a191906108cc565b8084848151811061040a5761040a610682565b60200260200101819052508261041f906107a1565b92505050610280565b50919350909150505b9250929050565b6000806020838503121561044b57600080fd5b823567ffffffffffffffff8082111561046357600080fd5b818501915085601f83011261047757600080fd5b81358181111561048657600080fd5b8660208260051b850101111561049b57600080fd5b60209290920196919550909350505050565b60005b838110156104c85781810151838201526020016104b0565b838111156104d7576000848401525b50505050565b600081518084526104f58160208601602086016104ad565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60006060820185835260208581850152604060608186015282865180855260808701915060808160051b880101945083880160005b828110156105bb578887037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8001845281518051151588528601518688018690526105a8868901826104dd565b975050928501929085019060010161055c565b50949a9950505050505050505050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610645577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526106338683516104dd565b955092840192908401906001016105f9565b509398975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126106e557600080fd5b9190910192915050565b60006020828403121561070157600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461072557600080fd5b9392505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261076157600080fd5b83018035915067ffffffffffffffff82111561077c57600080fd5b60200191503681900382131561043157600080fd5b8183823760009101908152919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156107fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60006020828403121561081357600080fd5b815167ffffffffffffffff8082111561082b57600080fd5b818401915084601f83011261083f57600080fd5b81518181111561085157610851610653565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561089757610897610653565b816040528281528760208487010111156108b057600080fd5b6108c18360208301602088016104ad565b979650505050505050565b60208152600061072560208301846104dd56fea164736f6c6343000809000a";
|
||||
|
||||
type MulticallConstructorParams =
|
||||
| [signer?: Signer]
|
||||
| ConstructorParameters<typeof ContractFactory>;
|
||||
|
||||
const isSuperArgs = (
|
||||
xs: MulticallConstructorParams
|
||||
): xs is ConstructorParameters<typeof ContractFactory> => xs.length > 1;
|
||||
|
||||
export class Multicall__factory extends ContractFactory {
|
||||
constructor(...args: MulticallConstructorParams) {
|
||||
if (isSuperArgs(args)) {
|
||||
super(...args);
|
||||
} else {
|
||||
super(_abi, _bytecode, args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
override deploy(
|
||||
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<Multicall> {
|
||||
return super.deploy(overrides || {}) as Promise<Multicall>;
|
||||
}
|
||||
override getDeployTransaction(
|
||||
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
|
||||
): TransactionRequest {
|
||||
return super.getDeployTransaction(overrides || {});
|
||||
}
|
||||
override attach(address: string): Multicall {
|
||||
return super.attach(address) as Multicall;
|
||||
}
|
||||
override connect(signer: Signer): Multicall__factory {
|
||||
return super.connect(signer) as Multicall__factory;
|
||||
}
|
||||
|
||||
static readonly bytecode = _bytecode;
|
||||
static readonly abi = _abi;
|
||||
static createInterface(): MulticallInterface {
|
||||
return new utils.Interface(_abi) as MulticallInterface;
|
||||
}
|
||||
static connect(
|
||||
address: string,
|
||||
signerOrProvider: Signer | Provider
|
||||
): Multicall {
|
||||
return new Contract(address, _abi, signerOrProvider) as Multicall;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export { Counters__factory } from "./Counters__factory";
|
||||
export { Multicall__factory } from "./Multicall__factory";
|
||||
export { ReentrancyGuard__factory } from "./ReentrancyGuard__factory";
|
||||
|
||||
File diff suppressed because one or more lines are too long
8
src/types/hardhat.d.ts
vendored
8
src/types/hardhat.d.ts
vendored
@@ -33,9 +33,9 @@ declare module "hardhat/types/runtime" {
|
||||
signerOrOptions?: ethers.Signer | FactoryOptions
|
||||
): Promise<Contracts.ERC20__factory>;
|
||||
getContractFactory(
|
||||
name: "Counters",
|
||||
name: "Multicall",
|
||||
signerOrOptions?: ethers.Signer | FactoryOptions
|
||||
): Promise<Contracts.Counters__factory>;
|
||||
): Promise<Contracts.Multicall__factory>;
|
||||
getContractFactory(
|
||||
name: "ReentrancyGuard",
|
||||
signerOrOptions?: ethers.Signer | FactoryOptions
|
||||
@@ -75,10 +75,10 @@ declare module "hardhat/types/runtime" {
|
||||
signer?: ethers.Signer
|
||||
): Promise<Contracts.ERC20>;
|
||||
getContractAt(
|
||||
name: "Counters",
|
||||
name: "Multicall",
|
||||
address: string,
|
||||
signer?: ethers.Signer
|
||||
): Promise<Contracts.Counters>;
|
||||
): Promise<Contracts.Multicall>;
|
||||
getContractAt(
|
||||
name: "ReentrancyGuard",
|
||||
address: string,
|
||||
|
||||
@@ -17,8 +17,8 @@ export type { MockToken } from "./lib/mock/mockToken.sol/MockToken";
|
||||
export { MockToken__factory } from "./factories/lib/mock/mockToken.sol/MockToken__factory";
|
||||
export type { ERC20 } from "./lib/tokens/ERC20";
|
||||
export { ERC20__factory } from "./factories/lib/tokens/ERC20__factory";
|
||||
export type { Counters } from "./lib/utils/Counters";
|
||||
export { Counters__factory } from "./factories/lib/utils/Counters__factory";
|
||||
export type { Multicall } from "./lib/utils/Multicall";
|
||||
export { Multicall__factory } from "./factories/lib/utils/Multicall__factory";
|
||||
export type { ReentrancyGuard } from "./lib/utils/ReentrancyGuard";
|
||||
export { ReentrancyGuard__factory } from "./factories/lib/utils/ReentrancyGuard__factory";
|
||||
export type { P2PIX } from "./p2pix.sol/P2PIX";
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { BaseContract, Signer, utils } from "ethers";
|
||||
|
||||
import type { Listener, Provider } from "@ethersproject/providers";
|
||||
import type {
|
||||
TypedEventFilter,
|
||||
TypedEvent,
|
||||
TypedListener,
|
||||
OnEvent,
|
||||
PromiseOrValue,
|
||||
} from "../../common";
|
||||
|
||||
export interface CountersInterface extends utils.Interface {
|
||||
functions: {};
|
||||
|
||||
events: {};
|
||||
}
|
||||
|
||||
export interface Counters extends BaseContract {
|
||||
connect(signerOrProvider: Signer | Provider | string): this;
|
||||
attach(addressOrName: string): this;
|
||||
deployed(): Promise<this>;
|
||||
|
||||
interface: CountersInterface;
|
||||
|
||||
queryFilter<TEvent extends TypedEvent>(
|
||||
event: TypedEventFilter<TEvent>,
|
||||
fromBlockOrBlockhash?: string | number | undefined,
|
||||
toBlock?: string | number | undefined
|
||||
): Promise<Array<TEvent>>;
|
||||
|
||||
listeners<TEvent extends TypedEvent>(
|
||||
eventFilter?: TypedEventFilter<TEvent>
|
||||
): Array<TypedListener<TEvent>>;
|
||||
listeners(eventName?: string): Array<Listener>;
|
||||
removeAllListeners<TEvent extends TypedEvent>(
|
||||
eventFilter: TypedEventFilter<TEvent>
|
||||
): this;
|
||||
removeAllListeners(eventName?: string): this;
|
||||
off: OnEvent<this>;
|
||||
on: OnEvent<this>;
|
||||
once: OnEvent<this>;
|
||||
removeListener: OnEvent<this>;
|
||||
|
||||
functions: {};
|
||||
|
||||
callStatic: {};
|
||||
|
||||
filters: {};
|
||||
|
||||
estimateGas: {};
|
||||
|
||||
populateTransaction: {};
|
||||
}
|
||||
155
src/types/lib/utils/Multicall.ts
Normal file
155
src/types/lib/utils/Multicall.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type {
|
||||
BaseContract,
|
||||
BigNumber,
|
||||
BytesLike,
|
||||
CallOverrides,
|
||||
ContractTransaction,
|
||||
Overrides,
|
||||
PopulatedTransaction,
|
||||
Signer,
|
||||
utils,
|
||||
} from "ethers";
|
||||
import type { FunctionFragment, Result } from "@ethersproject/abi";
|
||||
import type { Listener, Provider } from "@ethersproject/providers";
|
||||
import type {
|
||||
TypedEventFilter,
|
||||
TypedEvent,
|
||||
TypedListener,
|
||||
OnEvent,
|
||||
PromiseOrValue,
|
||||
} from "../../common";
|
||||
|
||||
export declare namespace Multicall {
|
||||
export type CallStruct = {
|
||||
target: PromiseOrValue<string>;
|
||||
callData: PromiseOrValue<BytesLike>;
|
||||
};
|
||||
|
||||
export type CallStructOutput = [string, string] & {
|
||||
target: string;
|
||||
callData: string;
|
||||
};
|
||||
|
||||
export type ResultStruct = {
|
||||
success: PromiseOrValue<boolean>;
|
||||
returnData: PromiseOrValue<BytesLike>;
|
||||
};
|
||||
|
||||
export type ResultStructOutput = [boolean, string] & {
|
||||
success: boolean;
|
||||
returnData: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface MulticallInterface extends utils.Interface {
|
||||
functions: {
|
||||
"mtc1((address,bytes)[])": FunctionFragment;
|
||||
"mtc2((address,bytes)[])": FunctionFragment;
|
||||
};
|
||||
|
||||
getFunction(nameOrSignatureOrTopic: "mtc1" | "mtc2"): FunctionFragment;
|
||||
|
||||
encodeFunctionData(
|
||||
functionFragment: "mtc1",
|
||||
values: [Multicall.CallStruct[]]
|
||||
): string;
|
||||
encodeFunctionData(
|
||||
functionFragment: "mtc2",
|
||||
values: [Multicall.CallStruct[]]
|
||||
): string;
|
||||
|
||||
decodeFunctionResult(functionFragment: "mtc1", data: BytesLike): Result;
|
||||
decodeFunctionResult(functionFragment: "mtc2", data: BytesLike): Result;
|
||||
|
||||
events: {};
|
||||
}
|
||||
|
||||
export interface Multicall extends BaseContract {
|
||||
connect(signerOrProvider: Signer | Provider | string): this;
|
||||
attach(addressOrName: string): this;
|
||||
deployed(): Promise<this>;
|
||||
|
||||
interface: MulticallInterface;
|
||||
|
||||
queryFilter<TEvent extends TypedEvent>(
|
||||
event: TypedEventFilter<TEvent>,
|
||||
fromBlockOrBlockhash?: string | number | undefined,
|
||||
toBlock?: string | number | undefined
|
||||
): Promise<Array<TEvent>>;
|
||||
|
||||
listeners<TEvent extends TypedEvent>(
|
||||
eventFilter?: TypedEventFilter<TEvent>
|
||||
): Array<TypedListener<TEvent>>;
|
||||
listeners(eventName?: string): Array<Listener>;
|
||||
removeAllListeners<TEvent extends TypedEvent>(
|
||||
eventFilter: TypedEventFilter<TEvent>
|
||||
): this;
|
||||
removeAllListeners(eventName?: string): this;
|
||||
off: OnEvent<this>;
|
||||
on: OnEvent<this>;
|
||||
once: OnEvent<this>;
|
||||
removeListener: OnEvent<this>;
|
||||
|
||||
functions: {
|
||||
mtc1(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<ContractTransaction>;
|
||||
|
||||
mtc2(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<ContractTransaction>;
|
||||
};
|
||||
|
||||
mtc1(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<ContractTransaction>;
|
||||
|
||||
mtc2(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<ContractTransaction>;
|
||||
|
||||
callStatic: {
|
||||
mtc1(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string[]]>;
|
||||
|
||||
mtc2(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: CallOverrides
|
||||
): Promise<[BigNumber, string, Multicall.ResultStructOutput[]]>;
|
||||
};
|
||||
|
||||
filters: {};
|
||||
|
||||
estimateGas: {
|
||||
mtc1(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<BigNumber>;
|
||||
|
||||
mtc2(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<BigNumber>;
|
||||
};
|
||||
|
||||
populateTransaction: {
|
||||
mtc1(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<PopulatedTransaction>;
|
||||
|
||||
mtc2(
|
||||
calls: Multicall.CallStruct[],
|
||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||
): Promise<PopulatedTransaction>;
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Autogenerated file. Do not edit manually. */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export type { Counters } from "./Counters";
|
||||
export type { Multicall } from "./Multicall";
|
||||
export type { ReentrancyGuard } from "./ReentrancyGuard";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,21 +23,73 @@ describe("Reputation", () => {
|
||||
({ reputation } = await loadFixture(repFixture));
|
||||
});
|
||||
|
||||
// describe("Limiter", async () => {
|
||||
// it("Curve reliability", async () => {
|
||||
// const tx1 = await reputation.connect(owner).limiter(0);
|
||||
// const tx2 = await reputation.limiter(500);
|
||||
// const tx3 = await reputation
|
||||
// .connect(owner)
|
||||
// .limiter(444444);
|
||||
// const tx4 = await reputation.limiter(988700);
|
||||
|
||||
// expect(tx1).to.eq(curve(0));
|
||||
// expect(tx2).to.eq(curve(500));
|
||||
// expect(tx3).to.eq(curve(444444));
|
||||
// expect(tx4).to.eq(curve(988700));
|
||||
// });
|
||||
// });
|
||||
|
||||
describe("Limiter", async () => {
|
||||
it("Curve reliability", async () => {
|
||||
const tx1 = await reputation.connect(owner).limiter(0);
|
||||
const tx2 = await reputation.limiter(500);
|
||||
const tx3 = await reputation
|
||||
.connect(owner)
|
||||
.limiter(444444);
|
||||
const tx4 = await reputation.limiter(988700);
|
||||
|
||||
expect(tx1).to.eq(curve(0));
|
||||
expect(tx2).to.eq(curve(500));
|
||||
expect(tx3).to.eq(curve(444444));
|
||||
expect(tx4).to.eq(curve(988700));
|
||||
|
||||
const testCases = [
|
||||
{
|
||||
x: 0,
|
||||
expected: curve(0),
|
||||
},
|
||||
{
|
||||
x: 500,
|
||||
expected: curve(500),
|
||||
},
|
||||
{
|
||||
x: 444444,
|
||||
expected: curve(444444),
|
||||
},
|
||||
{
|
||||
x: 988700,
|
||||
expected: curve(988700),
|
||||
},
|
||||
{
|
||||
x: Number.MAX_SAFE_INTEGER,
|
||||
shouldRevert: "overflow",
|
||||
},
|
||||
{
|
||||
x: Number.POSITIVE_INFINITY,
|
||||
shouldRevert: "overflow",
|
||||
},
|
||||
{
|
||||
x: Number.NEGATIVE_INFINITY,
|
||||
shouldRevert: "overflow",
|
||||
},
|
||||
{
|
||||
x: -1,
|
||||
shouldRevert: "value out-of-bounds",
|
||||
},
|
||||
{
|
||||
x: Number.NaN,
|
||||
shouldRevert: "invalid BigNumber string",
|
||||
},
|
||||
];
|
||||
|
||||
for (const testCase of testCases) {
|
||||
if (testCase.shouldRevert != undefined) {
|
||||
await expect(reputation.limiter(testCase.x)).to.be
|
||||
.rejected;
|
||||
} else {
|
||||
const result = await reputation.limiter(testCase.x);
|
||||
expect(result).to.eq(testCase.expected).and.to.be
|
||||
.ok;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
1412
test/p2pix.test.ts
1412
test/p2pix.test.ts
File diff suppressed because it is too large
Load Diff
@@ -15,4 +15,9 @@ export enum P2PixErrors {
|
||||
AddressDenied = "AddressDenied",
|
||||
AmountNotAllowed = "AmountNotAllowed",
|
||||
LockExpired = "LockExpired",
|
||||
EmptyPixTarget = "EmptyPixTarget",
|
||||
MaxBalExceeded = "MaxBalExceeded",
|
||||
NotInitialized = "NotInitialized",
|
||||
DecOverflow = "DecOverflow",
|
||||
CallFailed = "CallFailed",
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import { MerkleTree } from "merkletreejs";
|
||||
|
||||
import {
|
||||
MockToken,
|
||||
Multicall,
|
||||
P2PIX,
|
||||
P2PIX__factory,
|
||||
Reputation,
|
||||
} from "../../src/types";
|
||||
|
||||
@@ -17,22 +19,27 @@ export interface Deploys {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface Deposit {
|
||||
remaining: BigNumber;
|
||||
pixTarget: string;
|
||||
seller: string;
|
||||
token: string;
|
||||
valid: boolean;
|
||||
}
|
||||
|
||||
export interface Lock {
|
||||
depositID: BigNumber;
|
||||
sellerKey: BigNumber;
|
||||
counter: BigNumber;
|
||||
relayerPremium: BigNumber;
|
||||
amount: BigNumber;
|
||||
expirationBlock: BigNumber;
|
||||
pixTarget: BigNumber;
|
||||
buyerAddress: string;
|
||||
relayerTarget: string;
|
||||
relayerAddress: string;
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface Call {
|
||||
target: string;
|
||||
callData: string;
|
||||
}
|
||||
|
||||
export interface Result {
|
||||
success: boolean;
|
||||
returnData: string;
|
||||
}
|
||||
|
||||
export interface P2pixFixture {
|
||||
@@ -46,19 +53,40 @@ export interface RepFixture {
|
||||
reputation: Reputation;
|
||||
}
|
||||
|
||||
type P2PixAndReputation = P2pixFixture & RepFixture;
|
||||
export interface MtcFixture {
|
||||
multicall: Multicall;
|
||||
}
|
||||
|
||||
type P2PixAndReputation = P2pixFixture &
|
||||
RepFixture &
|
||||
MtcFixture;
|
||||
|
||||
// exported constants
|
||||
export const getSignerAddrs = (
|
||||
amount: number,
|
||||
addrs: SignerWithAddress[],
|
||||
): string[] => {
|
||||
const signers: string[] = [];
|
||||
const buffr = addrs.slice(0, amount);
|
||||
for (let i = 0; i < amount; i++) {
|
||||
signers.push(buffr[i].address);
|
||||
}
|
||||
return signers;
|
||||
return addrs.slice(0, amount).map(({ address }) => address);
|
||||
};
|
||||
|
||||
export const getBnFrom = (nums: number[]): BigNumber[] => {
|
||||
const bns = nums.map(num => ethers.BigNumber.from(num));
|
||||
return bns;
|
||||
};
|
||||
|
||||
export const getLockData = (
|
||||
addr: string,
|
||||
locks: BigNumber[][],
|
||||
): Call[] => {
|
||||
const iface = new ethers.utils.Interface(
|
||||
P2PIX__factory.abi,
|
||||
);
|
||||
return locks.map(lock => ({
|
||||
target: addr,
|
||||
callData: iface.encodeFunctionData("getLocksStatus", [
|
||||
lock,
|
||||
]),
|
||||
}));
|
||||
};
|
||||
|
||||
export const randomSigners = (amount: number): Signer[] => {
|
||||
@@ -125,6 +153,11 @@ export async function p2pixFixture(): Promise<P2PixAndReputation> {
|
||||
[true],
|
||||
)) as P2PIX;
|
||||
|
||||
const Multicall = await ethers.getContractFactory(
|
||||
"Multicall",
|
||||
);
|
||||
const multicall = (await Multicall.deploy()) as Multicall;
|
||||
|
||||
const signers = await ethers.getSigners();
|
||||
const whitelisted = signers.slice(0, 2);
|
||||
const leaves = whitelisted.map(account =>
|
||||
@@ -139,6 +172,7 @@ export async function p2pixFixture(): Promise<P2PixAndReputation> {
|
||||
);
|
||||
|
||||
return {
|
||||
multicall,
|
||||
reputation,
|
||||
erc20,
|
||||
p2pix,
|
||||
|
||||
11
yarn.lock
11
yarn.lock
@@ -6049,16 +6049,17 @@ fsevents@~2.1.1:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"hardhat-tracer@npm:^1.2.0":
|
||||
version: 1.2.0
|
||||
resolution: "hardhat-tracer@npm:1.2.0"
|
||||
"hardhat-tracer@npm:beta":
|
||||
version: 2.0.0-beta.6
|
||||
resolution: "hardhat-tracer@npm:2.0.0-beta.6"
|
||||
dependencies:
|
||||
ethers: ^5.6.1
|
||||
peerDependencies:
|
||||
chai: 4.x
|
||||
chalk: 4.x
|
||||
ethers: 5.x
|
||||
hardhat: 2.x
|
||||
checksum: 1d348fb3ed60cbde2287329730ccd37c73af80cc2cf4ccfb045f26af26c7efebd4a6fdf611035f34ca7fb75d0eb95985e8f5ed4f0537d2615fb6e126d1d035f0
|
||||
checksum: b14795adf3eecd487b874ef06799ab43c342a4908bcf58bbd0bc7274caa7976456a0c75a702aaf3a937fe7c8afbfe2e2a9f263b6a0c7e2fc56e6a54144288369
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -8459,7 +8460,7 @@ fsevents@~2.1.1:
|
||||
fs-extra: ^10.1.0
|
||||
hardhat: ^2.12.2
|
||||
hardhat-gas-reporter: ^1.0.9
|
||||
hardhat-tracer: ^1.2.0
|
||||
hardhat-tracer: beta
|
||||
husky: ^8.0.1
|
||||
keccak256: ^1.0.6
|
||||
lint-staged: ^13.0.3
|
||||
|
||||
Reference in New Issue
Block a user