Merged V2 overriding main.
This commit is contained in:
commit
ce28faae9d
17
README.md
17
README.md
@ -18,7 +18,6 @@
|
|||||||
│ ├── tokens
|
│ ├── tokens
|
||||||
│ │ └── ERC20.sol
|
│ │ └── ERC20.sol
|
||||||
│ └── utils
|
│ └── utils
|
||||||
│ ├── Counters.sol
|
|
||||||
│ ├── MerkleProofLib.sol
|
│ ├── MerkleProofLib.sol
|
||||||
│ ├── ReentrancyGuard.sol
|
│ ├── ReentrancyGuard.sol
|
||||||
│ └── SafeTransferLib.sol
|
│ └── SafeTransferLib.sol
|
||||||
@ -32,6 +31,7 @@
|
|||||||
|
|
||||||
## Current Deployment addresses
|
## Current Deployment addresses
|
||||||
|
|
||||||
|
### V1
|
||||||
| Testnet | Token Address | P2pix Address |
|
| Testnet | Token Address | P2pix Address |
|
||||||
|--------- |-------------------------------------------- |-------------------------------------------- |
|
|--------- |-------------------------------------------- |-------------------------------------------- |
|
||||||
| Goerli | 0x294003F602c321627152c6b7DED3EAb5bEa853Ee | 0x5f3EFA9A90532914545CEf527C530658af87e196 |
|
| Goerli | 0x294003F602c321627152c6b7DED3EAb5bEa853Ee | 0x5f3EFA9A90532914545CEf527C530658af87e196 |
|
||||||
@ -47,6 +47,21 @@
|
|||||||
|
|
||||||
<!-- https://mumbai.polygonscan.com/address/0x5f3EFA9A90532914545CEf527C530658af87e196#code -->
|
<!-- https://mumbai.polygonscan.com/address/0x5f3EFA9A90532914545CEf527C530658af87e196#code -->
|
||||||
|
|
||||||
|
### V2
|
||||||
|
| Testnet | Token Address | P2pix Address | Reputation Address |
|
||||||
|
|--------- |-------------------------------------------- |-------------------------------------------- |-------------------------------------------- |
|
||||||
|
| Goerli | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0xefa5cE4351cda51192509cf8De7d8881ADAE95DD | 0x939d3c357dc7017cDbDE681BF8e552b54595318A |
|
||||||
|
| Mumbai | 0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29 | 0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b | 0x1fd30b94f20d2f73e9630261342ba68f244da92b |
|
||||||
|
|
||||||
|
<!-- All contracts deployed by 0x8dC06F985C131166570825F52447E8c88d64aE20 -->
|
||||||
|
<!-- https://goerli.etherscan.io/address/0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00#code -->
|
||||||
|
<!-- https://goerli.etherscan.io/address/0xefa5cE4351cda51192509cf8De7d8881ADAE95DD#code -->
|
||||||
|
<!-- https://goerli.etherscan.io/address/0x939d3c357dc7017cDbDE681BF8e552b54595318A#code -->
|
||||||
|
|
||||||
|
<!-- https://mumbai.polygonscan.com/address/0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29#code -->
|
||||||
|
<!-- https://mumbai.polygonscan.com/address/0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b#code -->
|
||||||
|
<!-- https://mumbai.polygonscan.com/address/0x1fd30b94f20d2f73e9630261342ba68f244da92b#code -->
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Pre Requisites
|
### Pre Requisites
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,21 @@
|
|||||||
"name": "AmountNotAllowed",
|
"name": "AmountNotAllowed",
|
||||||
"type": "error"
|
"type": "error"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "DecOverflow",
|
||||||
|
"type": "error"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "DepositAlreadyExists",
|
"name": "DepositAlreadyExists",
|
||||||
"type": "error"
|
"type": "error"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "EmptyPixTarget",
|
||||||
|
"type": "error"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "InvalidDeposit",
|
"name": "InvalidDeposit",
|
||||||
@ -48,6 +58,11 @@
|
|||||||
"name": "LoopOverflow",
|
"name": "LoopOverflow",
|
||||||
"type": "error"
|
"type": "error"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MaxBalExceeded",
|
||||||
|
"type": "error"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "NoTokens",
|
"name": "NoTokens",
|
||||||
@ -63,6 +78,11 @@
|
|||||||
"name": "NotExpired",
|
"name": "NotExpired",
|
||||||
"type": "error"
|
"type": "error"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "NotInitialized",
|
||||||
|
"type": "error"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "OnlySeller",
|
"name": "OnlySeller",
|
||||||
@ -111,12 +131,6 @@
|
|||||||
"name": "seller",
|
"name": "seller",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"indexed": false,
|
|
||||||
"internalType": "uint256",
|
|
||||||
"name": "depositID",
|
|
||||||
"type": "uint256"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
@ -144,29 +158,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "uint256",
|
|
||||||
"name": "depositID",
|
|
||||||
"type": "uint256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "DepositClosed",
|
|
||||||
"type": "event"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"anonymous": false,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"indexed": true,
|
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "seller",
|
"name": "token",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"indexed": false,
|
|
||||||
"internalType": "uint256",
|
|
||||||
"name": "depositID",
|
|
||||||
"type": "uint256"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
@ -207,14 +202,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": true,
|
"indexed": true,
|
||||||
"internalType": "bytes32",
|
"internalType": "uint256",
|
||||||
"name": "lockID",
|
"name": "lockID",
|
||||||
"type": "bytes32"
|
"type": "uint256"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "depositID",
|
"name": "seller",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -251,9 +246,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "bytes32",
|
"internalType": "uint256",
|
||||||
"name": "lockId",
|
"name": "lockId",
|
||||||
"type": "bytes32"
|
"type": "uint256"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
@ -276,9 +271,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "bytes32",
|
"internalType": "uint256",
|
||||||
"name": "lockId",
|
"name": "lockId",
|
||||||
"type": "bytes32"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "LockReturned",
|
"name": "LockReturned",
|
||||||
@ -316,6 +311,31 @@
|
|||||||
"name": "RootUpdated",
|
"name": "RootUpdated",
|
||||||
"type": "event"
|
"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,
|
"anonymous": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.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",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../build-info/7e875699b08052f41af96a3837e5d6fb.json"
|
"buildInfo": "../../build-info/6e32e8b8339868a5a7b642cfedb2d144.json"
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -2,26 +2,28 @@
|
|||||||
pragma solidity 0.8.9;
|
pragma solidity 0.8.9;
|
||||||
|
|
||||||
library DataTypes {
|
library DataTypes {
|
||||||
struct Deposit {
|
// struct Deposit {
|
||||||
/// @dev Remaining tokens available.
|
// /// @dev Remaining tokens available.
|
||||||
uint256 remaining;
|
// uint256 remaining;
|
||||||
/// @dev The PIX account for the seller receive transactions.
|
// /// @dev The PIX account for the seller receive transactions.
|
||||||
string pixTarget;
|
// string pixTarget;
|
||||||
address seller;
|
// address seller;
|
||||||
/// @dev ERC20 stable token address.
|
// /// @dev ERC20 stable token address.
|
||||||
address token;
|
// address token;
|
||||||
/// @dev Could be invalidated by the seller.
|
// /// @dev Could be invalidated by the seller.
|
||||||
bool valid;
|
// bool valid;
|
||||||
}
|
// }
|
||||||
|
|
||||||
struct Lock {
|
struct Lock {
|
||||||
uint256 depositID;
|
uint256 sellerKey;
|
||||||
|
uint256 counter;
|
||||||
/// @dev Amount to be paid for relayer.
|
/// @dev Amount to be paid for relayer.
|
||||||
uint256 relayerPremium;
|
uint256 relayerPremium;
|
||||||
/// @dev Amount to be tranfered via PIX.
|
/// @dev Amount to be tranfered via PIX.
|
||||||
uint256 amount;
|
uint256 amount;
|
||||||
/// @dev If not paid at this block will be expired.
|
/// @dev If not paid at this block will be expired.
|
||||||
uint256 expirationBlock;
|
uint256 expirationBlock;
|
||||||
|
uint160 pixTarget;
|
||||||
/// @dev Where the tokens are sent the when order gets validated.
|
/// @dev Where the tokens are sent the when order gets validated.
|
||||||
address buyerAddress;
|
address buyerAddress;
|
||||||
/// @dev Relayer's target address that receives `relayerPremium` funds.
|
/// @dev Relayer's target address that receives `relayerPremium` funds.
|
||||||
@ -29,5 +31,6 @@ library DataTypes {
|
|||||||
/// @dev Relayer address (msg.sender) that facilitated this transaction.
|
/// @dev Relayer address (msg.sender) that facilitated this transaction.
|
||||||
/// @dev Reputation points accruer.
|
/// @dev Reputation points accruer.
|
||||||
address relayerAddress;
|
address relayerAddress;
|
||||||
|
address token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,33 +7,34 @@ interface EventAndErrors {
|
|||||||
|
|
||||||
event DepositAdded(
|
event DepositAdded(
|
||||||
address indexed seller,
|
address indexed seller,
|
||||||
uint256 depositID,
|
// uint256 depositID,
|
||||||
address token,
|
address token,
|
||||||
uint256 amount
|
uint256 amount
|
||||||
);
|
);
|
||||||
event DepositClosed(
|
event ValidSet(
|
||||||
address indexed seller,
|
address indexed seller,
|
||||||
uint256 depositID
|
address token,
|
||||||
|
bool state
|
||||||
);
|
);
|
||||||
event DepositWithdrawn(
|
event DepositWithdrawn(
|
||||||
address indexed seller,
|
address indexed seller,
|
||||||
uint256 depositID,
|
address token,
|
||||||
uint256 amount
|
uint256 amount
|
||||||
);
|
);
|
||||||
event LockAdded(
|
event LockAdded(
|
||||||
address indexed buyer,
|
address indexed buyer,
|
||||||
bytes32 indexed lockID,
|
uint256 indexed lockID,
|
||||||
uint256 depositID,
|
uint256 seller,
|
||||||
uint256 amount
|
uint256 amount
|
||||||
);
|
);
|
||||||
event LockReleased(
|
event LockReleased(
|
||||||
address indexed buyer,
|
address indexed buyer,
|
||||||
bytes32 lockId,
|
uint256 lockId,
|
||||||
uint256 amount
|
uint256 amount
|
||||||
);
|
);
|
||||||
event LockReturned(
|
event LockReturned(
|
||||||
address indexed buyer,
|
address indexed buyer,
|
||||||
bytes32 lockId
|
uint256 lockId
|
||||||
);
|
);
|
||||||
event FundsWithdrawn(
|
event FundsWithdrawn(
|
||||||
address owner,
|
address owner,
|
||||||
@ -104,4 +105,13 @@ interface EventAndErrors {
|
|||||||
/// @dev Reverts on an expired lock.
|
/// @dev Reverts on an expired lock.
|
||||||
/// @dev 0xf6fafba0
|
/// @dev 0xf6fafba0
|
||||||
error LockExpired();
|
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,7 +9,6 @@ pragma solidity 0.8.9;
|
|||||||
///
|
///
|
||||||
|
|
||||||
import { Owned } from "./lib/auth/Owned.sol";
|
import { Owned } from "./lib/auth/Owned.sol";
|
||||||
import { Counters } from "./lib/utils/Counters.sol";
|
|
||||||
import { ERC20, SafeTransferLib } from "./lib/utils/SafeTransferLib.sol";
|
import { ERC20, SafeTransferLib } from "./lib/utils/SafeTransferLib.sol";
|
||||||
import { IReputation } from "./lib/interfaces/IReputation.sol";
|
import { IReputation } from "./lib/interfaces/IReputation.sol";
|
||||||
import { MerkleProofLib as Merkle } from "./lib/utils/MerkleProofLib.sol";
|
import { MerkleProofLib as Merkle } from "./lib/utils/MerkleProofLib.sol";
|
||||||
@ -24,36 +23,55 @@ contract P2PIX is
|
|||||||
{
|
{
|
||||||
// solhint-disable use-forbidden-name
|
// solhint-disable use-forbidden-name
|
||||||
// solhint-disable no-inline-assembly
|
// 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.Lock;
|
||||||
|
|
||||||
|
/// ███ 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 ████████████████████████████████████████████████████████████
|
/// ███ Storage ████████████████████████████████████████████████████████████
|
||||||
|
|
||||||
IReputation public reputation;
|
IReputation public reputation;
|
||||||
Counters.Counter public depositCount;
|
// Counters.Counter public depositCount;
|
||||||
|
|
||||||
/// @dev Default blocks that lock will hold tokens.
|
/// @dev Default blocks that lock will hold tokens.
|
||||||
uint256 public defaultLockBlocks;
|
uint256 public defaultLockBlocks;
|
||||||
/// @dev The scalar of BRZ token.
|
uint256 public lockCounter;
|
||||||
uint256 public constant WAD = 1e18;
|
|
||||||
|
|
||||||
|
/// @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.
|
/// @dev Stores an relayer's last computed credit.
|
||||||
mapping(uint256 => uint256) public userRecord;
|
mapping(uint256 => uint256) public userRecord;
|
||||||
/// @dev List of valid Bacen signature addresses
|
/// @dev List of valid Bacen signature addresses
|
||||||
mapping(uint256 => bool) public validBacenSigners;
|
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.
|
/// @dev List of Pix transactions already signed.
|
||||||
mapping(bytes32 => bool) public usedTransactions;
|
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.
|
/// @dev Tokens allowed to serve as the underlying amount of a deposit.
|
||||||
mapping(ERC20 => bool) public allowedERC20s;
|
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 ████████████████████████████████████████████████████████
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -76,27 +94,29 @@ contract P2PIX is
|
|||||||
/// @dev Seller needs to send his tokens to the P2PIX smart contract.
|
/// @dev Seller needs to send his tokens to the P2PIX smart contract.
|
||||||
/// @param _pixTarget Pix key destination provided by the offer's seller.
|
/// @param _pixTarget Pix key destination provided by the offer's seller.
|
||||||
/// @param allowlistRoot Optional allow list merkleRoot update `bytes32` value.
|
/// @param allowlistRoot Optional allow list merkleRoot update `bytes32` value.
|
||||||
/// @return depositID The `uint256` return value provided
|
|
||||||
/// as the deposit identifier.
|
/// as the deposit identifier.
|
||||||
/// @dev Function sighash: 0xbfe07da6.
|
/// @dev Function sighash: 0xbfe07da6.
|
||||||
function deposit(
|
function deposit(
|
||||||
address _token,
|
address _token,
|
||||||
uint256 _amount,
|
uint96 _amount,
|
||||||
string calldata _pixTarget,
|
uint160 _pixTarget,
|
||||||
|
bool _valid,
|
||||||
bytes32 allowlistRoot
|
bytes32 allowlistRoot
|
||||||
) public returns (uint256 depositID) {
|
) public {
|
||||||
ERC20 t = ERC20(_token);
|
ERC20 t = ERC20(_token);
|
||||||
if (!allowedERC20s[t]) revert TokenDenied();
|
uint256 k = _castAddrToKey(msg.sender);
|
||||||
|
|
||||||
(depositID) = _encodeDepositID();
|
if (_pixTarget == 0)
|
||||||
|
revert EmptyPixTarget();
|
||||||
|
if (!allowedERC20s[t])
|
||||||
|
revert TokenDenied();
|
||||||
|
uint256 _sellerBalance =
|
||||||
|
sellerBalance[k][t];
|
||||||
|
|
||||||
DT.Deposit memory d = DT.Deposit({
|
uint256 currBal =
|
||||||
remaining: _amount,
|
_sellerBalance & BITMASK_SB_ENTRY;
|
||||||
pixTarget: _pixTarget,
|
if ((currBal + _amount) > 1e8 ether)
|
||||||
seller: msg.sender,
|
revert MaxBalExceeded();
|
||||||
token: _token,
|
|
||||||
valid: true
|
|
||||||
});
|
|
||||||
|
|
||||||
setReentrancyGuard();
|
setReentrancyGuard();
|
||||||
|
|
||||||
@ -104,8 +124,23 @@ contract P2PIX is
|
|||||||
setRoot(msg.sender, allowlistRoot);
|
setRoot(msg.sender, allowlistRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
mapDeposits[depositID] = d;
|
uint256 amountCasted;
|
||||||
depositCount.increment();
|
uint256 pixTargetCasted;
|
||||||
|
uint256 validCasted;
|
||||||
|
(
|
||||||
|
amountCasted,
|
||||||
|
pixTargetCasted,
|
||||||
|
validCasted
|
||||||
|
) = _castToUint(
|
||||||
|
_amount,
|
||||||
|
_pixTarget,
|
||||||
|
_valid
|
||||||
|
);
|
||||||
|
|
||||||
|
sellerBalance[k][t] =
|
||||||
|
(currBal + amountCasted) |
|
||||||
|
(pixTargetCasted << BITPOS_PIXTARGET) |
|
||||||
|
(validCasted << BITPOS_VALID);
|
||||||
|
|
||||||
SafeTransferLib.safeTransferFrom(
|
SafeTransferLib.safeTransferFrom(
|
||||||
t,
|
t,
|
||||||
@ -118,7 +153,6 @@ contract P2PIX is
|
|||||||
|
|
||||||
emit DepositAdded(
|
emit DepositAdded(
|
||||||
msg.sender,
|
msg.sender,
|
||||||
depositID,
|
|
||||||
_token,
|
_token,
|
||||||
_amount
|
_amount
|
||||||
);
|
);
|
||||||
@ -128,14 +162,30 @@ contract P2PIX is
|
|||||||
/// locks made to his/her token offering order.
|
/// locks made to his/her token offering order.
|
||||||
/// @dev This function does not affect any ongoing active locks.
|
/// @dev This function does not affect any ongoing active locks.
|
||||||
/// @dev Function sighash: 0x72fada5c.
|
/// @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 {
|
if (_sellerBalance != 0) {
|
||||||
_onlySeller(depositID);
|
uint256 _valid;
|
||||||
mapDeposits[depositID].valid = false;
|
assembly { _valid := state }
|
||||||
emit DepositClosed(
|
|
||||||
mapDeposits[depositID].seller,
|
_sellerBalance =
|
||||||
depositID
|
(_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
|
/// @notice Public method designed to lock an remaining amount of
|
||||||
@ -158,68 +208,115 @@ contract P2PIX is
|
|||||||
/// @return lockID The `bytes32` value returned as the lock identifier.
|
/// @return lockID The `bytes32` value returned as the lock identifier.
|
||||||
/// @dev Function sighash: 0x03aaf306.
|
/// @dev Function sighash: 0x03aaf306.
|
||||||
function lock(
|
function lock(
|
||||||
uint256 _depositID,
|
address _seller,
|
||||||
|
address _token,
|
||||||
address _buyerAddress,
|
address _buyerAddress,
|
||||||
address _relayerTarget,
|
address _relayerTarget,
|
||||||
uint256 _relayerPremium,
|
uint256 _relayerPremium,
|
||||||
uint256 _amount,
|
uint256 _amount,
|
||||||
bytes32[] calldata merkleProof,
|
bytes32[] calldata merkleProof,
|
||||||
bytes32[] calldata expiredLocks
|
uint256[] calldata expiredLocks
|
||||||
) public nonReentrant returns (bytes32 lockID) {
|
) public nonReentrant returns (uint256) {
|
||||||
unlockExpired(expiredLocks);
|
unlockExpired(expiredLocks);
|
||||||
DT.Deposit storage d = mapDeposits[_depositID];
|
|
||||||
|
|
||||||
if (!d.valid) revert InvalidDeposit();
|
ERC20 t = ERC20(_token);
|
||||||
if (d.remaining < _amount) revert NotEnoughTokens();
|
if (!getValid(_seller, t))
|
||||||
|
revert InvalidDeposit();
|
||||||
|
|
||||||
(lockID) = _encodeLockID(
|
uint256 bal =
|
||||||
_depositID,
|
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,
|
_amount,
|
||||||
_buyerAddress
|
(block.number +
|
||||||
);
|
|
||||||
|
|
||||||
DT.Lock memory l = DT.Lock({
|
|
||||||
depositID: _depositID,
|
|
||||||
relayerPremium: _relayerPremium,
|
|
||||||
amount: _amount,
|
|
||||||
expirationBlock: (block.number +
|
|
||||||
defaultLockBlocks),
|
defaultLockBlocks),
|
||||||
buyerAddress: _buyerAddress,
|
uint160(sellerBalance[k][t]
|
||||||
relayerTarget: _relayerTarget,
|
>> BITPOS_PIXTARGET),
|
||||||
relayerAddress: msg.sender
|
_buyerAddress,
|
||||||
});
|
_relayerTarget,
|
||||||
|
msg.sender,
|
||||||
|
address(t)
|
||||||
|
);
|
||||||
|
|
||||||
if (merkleProof.length != 0) {
|
if (merkleProof.length != 0) {
|
||||||
merkleVerify(
|
merkleVerify(
|
||||||
merkleProof,
|
merkleProof,
|
||||||
sellerAllowList[_castAddrToKey(d.seller)],
|
sellerAllowList[k],
|
||||||
msg.sender
|
msg.sender
|
||||||
);
|
);
|
||||||
|
|
||||||
_addLock(lockID, l, d);
|
_addLock(
|
||||||
|
bal,
|
||||||
|
_amount,
|
||||||
|
cCounter,
|
||||||
|
l,
|
||||||
|
t,
|
||||||
|
k
|
||||||
|
);
|
||||||
|
|
||||||
|
lockCounter++;
|
||||||
|
|
||||||
// Halt execution and output `lockID`.
|
// Halt execution and output `lockID`.
|
||||||
return lockID;
|
return cCounter;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (l.amount <= 1e2 ether) {
|
if (l.amount <= 1e2 ether) {
|
||||||
_addLock(lockID, l, d);
|
_addLock(
|
||||||
|
bal,
|
||||||
|
_amount,
|
||||||
|
cCounter,
|
||||||
|
l,
|
||||||
|
t,
|
||||||
|
k
|
||||||
|
);
|
||||||
|
|
||||||
|
lockCounter++;
|
||||||
|
|
||||||
// Halt execution and output `lockID`.
|
// Halt execution and output `lockID`.
|
||||||
return lockID;
|
return cCounter;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
uint256 userCredit = userRecord[
|
uint256 userCredit = userRecord[
|
||||||
_castAddrToKey(msg.sender)
|
_castAddrToKey(msg.sender)
|
||||||
];
|
];
|
||||||
|
|
||||||
uint256 spendLimit;
|
uint256 spendLimit;
|
||||||
(spendLimit) = _limiter(userCredit / WAD);
|
(spendLimit) =
|
||||||
|
_limiter(userCredit / WAD);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
l.amount > (spendLimit * WAD) ||
|
l.amount > (spendLimit * WAD) ||
|
||||||
l.amount > 1e6 ether
|
l.amount > 1e6 ether
|
||||||
) revert AmountNotAllowed();
|
) revert AmountNotAllowed();
|
||||||
|
|
||||||
_addLock(lockID, l, d);
|
_addLock(
|
||||||
|
bal,
|
||||||
|
_amount,
|
||||||
|
cCounter,
|
||||||
|
l,
|
||||||
|
t,
|
||||||
|
k
|
||||||
|
);
|
||||||
|
|
||||||
|
lockCounter++;
|
||||||
|
|
||||||
// Halt execution and output `lockID`.
|
// Halt execution and output `lockID`.
|
||||||
return lockID;
|
return cCounter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,10 +332,10 @@ contract P2PIX is
|
|||||||
/// In case of they differing:
|
/// In case of they differing:
|
||||||
/// - `lock` caller gets accrued with `l.amount` as userRecord credit;
|
/// - `lock` caller gets accrued with `l.amount` as userRecord credit;
|
||||||
/// - `release` caller gets accrued with `l.relayerPremium` as userRecord credit;
|
/// - `release` caller gets accrued with `l.relayerPremium` as userRecord credit;
|
||||||
/// @param _relayerTarget Target address entitled to the `relayerPremim`.
|
/// @param _relayerTarget Target address entitled to the `relayerPremium`.
|
||||||
/// @dev Function sighash: 0x4e1389ed.
|
/// @dev Function sighash: 0x4e1389ed.
|
||||||
function release(
|
function release(
|
||||||
bytes32 lockID,
|
uint256 lockID,
|
||||||
address _relayerTarget,
|
address _relayerTarget,
|
||||||
bytes32 pixTimestamp,
|
bytes32 pixTimestamp,
|
||||||
bytes32 r,
|
bytes32 r,
|
||||||
@ -251,10 +348,9 @@ contract P2PIX is
|
|||||||
if (l.expirationBlock < block.number)
|
if (l.expirationBlock < block.number)
|
||||||
revert LockExpired();
|
revert LockExpired();
|
||||||
|
|
||||||
DT.Deposit storage d = mapDeposits[l.depositID];
|
|
||||||
bytes32 message = keccak256(
|
bytes32 message = keccak256(
|
||||||
abi.encodePacked(
|
abi.encodePacked(
|
||||||
d.pixTarget,
|
l.pixTarget,
|
||||||
l.amount,
|
l.amount,
|
||||||
pixTimestamp
|
pixTimestamp
|
||||||
)
|
)
|
||||||
@ -276,25 +372,28 @@ contract P2PIX is
|
|||||||
if (!validBacenSigners[signer])
|
if (!validBacenSigners[signer])
|
||||||
revert InvalidSigner();
|
revert InvalidSigner();
|
||||||
|
|
||||||
ERC20 t = ERC20(d.token);
|
ERC20 t = ERC20(l.token);
|
||||||
|
|
||||||
// We cache values before zeroing them out.
|
// We cache values before zeroing them out.
|
||||||
uint256 lockAmount = l.amount;
|
uint256 lockAmount =
|
||||||
uint256 totalAmount = (lockAmount - l.relayerPremium);
|
l.amount;
|
||||||
|
uint256 totalAmount =
|
||||||
|
(lockAmount - l.relayerPremium);
|
||||||
|
|
||||||
l.amount = 0;
|
l.amount = 0;
|
||||||
l.expirationBlock = 0;
|
l.expirationBlock = 0;
|
||||||
usedTransactions[message] = true;
|
usedTransactions[message] = true;
|
||||||
|
|
||||||
if (msg.sender != l.relayerAddress) {
|
if (msg.sender != l.relayerAddress) {
|
||||||
userRecord[_castAddrToKey(msg.sender)] += l
|
userRecord[
|
||||||
.relayerPremium;
|
_castAddrToKey(msg.sender)
|
||||||
|
] += l.relayerPremium;
|
||||||
userRecord[
|
userRecord[
|
||||||
_castAddrToKey(l.relayerAddress)
|
_castAddrToKey(l.relayerAddress)
|
||||||
] += lockAmount;
|
] += lockAmount;
|
||||||
} else {
|
} else {
|
||||||
userRecord[_castAddrToKey(msg.sender)] += (l
|
userRecord[_castAddrToKey(msg.sender)]
|
||||||
.relayerPremium + lockAmount);
|
+= (l.relayerPremium + lockAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
SafeTransferLib.safeTransfer(
|
SafeTransferLib.safeTransfer(
|
||||||
@ -325,7 +424,11 @@ contract P2PIX is
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit LockReleased(l.buyerAddress, lockID, lockAmount);
|
emit LockReleased(
|
||||||
|
l.buyerAddress,
|
||||||
|
lockID,
|
||||||
|
lockAmount
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Unlocks expired locks.
|
/// @notice Unlocks expired locks.
|
||||||
@ -334,32 +437,49 @@ contract P2PIX is
|
|||||||
/// @dev For each successfull unexpired lock recovered,
|
/// @dev For each successfull unexpired lock recovered,
|
||||||
/// `userRecord[_castAddrToKey(l.relayerAddress)]` is decreased by half of its value.
|
/// `userRecord[_castAddrToKey(l.relayerAddress)]` is decreased by half of its value.
|
||||||
/// @dev Function sighash: 0x8e2749d6.
|
/// @dev Function sighash: 0x8e2749d6.
|
||||||
function unlockExpired(bytes32[] calldata lockIDs)
|
function unlockExpired(uint256[] calldata lockIDs)
|
||||||
public
|
public
|
||||||
{
|
{
|
||||||
uint256 i;
|
uint256 i;
|
||||||
uint256 locksSize = lockIDs.length;
|
uint256 locksSize = lockIDs.length;
|
||||||
|
|
||||||
for (i; i < locksSize; ) {
|
for (i; i < locksSize; ) {
|
||||||
DT.Lock storage l = mapLocks[lockIDs[i]];
|
DT.Lock storage l =
|
||||||
|
mapLocks[lockIDs[i]];
|
||||||
|
|
||||||
_notExpired(l);
|
_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;
|
l.amount = 0;
|
||||||
|
|
||||||
uint256 userKey = _castAddrToKey(
|
uint256 userKey =
|
||||||
l.relayerAddress
|
_castAddrToKey(l.relayerAddress);
|
||||||
);
|
uint256 _newUserRecord =
|
||||||
uint256 _newUserRecord = (userRecord[userKey] >>
|
(userRecord[userKey] >> 1);
|
||||||
1);
|
|
||||||
|
|
||||||
if (_newUserRecord <= 1e2 ether) {
|
if (_newUserRecord <= 1e2 ether) {
|
||||||
userRecord[userKey] = 1e2 ether;
|
userRecord[userKey] = 1e2 ether;
|
||||||
} else {
|
} else {
|
||||||
userRecord[userKey] = _newUserRecord;
|
userRecord[userKey] = _newUserRecord;
|
||||||
}
|
}
|
||||||
emit LockReturned(l.buyerAddress, lockIDs[i]);
|
emit LockReturned(
|
||||||
|
l.buyerAddress,
|
||||||
|
lockIDs[i]
|
||||||
|
);
|
||||||
|
|
||||||
unchecked {
|
unchecked {
|
||||||
++i;
|
++i;
|
||||||
@ -380,28 +500,43 @@ contract P2PIX is
|
|||||||
/// tokens from expired deposits.
|
/// tokens from expired deposits.
|
||||||
/// @dev Function sighash: 0x36317972.
|
/// @dev Function sighash: 0x36317972.
|
||||||
function withdraw(
|
function withdraw(
|
||||||
uint256 depositID,
|
ERC20 token,
|
||||||
bytes32[] calldata expiredLocks
|
uint256 amount,
|
||||||
) public nonReentrant {
|
uint256[] calldata expiredLocks
|
||||||
_onlySeller(depositID);
|
)
|
||||||
|
public
|
||||||
|
nonReentrant
|
||||||
|
{
|
||||||
unlockExpired(expiredLocks);
|
unlockExpired(expiredLocks);
|
||||||
|
|
||||||
DT.Deposit storage d = mapDeposits[depositID];
|
if (getValid(msg.sender, token)
|
||||||
|
== true
|
||||||
if (d.valid == true) {
|
) {
|
||||||
cancelDeposit(depositID);
|
setValidState(token, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERC20 token = ERC20(d.token);
|
uint256 key =
|
||||||
|
_castAddrToKey(msg.sender);
|
||||||
// Withdraw remaining tokens from mapDeposit[depositID]
|
_decBal(
|
||||||
uint256 amount = d.remaining;
|
(sellerBalance[key][token]
|
||||||
d.remaining = 0;
|
& BITMASK_SB_ENTRY),
|
||||||
|
amount,
|
||||||
|
token,
|
||||||
|
key
|
||||||
|
);
|
||||||
|
|
||||||
// safeTransfer tokens to seller
|
// 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)
|
function setRoot(address addr, bytes32 merkleroot)
|
||||||
@ -484,7 +619,7 @@ contract P2PIX is
|
|||||||
let tLoc := add(_tokens, 0x20)
|
let tLoc := add(_tokens, 0x20)
|
||||||
let sLoc := add(_states, 0x20)
|
let sLoc := add(_states, 0x20)
|
||||||
for {
|
for {
|
||||||
let end := add(tLoc, mul(tLen, 0x20))
|
let end := add(tLoc, shl(5, tLen))
|
||||||
} iszero(eq(tLoc, end)) {
|
} iszero(eq(tLoc, end)) {
|
||||||
tLoc := add(tLoc, 0x20)
|
tLoc := add(tLoc, 0x20)
|
||||||
sLoc := add(sLoc, 0x20)
|
sLoc := add(sLoc, 0x20)
|
||||||
@ -511,14 +646,6 @@ contract P2PIX is
|
|||||||
// solhint-disable-next-line no-empty-blocks
|
// solhint-disable-next-line no-empty-blocks
|
||||||
receive() external payable {}
|
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
|
/// @notice Private view auxiliar logic that reverts
|
||||||
/// on a not expired lock passed as argument of the function.
|
/// on a not expired lock passed as argument of the function.
|
||||||
/// @dev Called exclusively by the `unlockExpired` method.
|
/// @dev Called exclusively by the `unlockExpired` method.
|
||||||
@ -529,55 +656,26 @@ contract P2PIX is
|
|||||||
if (_l.amount == 0) revert AlreadyReleased();
|
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(
|
function _addLock(
|
||||||
bytes32 _lockID,
|
uint256 _bal,
|
||||||
|
uint256 _amount,
|
||||||
|
uint256 _lockID,
|
||||||
DT.Lock memory _l,
|
DT.Lock memory _l,
|
||||||
DT.Deposit storage _d
|
ERC20 _t,
|
||||||
|
uint256 _k
|
||||||
) internal {
|
) internal {
|
||||||
mapLocks[_lockID] = _l;
|
mapLocks[_lockID] = _l;
|
||||||
_d.remaining -= _l.amount;
|
|
||||||
|
_decBal(_bal, _amount, _t, _k);
|
||||||
|
|
||||||
emit LockAdded(
|
emit LockAdded(
|
||||||
_l.buyerAddress,
|
_l.buyerAddress,
|
||||||
_lockID,
|
_lockID,
|
||||||
_l.depositID,
|
_l.sellerKey,
|
||||||
_l.amount
|
_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(
|
function merkleVerify(
|
||||||
bytes32[] calldata _merkleProof,
|
bytes32[] calldata _merkleProof,
|
||||||
bytes32 root,
|
bytes32 root,
|
||||||
@ -633,6 +731,147 @@ 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 Public method that handles `address`
|
/// @notice Public method that handles `address`
|
||||||
/// to `uint256` safe type casting.
|
/// to `uint256` safe type casting.
|
||||||
/// @dev Function sighash: 0x4b2ae980.
|
/// @dev Function sighash: 0x4b2ae980.
|
||||||
@ -641,6 +880,20 @@ contract P2PIX is
|
|||||||
pure
|
pure
|
||||||
returns (uint256 _key)
|
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",
|
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
||||||
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||||
],
|
],
|
||||||
"p2pix": "0x5f3EFA9A90532914545CEf527C530658af87e196",
|
"p2pix": "0xefa5cE4351cda51192509cf8De7d8881ADAE95DD",
|
||||||
"token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
|
"token": "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00"
|
||||||
}
|
}
|
@ -3,6 +3,6 @@
|
|||||||
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
||||||
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||||
],
|
],
|
||||||
"p2pix": "0x37c856F4d5bC2597da60f607b1335738468453F3",
|
"p2pix": "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29",
|
||||||
"token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
|
"token": "0xD38D6367f452D097ccBfDe4490b7de570B6A72Db"
|
||||||
}
|
}
|
@ -3,6 +3,6 @@
|
|||||||
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
||||||
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||||
],
|
],
|
||||||
"p2pix": "0x5f3EFA9A90532914545CEf527C530658af87e196",
|
"p2pix": "0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b",
|
||||||
"token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
|
"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 |
@ -121,12 +121,14 @@ const config: HardhatUserConfig = {
|
|||||||
solidity: {
|
solidity: {
|
||||||
version: "0.8.9",
|
version: "0.8.9",
|
||||||
settings: {
|
settings: {
|
||||||
|
// viaIR: true,
|
||||||
metadata: {
|
metadata: {
|
||||||
bytecodeHash: "none",
|
bytecodeHash: "none",
|
||||||
},
|
},
|
||||||
optimizer: {
|
optimizer: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
runs: 2000,
|
// max val = 4_294_967_295
|
||||||
|
runs: 20_000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "p2pix-smart-contracts",
|
"name": "p2pix-smart-contracts",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"description": "Repository for P2Pix EVM contracts to be imported by the project.",
|
"description": "Repository for P2Pix EVM contracts to be imported by the project.",
|
||||||
"homepage": "https://github.com/doiim/p2pix-smart-contracts#readme",
|
"homepage": "https://github.com/doiim/p2pix-smart-contracts#readme",
|
||||||
"author": "Filipe Soccol (doiim)",
|
"author": "Filipe Soccol (doiim)",
|
||||||
|
@ -62,6 +62,10 @@ const main = async () => {
|
|||||||
[true],
|
[true],
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
await hre.run("verify:verify", {
|
||||||
|
address: reputation.address,
|
||||||
|
constructorArguments: [],
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
/* Autogenerated file. Do not edit manually. */
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-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 { EventFragment } from "@ethersproject/abi";
|
||||||
import type { Listener, Provider } from "@ethersproject/providers";
|
import type { Listener, Provider } from "@ethersproject/providers";
|
||||||
import type {
|
import type {
|
||||||
@ -17,22 +23,21 @@ export interface EventAndErrorsInterface extends utils.Interface {
|
|||||||
|
|
||||||
events: {
|
events: {
|
||||||
"AllowedERC20Updated(address,bool)": EventFragment;
|
"AllowedERC20Updated(address,bool)": EventFragment;
|
||||||
"DepositAdded(address,uint256,address,uint256)": EventFragment;
|
"DepositAdded(address,address,uint256)": EventFragment;
|
||||||
"DepositClosed(address,uint256)": EventFragment;
|
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
||||||
"DepositWithdrawn(address,uint256,uint256)": EventFragment;
|
|
||||||
"FundsWithdrawn(address,uint256)": EventFragment;
|
"FundsWithdrawn(address,uint256)": EventFragment;
|
||||||
"LockAdded(address,bytes32,uint256,uint256)": EventFragment;
|
"LockAdded(address,uint256,uint256,uint256)": EventFragment;
|
||||||
"LockBlocksUpdated(uint256)": EventFragment;
|
"LockBlocksUpdated(uint256)": EventFragment;
|
||||||
"LockReleased(address,bytes32,uint256)": EventFragment;
|
"LockReleased(address,uint256,uint256)": EventFragment;
|
||||||
"LockReturned(address,bytes32)": EventFragment;
|
"LockReturned(address,uint256)": EventFragment;
|
||||||
"ReputationUpdated(address)": EventFragment;
|
"ReputationUpdated(address)": EventFragment;
|
||||||
"RootUpdated(address,bytes32)": EventFragment;
|
"RootUpdated(address,bytes32)": EventFragment;
|
||||||
|
"ValidSet(address,address,bool)": EventFragment;
|
||||||
"ValidSignersUpdated(address[])": EventFragment;
|
"ValidSignersUpdated(address[])": EventFragment;
|
||||||
};
|
};
|
||||||
|
|
||||||
getEvent(nameOrSignatureOrTopic: "AllowedERC20Updated"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "AllowedERC20Updated"): EventFragment;
|
||||||
getEvent(nameOrSignatureOrTopic: "DepositAdded"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "DepositAdded"): EventFragment;
|
||||||
getEvent(nameOrSignatureOrTopic: "DepositClosed"): EventFragment;
|
|
||||||
getEvent(nameOrSignatureOrTopic: "DepositWithdrawn"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "DepositWithdrawn"): EventFragment;
|
||||||
getEvent(nameOrSignatureOrTopic: "FundsWithdrawn"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "FundsWithdrawn"): EventFragment;
|
||||||
getEvent(nameOrSignatureOrTopic: "LockAdded"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "LockAdded"): EventFragment;
|
||||||
@ -41,6 +46,7 @@ export interface EventAndErrorsInterface extends utils.Interface {
|
|||||||
getEvent(nameOrSignatureOrTopic: "LockReturned"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "LockReturned"): EventFragment;
|
||||||
getEvent(nameOrSignatureOrTopic: "ReputationUpdated"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "ReputationUpdated"): EventFragment;
|
||||||
getEvent(nameOrSignatureOrTopic: "RootUpdated"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "RootUpdated"): EventFragment;
|
||||||
|
getEvent(nameOrSignatureOrTopic: "ValidSet"): EventFragment;
|
||||||
getEvent(nameOrSignatureOrTopic: "ValidSignersUpdated"): EventFragment;
|
getEvent(nameOrSignatureOrTopic: "ValidSignersUpdated"): EventFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,35 +64,23 @@ export type AllowedERC20UpdatedEventFilter =
|
|||||||
|
|
||||||
export interface DepositAddedEventObject {
|
export interface DepositAddedEventObject {
|
||||||
seller: string;
|
seller: string;
|
||||||
depositID: BigNumber;
|
|
||||||
token: string;
|
token: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
}
|
}
|
||||||
export type DepositAddedEvent = TypedEvent<
|
export type DepositAddedEvent = TypedEvent<
|
||||||
[string, BigNumber, string, BigNumber],
|
[string, string, BigNumber],
|
||||||
DepositAddedEventObject
|
DepositAddedEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DepositAddedEventFilter = TypedEventFilter<DepositAddedEvent>;
|
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 {
|
export interface DepositWithdrawnEventObject {
|
||||||
seller: string;
|
seller: string;
|
||||||
depositID: BigNumber;
|
token: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
}
|
}
|
||||||
export type DepositWithdrawnEvent = TypedEvent<
|
export type DepositWithdrawnEvent = TypedEvent<
|
||||||
[string, BigNumber, BigNumber],
|
[string, string, BigNumber],
|
||||||
DepositWithdrawnEventObject
|
DepositWithdrawnEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -106,12 +100,12 @@ export type FundsWithdrawnEventFilter = TypedEventFilter<FundsWithdrawnEvent>;
|
|||||||
|
|
||||||
export interface LockAddedEventObject {
|
export interface LockAddedEventObject {
|
||||||
buyer: string;
|
buyer: string;
|
||||||
lockID: string;
|
lockID: BigNumber;
|
||||||
depositID: BigNumber;
|
seller: BigNumber;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
}
|
}
|
||||||
export type LockAddedEvent = TypedEvent<
|
export type LockAddedEvent = TypedEvent<
|
||||||
[string, string, BigNumber, BigNumber],
|
[string, BigNumber, BigNumber, BigNumber],
|
||||||
LockAddedEventObject
|
LockAddedEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -130,11 +124,11 @@ export type LockBlocksUpdatedEventFilter =
|
|||||||
|
|
||||||
export interface LockReleasedEventObject {
|
export interface LockReleasedEventObject {
|
||||||
buyer: string;
|
buyer: string;
|
||||||
lockId: string;
|
lockId: BigNumber;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
}
|
}
|
||||||
export type LockReleasedEvent = TypedEvent<
|
export type LockReleasedEvent = TypedEvent<
|
||||||
[string, string, BigNumber],
|
[string, BigNumber, BigNumber],
|
||||||
LockReleasedEventObject
|
LockReleasedEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -142,10 +136,10 @@ export type LockReleasedEventFilter = TypedEventFilter<LockReleasedEvent>;
|
|||||||
|
|
||||||
export interface LockReturnedEventObject {
|
export interface LockReturnedEventObject {
|
||||||
buyer: string;
|
buyer: string;
|
||||||
lockId: string;
|
lockId: BigNumber;
|
||||||
}
|
}
|
||||||
export type LockReturnedEvent = TypedEvent<
|
export type LockReturnedEvent = TypedEvent<
|
||||||
[string, string],
|
[string, BigNumber],
|
||||||
LockReturnedEventObject
|
LockReturnedEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -173,6 +167,18 @@ export type RootUpdatedEvent = TypedEvent<
|
|||||||
|
|
||||||
export type RootUpdatedEventFilter = TypedEventFilter<RootUpdatedEvent>;
|
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 {
|
export interface ValidSignersUpdatedEventObject {
|
||||||
signers: string[];
|
signers: string[];
|
||||||
}
|
}
|
||||||
@ -224,36 +230,25 @@ export interface EventAndErrors extends BaseContract {
|
|||||||
state?: PromiseOrValue<boolean> | null
|
state?: PromiseOrValue<boolean> | null
|
||||||
): AllowedERC20UpdatedEventFilter;
|
): AllowedERC20UpdatedEventFilter;
|
||||||
|
|
||||||
"DepositAdded(address,uint256,address,uint256)"(
|
"DepositAdded(address,address,uint256)"(
|
||||||
seller?: PromiseOrValue<string> | null,
|
seller?: PromiseOrValue<string> | null,
|
||||||
depositID?: null,
|
|
||||||
token?: null,
|
token?: null,
|
||||||
amount?: null
|
amount?: null
|
||||||
): DepositAddedEventFilter;
|
): DepositAddedEventFilter;
|
||||||
DepositAdded(
|
DepositAdded(
|
||||||
seller?: PromiseOrValue<string> | null,
|
seller?: PromiseOrValue<string> | null,
|
||||||
depositID?: null,
|
|
||||||
token?: null,
|
token?: null,
|
||||||
amount?: null
|
amount?: null
|
||||||
): DepositAddedEventFilter;
|
): DepositAddedEventFilter;
|
||||||
|
|
||||||
"DepositClosed(address,uint256)"(
|
"DepositWithdrawn(address,address,uint256)"(
|
||||||
seller?: PromiseOrValue<string> | null,
|
seller?: PromiseOrValue<string> | null,
|
||||||
depositID?: null
|
token?: null,
|
||||||
): DepositClosedEventFilter;
|
|
||||||
DepositClosed(
|
|
||||||
seller?: PromiseOrValue<string> | null,
|
|
||||||
depositID?: null
|
|
||||||
): DepositClosedEventFilter;
|
|
||||||
|
|
||||||
"DepositWithdrawn(address,uint256,uint256)"(
|
|
||||||
seller?: PromiseOrValue<string> | null,
|
|
||||||
depositID?: null,
|
|
||||||
amount?: null
|
amount?: null
|
||||||
): DepositWithdrawnEventFilter;
|
): DepositWithdrawnEventFilter;
|
||||||
DepositWithdrawn(
|
DepositWithdrawn(
|
||||||
seller?: PromiseOrValue<string> | null,
|
seller?: PromiseOrValue<string> | null,
|
||||||
depositID?: null,
|
token?: null,
|
||||||
amount?: null
|
amount?: null
|
||||||
): DepositWithdrawnEventFilter;
|
): DepositWithdrawnEventFilter;
|
||||||
|
|
||||||
@ -263,23 +258,23 @@ export interface EventAndErrors extends BaseContract {
|
|||||||
): FundsWithdrawnEventFilter;
|
): FundsWithdrawnEventFilter;
|
||||||
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
||||||
|
|
||||||
"LockAdded(address,bytes32,uint256,uint256)"(
|
"LockAdded(address,uint256,uint256,uint256)"(
|
||||||
buyer?: PromiseOrValue<string> | null,
|
buyer?: PromiseOrValue<string> | null,
|
||||||
lockID?: PromiseOrValue<BytesLike> | null,
|
lockID?: PromiseOrValue<BigNumberish> | null,
|
||||||
depositID?: null,
|
seller?: null,
|
||||||
amount?: null
|
amount?: null
|
||||||
): LockAddedEventFilter;
|
): LockAddedEventFilter;
|
||||||
LockAdded(
|
LockAdded(
|
||||||
buyer?: PromiseOrValue<string> | null,
|
buyer?: PromiseOrValue<string> | null,
|
||||||
lockID?: PromiseOrValue<BytesLike> | null,
|
lockID?: PromiseOrValue<BigNumberish> | null,
|
||||||
depositID?: null,
|
seller?: null,
|
||||||
amount?: null
|
amount?: null
|
||||||
): LockAddedEventFilter;
|
): LockAddedEventFilter;
|
||||||
|
|
||||||
"LockBlocksUpdated(uint256)"(blocks?: null): LockBlocksUpdatedEventFilter;
|
"LockBlocksUpdated(uint256)"(blocks?: null): LockBlocksUpdatedEventFilter;
|
||||||
LockBlocksUpdated(blocks?: null): LockBlocksUpdatedEventFilter;
|
LockBlocksUpdated(blocks?: null): LockBlocksUpdatedEventFilter;
|
||||||
|
|
||||||
"LockReleased(address,bytes32,uint256)"(
|
"LockReleased(address,uint256,uint256)"(
|
||||||
buyer?: PromiseOrValue<string> | null,
|
buyer?: PromiseOrValue<string> | null,
|
||||||
lockId?: null,
|
lockId?: null,
|
||||||
amount?: null
|
amount?: null
|
||||||
@ -290,7 +285,7 @@ export interface EventAndErrors extends BaseContract {
|
|||||||
amount?: null
|
amount?: null
|
||||||
): LockReleasedEventFilter;
|
): LockReleasedEventFilter;
|
||||||
|
|
||||||
"LockReturned(address,bytes32)"(
|
"LockReturned(address,uint256)"(
|
||||||
buyer?: PromiseOrValue<string> | null,
|
buyer?: PromiseOrValue<string> | null,
|
||||||
lockId?: null
|
lockId?: null
|
||||||
): LockReturnedEventFilter;
|
): LockReturnedEventFilter;
|
||||||
@ -310,6 +305,17 @@ export interface EventAndErrors extends BaseContract {
|
|||||||
): RootUpdatedEventFilter;
|
): RootUpdatedEventFilter;
|
||||||
RootUpdated(seller?: null, merkleRoot?: null): 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[])"(
|
"ValidSignersUpdated(address[])"(
|
||||||
signers?: null
|
signers?: null
|
||||||
): ValidSignersUpdatedEventFilter;
|
): ValidSignersUpdatedEventFilter;
|
||||||
|
@ -25,11 +25,21 @@ const _abi = [
|
|||||||
name: "AmountNotAllowed",
|
name: "AmountNotAllowed",
|
||||||
type: "error",
|
type: "error",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
inputs: [],
|
||||||
|
name: "DecOverflow",
|
||||||
|
type: "error",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
inputs: [],
|
inputs: [],
|
||||||
name: "DepositAlreadyExists",
|
name: "DepositAlreadyExists",
|
||||||
type: "error",
|
type: "error",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
inputs: [],
|
||||||
|
name: "EmptyPixTarget",
|
||||||
|
type: "error",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
inputs: [],
|
inputs: [],
|
||||||
name: "InvalidDeposit",
|
name: "InvalidDeposit",
|
||||||
@ -55,6 +65,11 @@ const _abi = [
|
|||||||
name: "LoopOverflow",
|
name: "LoopOverflow",
|
||||||
type: "error",
|
type: "error",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
inputs: [],
|
||||||
|
name: "MaxBalExceeded",
|
||||||
|
type: "error",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
inputs: [],
|
inputs: [],
|
||||||
name: "NoTokens",
|
name: "NoTokens",
|
||||||
@ -70,6 +85,11 @@ const _abi = [
|
|||||||
name: "NotExpired",
|
name: "NotExpired",
|
||||||
type: "error",
|
type: "error",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
inputs: [],
|
||||||
|
name: "NotInitialized",
|
||||||
|
type: "error",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
inputs: [],
|
inputs: [],
|
||||||
name: "OnlySeller",
|
name: "OnlySeller",
|
||||||
@ -118,12 +138,6 @@ const _abi = [
|
|||||||
name: "seller",
|
name: "seller",
|
||||||
type: "address",
|
type: "address",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
indexed: false,
|
|
||||||
internalType: "uint256",
|
|
||||||
name: "depositID",
|
|
||||||
type: "uint256",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "address",
|
internalType: "address",
|
||||||
@ -151,29 +165,10 @@ const _abi = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "uint256",
|
|
||||||
name: "depositID",
|
|
||||||
type: "uint256",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
name: "DepositClosed",
|
|
||||||
type: "event",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
anonymous: false,
|
|
||||||
inputs: [
|
|
||||||
{
|
|
||||||
indexed: true,
|
|
||||||
internalType: "address",
|
internalType: "address",
|
||||||
name: "seller",
|
name: "token",
|
||||||
type: "address",
|
type: "address",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
indexed: false,
|
|
||||||
internalType: "uint256",
|
|
||||||
name: "depositID",
|
|
||||||
type: "uint256",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "uint256",
|
internalType: "uint256",
|
||||||
@ -214,14 +209,14 @@ const _abi = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: true,
|
indexed: true,
|
||||||
internalType: "bytes32",
|
internalType: "uint256",
|
||||||
name: "lockID",
|
name: "lockID",
|
||||||
type: "bytes32",
|
type: "uint256",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "uint256",
|
internalType: "uint256",
|
||||||
name: "depositID",
|
name: "seller",
|
||||||
type: "uint256",
|
type: "uint256",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -258,9 +253,15 @@ const _abi = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "bytes32",
|
internalType: "uint256",
|
||||||
name: "lockId",
|
name: "lockId",
|
||||||
type: "bytes32",
|
type: "uint256",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
indexed: false,
|
||||||
|
internalType: "uint256",
|
||||||
|
name: "amount",
|
||||||
|
type: "uint256",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
@ -283,9 +284,9 @@ const _abi = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "bytes32",
|
internalType: "uint256",
|
||||||
name: "lockId",
|
name: "lockId",
|
||||||
type: "bytes32",
|
type: "uint256",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
name: "LockReturned",
|
name: "LockReturned",
|
||||||
@ -323,6 +324,31 @@ const _abi = [
|
|||||||
name: "RootUpdated",
|
name: "RootUpdated",
|
||||||
type: "event",
|
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,
|
anonymous: false,
|
||||||
inputs: [
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
/* Autogenerated file. Do not edit manually. */
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export { Counters__factory } from "./Counters__factory";
|
|
||||||
export { ReentrancyGuard__factory } from "./ReentrancyGuard__factory";
|
export { ReentrancyGuard__factory } from "./ReentrancyGuard__factory";
|
||||||
|
File diff suppressed because one or more lines are too long
9
src/types/hardhat.d.ts
vendored
9
src/types/hardhat.d.ts
vendored
@ -32,10 +32,6 @@ declare module "hardhat/types/runtime" {
|
|||||||
name: "ERC20",
|
name: "ERC20",
|
||||||
signerOrOptions?: ethers.Signer | FactoryOptions
|
signerOrOptions?: ethers.Signer | FactoryOptions
|
||||||
): Promise<Contracts.ERC20__factory>;
|
): Promise<Contracts.ERC20__factory>;
|
||||||
getContractFactory(
|
|
||||||
name: "Counters",
|
|
||||||
signerOrOptions?: ethers.Signer | FactoryOptions
|
|
||||||
): Promise<Contracts.Counters__factory>;
|
|
||||||
getContractFactory(
|
getContractFactory(
|
||||||
name: "ReentrancyGuard",
|
name: "ReentrancyGuard",
|
||||||
signerOrOptions?: ethers.Signer | FactoryOptions
|
signerOrOptions?: ethers.Signer | FactoryOptions
|
||||||
@ -74,11 +70,6 @@ declare module "hardhat/types/runtime" {
|
|||||||
address: string,
|
address: string,
|
||||||
signer?: ethers.Signer
|
signer?: ethers.Signer
|
||||||
): Promise<Contracts.ERC20>;
|
): Promise<Contracts.ERC20>;
|
||||||
getContractAt(
|
|
||||||
name: "Counters",
|
|
||||||
address: string,
|
|
||||||
signer?: ethers.Signer
|
|
||||||
): Promise<Contracts.Counters>;
|
|
||||||
getContractAt(
|
getContractAt(
|
||||||
name: "ReentrancyGuard",
|
name: "ReentrancyGuard",
|
||||||
address: string,
|
address: string,
|
||||||
|
@ -17,8 +17,6 @@ export type { MockToken } from "./lib/mock/mockToken.sol/MockToken";
|
|||||||
export { MockToken__factory } from "./factories/lib/mock/mockToken.sol/MockToken__factory";
|
export { MockToken__factory } from "./factories/lib/mock/mockToken.sol/MockToken__factory";
|
||||||
export type { ERC20 } from "./lib/tokens/ERC20";
|
export type { ERC20 } from "./lib/tokens/ERC20";
|
||||||
export { ERC20__factory } from "./factories/lib/tokens/ERC20__factory";
|
export { ERC20__factory } from "./factories/lib/tokens/ERC20__factory";
|
||||||
export type { Counters } from "./lib/utils/Counters";
|
|
||||||
export { Counters__factory } from "./factories/lib/utils/Counters__factory";
|
|
||||||
export type { ReentrancyGuard } from "./lib/utils/ReentrancyGuard";
|
export type { ReentrancyGuard } from "./lib/utils/ReentrancyGuard";
|
||||||
export { ReentrancyGuard__factory } from "./factories/lib/utils/ReentrancyGuard__factory";
|
export { ReentrancyGuard__factory } from "./factories/lib/utils/ReentrancyGuard__factory";
|
||||||
export type { P2PIX } from "./p2pix.sol/P2PIX";
|
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: {};
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
/* Autogenerated file. Do not edit manually. */
|
/* Autogenerated file. Do not edit manually. */
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export type { Counters } from "./Counters";
|
|
||||||
export type { ReentrancyGuard } from "./ReentrancyGuard";
|
export type { ReentrancyGuard } from "./ReentrancyGuard";
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -36,8 +36,6 @@ describe("Reputation", () => {
|
|||||||
expect(tx2).to.eq(curve(500));
|
expect(tx2).to.eq(curve(500));
|
||||||
expect(tx3).to.eq(curve(444444));
|
expect(tx3).to.eq(curve(444444));
|
||||||
expect(tx4).to.eq(curve(988700));
|
expect(tx4).to.eq(curve(988700));
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,4 +15,8 @@ export enum P2PixErrors {
|
|||||||
AddressDenied = "AddressDenied",
|
AddressDenied = "AddressDenied",
|
||||||
AmountNotAllowed = "AmountNotAllowed",
|
AmountNotAllowed = "AmountNotAllowed",
|
||||||
LockExpired = "LockExpired",
|
LockExpired = "LockExpired",
|
||||||
|
EmptyPixTarget = "EmptyPixTarget",
|
||||||
|
MaxBalExceeded = "MaxBalExceeded",
|
||||||
|
NotInitialized = "NotInitialized",
|
||||||
|
DecOverflow = "DecOverflow",
|
||||||
}
|
}
|
||||||
|
@ -17,22 +17,25 @@ export interface Deploys {
|
|||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Deposit {
|
// export interface Deposit {
|
||||||
remaining: BigNumber;
|
// remaining: BigNumber;
|
||||||
pixTarget: string;
|
// pixTarget: string;
|
||||||
seller: string;
|
// seller: string;
|
||||||
token: string;
|
// token: string;
|
||||||
valid: boolean;
|
// valid: boolean;
|
||||||
}
|
// }
|
||||||
|
|
||||||
export interface Lock {
|
export interface Lock {
|
||||||
depositID: BigNumber;
|
sellerKey: BigNumber;
|
||||||
|
counter: BigNumber;
|
||||||
relayerPremium: BigNumber;
|
relayerPremium: BigNumber;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
expirationBlock: BigNumber;
|
expirationBlock: BigNumber;
|
||||||
|
pixTarget: BigNumber;
|
||||||
buyerAddress: string;
|
buyerAddress: string;
|
||||||
relayerTarget: string;
|
relayerTarget: string;
|
||||||
relayerAddress: string;
|
relayerAddress: string;
|
||||||
|
token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface P2pixFixture {
|
export interface P2pixFixture {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user