Moved stack allocation from memory to calldata
This commit is contained in:
parent
4281526d77
commit
26a495246e
13
.solcover.js
13
.solcover.js
@ -1,7 +1,18 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
configureYulOptimizer: true,
|
||||||
|
solcOptimizerDetails: {
|
||||||
|
deduplicate: true,
|
||||||
|
cse: true,
|
||||||
|
constantOptimizer: true,
|
||||||
|
peephole: true,
|
||||||
|
jumpdestRemover: true,
|
||||||
|
yul: true,
|
||||||
|
// inliner: false,
|
||||||
|
// orderLiterals: true,
|
||||||
|
},
|
||||||
istanbulReporter: ["html", "lcov"],
|
istanbulReporter: ["html", "lcov"],
|
||||||
providerOptions: {
|
providerOptions: {
|
||||||
mnemonic: process.env.MNEMONIC,
|
mnemonic: process.env.MNEMONIC,
|
||||||
},
|
},
|
||||||
skipFiles: ["test"],
|
skipFiles: ["test", 'core/BaseUtils.sol', 'core/OwnerSettings.sol'],
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../build-info/f220dbc6fa6f1dbf5c2cb562d65f0725.json"
|
"buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -213,9 +213,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "uint256",
|
"internalType": "address",
|
||||||
"name": "seller",
|
"name": "seller",
|
||||||
"type": "uint256"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
@ -529,9 +529,9 @@
|
|||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "address",
|
||||||
"name": "sellerKey",
|
"name": "sellerKey",
|
||||||
"type": "uint256"
|
"type": "address"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "sellerAllowList",
|
"name": "sellerAllowList",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
"contractName": "DataTypes",
|
"contractName": "DataTypes",
|
||||||
"sourceName": "contracts/core/DataTypes.sol",
|
"sourceName": "contracts/core/DataTypes.sol",
|
||||||
"abi": [],
|
"abi": [],
|
||||||
"bytecode": "0x60808060405234601757603a9081601d823930815050f35b600080fdfe600080fdfea2646970667358221220a40e6f94f4c0b9a9cdd9ac64f98613aece8f5a3f084ee1eca35eba466df9810964736f6c63430008130033",
|
"bytecode": "0x60808060405234601757603a9081601d823930815050f35b600080fdfe600080fdfea26469706673582212201904685203adfcebeda9a1444d5381c24a37e2895e8a7dff26bd8d5af2fafcbc64736f6c63430008130033",
|
||||||
"deployedBytecode": "0x600080fdfea2646970667358221220a40e6f94f4c0b9a9cdd9ac64f98613aece8f5a3f084ee1eca35eba466df9810964736f6c63430008130033",
|
"deployedBytecode": "0x600080fdfea26469706673582212201904685203adfcebeda9a1444d5381c24a37e2895e8a7dff26bd8d5af2fafcbc64736f6c63430008130033",
|
||||||
"linkReferences": {},
|
"linkReferences": {},
|
||||||
"deployedLinkReferences": {}
|
"deployedLinkReferences": {}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -203,9 +203,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "uint256",
|
"internalType": "address",
|
||||||
"name": "seller",
|
"name": "seller",
|
||||||
"type": "uint256"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -208,9 +208,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "uint256",
|
"internalType": "address",
|
||||||
"name": "seller",
|
"name": "seller",
|
||||||
"type": "uint256"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
@ -467,9 +467,9 @@
|
|||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "address",
|
||||||
"name": "sellerKey",
|
"name": "sellerKey",
|
||||||
"type": "uint256"
|
"type": "address"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "sellerAllowList",
|
"name": "sellerAllowList",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../../../build-info/cd64a64b3749ac90866585a6471cc921.json"
|
"buildInfo": "../../../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-dbg-1",
|
"_format": "hh-sol-dbg-1",
|
||||||
"buildInfo": "../../build-info/f220dbc6fa6f1dbf5c2cb562d65f0725.json"
|
"buildInfo": "../../build-info/3d12978eb8a70621f317c36179381ad8.json"
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,11 +1,11 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
pragma solidity 0.8.19;
|
pragma solidity 0.8.19;
|
||||||
|
|
||||||
import { ERC20, OwnerSettings } from "./OwnerSettings.sol";
|
import { ERC20, OwnerSettings } from "contracts/core/OwnerSettings.sol";
|
||||||
|
|
||||||
import { ECDSA } from "../lib/utils/ECDSA.sol";
|
import { ECDSA } from "contracts/lib/utils/ECDSA.sol";
|
||||||
import { MerkleProofLib as Merkle } from "../lib/utils/MerkleProofLib.sol";
|
import { MerkleProofLib as Merkle } from "contracts/lib/utils/MerkleProofLib.sol";
|
||||||
import { ReentrancyGuard } from "../lib/utils/ReentrancyGuard.sol";
|
import { ReentrancyGuard } from "contracts/lib/utils/ReentrancyGuard.sol";
|
||||||
|
|
||||||
abstract contract BaseUtils is
|
abstract contract BaseUtils is
|
||||||
OwnerSettings,
|
OwnerSettings,
|
||||||
@ -93,7 +93,7 @@ abstract contract BaseUtils is
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _setSellerBalance(
|
function _setSellerBalance(
|
||||||
uint256 _sellerKey,
|
address _sellerKey,
|
||||||
ERC20 _erc20,
|
ERC20 _erc20,
|
||||||
uint256 _packed,
|
uint256 _packed,
|
||||||
bytes32 _pixTarget
|
bytes32 _pixTarget
|
||||||
@ -101,7 +101,7 @@ abstract contract BaseUtils is
|
|||||||
assembly {
|
assembly {
|
||||||
mstore(0x20, _erc20)
|
mstore(0x20, _erc20)
|
||||||
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
||||||
mstore(0x00, shr(0xc, _sellerKey))
|
mstore(0x00, _sellerKey)
|
||||||
let _loc := keccak256(0x0c, 0x34)
|
let _loc := keccak256(0x0c, 0x34)
|
||||||
sstore(add(_loc, 0x01), _packed)
|
sstore(add(_loc, 0x01), _packed)
|
||||||
sstore(_loc, _pixTarget)
|
sstore(_loc, _pixTarget)
|
||||||
@ -109,55 +109,55 @@ abstract contract BaseUtils is
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _setValidState(
|
function _setValidState(
|
||||||
uint256 _sellerKey,
|
address _sellerKey,
|
||||||
ERC20 _erc20,
|
ERC20 _erc20,
|
||||||
uint256 _packed
|
uint256 _packed
|
||||||
) internal {
|
) internal {
|
||||||
assembly {
|
assembly {
|
||||||
mstore(0x20, _erc20)
|
mstore(0x20, _erc20)
|
||||||
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
||||||
mstore(0x00, shr(0xc, _sellerKey))
|
mstore(0x00, _sellerKey)
|
||||||
let _loc := keccak256(0x0c, 0x34)
|
let _loc := keccak256(0x0c, 0x34)
|
||||||
sstore(add(_loc, 0x01), _packed)
|
sstore(add(_loc, 0x01), _packed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _addSellerBalance(
|
function _addSellerBalance(
|
||||||
uint256 _sellerKey,
|
address _sellerKey,
|
||||||
ERC20 _erc20,
|
ERC20 _erc20,
|
||||||
uint256 _amount
|
uint256 _amount
|
||||||
) internal {
|
) internal {
|
||||||
assembly {
|
assembly {
|
||||||
mstore(0x20, _erc20)
|
mstore(0x20, _erc20)
|
||||||
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
||||||
mstore(0x00, shr(0xc, _sellerKey))
|
mstore(0x00, _sellerKey)
|
||||||
let _loc := add(keccak256(0x0c, 0x34), 0x01)
|
let _loc := add(keccak256(0x0c, 0x34), 0x01)
|
||||||
sstore(_loc, add(sload(_loc), _amount))
|
sstore(_loc, add(sload(_loc), _amount))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _decSellerBalance(
|
function _decSellerBalance(
|
||||||
uint256 _sellerKey,
|
address _sellerKey,
|
||||||
ERC20 _erc20,
|
ERC20 _erc20,
|
||||||
uint256 _amount
|
uint256 _amount
|
||||||
) internal {
|
) internal {
|
||||||
assembly {
|
assembly {
|
||||||
mstore(0x20, _erc20)
|
mstore(0x20, _erc20)
|
||||||
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
||||||
mstore(0x00, shr(0xc, _sellerKey))
|
mstore(0x00, _sellerKey)
|
||||||
let _loc := add(keccak256(0x0c, 0x34), 0x01)
|
let _loc := add(keccak256(0x0c, 0x34), 0x01)
|
||||||
sstore(_loc, sub(sload(_loc), _amount))
|
sstore(_loc, sub(sload(_loc), _amount))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function __sellerBalance(
|
function __sellerBalance(
|
||||||
uint256 _sellerKey,
|
address _sellerKey,
|
||||||
ERC20 _erc20
|
ERC20 _erc20
|
||||||
) internal view returns (uint256 _packed) {
|
) internal view returns (uint256 _packed) {
|
||||||
assembly {
|
assembly {
|
||||||
mstore(0x20, _erc20)
|
mstore(0x20, _erc20)
|
||||||
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
|
||||||
mstore(0x00, shr(0xc, _sellerKey))
|
mstore(0x00, _sellerKey)
|
||||||
_packed := sload(add(keccak256(0x0c, 0x34), 0x01))
|
_packed := sload(add(keccak256(0x0c, 0x34), 0x01))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,33 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
pragma solidity 0.8.19;
|
pragma solidity 0.8.19;
|
||||||
|
|
||||||
|
import { ERC20 } from "contracts/lib/tokens/ERC20.sol";
|
||||||
|
|
||||||
library DataTypes {
|
library DataTypes {
|
||||||
|
struct DepositArgs {
|
||||||
|
string pixTarget;
|
||||||
|
bytes32 allowlistRoot;
|
||||||
|
ERC20 token;
|
||||||
|
uint96 amount;
|
||||||
|
bool valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct LockArgs {
|
||||||
|
address seller;
|
||||||
|
ERC20 token;
|
||||||
|
uint80 amount;
|
||||||
|
bytes32[] merkleProof;
|
||||||
|
uint256[] expiredLocks;
|
||||||
|
}
|
||||||
|
|
||||||
struct Lock {
|
struct Lock {
|
||||||
uint256 sellerKey;
|
|
||||||
uint256 counter;
|
uint256 counter;
|
||||||
uint256 expirationBlock;
|
uint256 expirationBlock;
|
||||||
bytes32 pixTarget;
|
bytes32 pixTarget;
|
||||||
uint80 amount;
|
uint80 amount;
|
||||||
address token;
|
address token;
|
||||||
address buyerAddress;
|
address buyerAddress;
|
||||||
|
address seller;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
|
@ -28,7 +28,7 @@ interface EventAndErrors {
|
|||||||
event LockAdded(
|
event LockAdded(
|
||||||
address indexed buyer,
|
address indexed buyer,
|
||||||
uint256 indexed lockID,
|
uint256 indexed lockID,
|
||||||
uint256 seller,
|
address seller,
|
||||||
uint256 amount
|
uint256 amount
|
||||||
);
|
);
|
||||||
/// @dev 0x364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8
|
/// @dev 0x364537f14276f2a0ce9905588413f96454cbb8fb2e4f5308389307c1098bede8
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
pragma solidity 0.8.19;
|
pragma solidity 0.8.19;
|
||||||
|
|
||||||
import { ERC2771Context as ERC2771 } from "../lib/metatx/ERC2771Context.sol";
|
import { ERC2771Context as ERC2771 } from "contracts/lib/metatx/ERC2771Context.sol";
|
||||||
import { ERC20, SafeTransferLib } from "../lib/utils/SafeTransferLib.sol";
|
import { ERC20, SafeTransferLib } from "contracts/lib/utils/SafeTransferLib.sol";
|
||||||
import { IReputation } from "../lib/interfaces/IReputation.sol";
|
import { IReputation } from "contracts/lib/interfaces/IReputation.sol";
|
||||||
import { EventAndErrors } from "./EventAndErrors.sol";
|
import { EventAndErrors } from "contracts/core/EventAndErrors.sol";
|
||||||
import { Constants } from "./Constants.sol";
|
import { Constants } from "contracts/core/Constants.sol";
|
||||||
import { Owned } from "../lib/auth/Owned.sol";
|
import { Owned } from "contracts/lib/auth/Owned.sol";
|
||||||
|
|
||||||
abstract contract OwnerSettings is
|
abstract contract OwnerSettings is
|
||||||
Constants,
|
Constants,
|
||||||
@ -121,7 +121,7 @@ abstract contract OwnerSettings is
|
|||||||
} iszero(returndatasize()) {
|
} iszero(returndatasize()) {
|
||||||
/* */
|
/* */
|
||||||
} {
|
} {
|
||||||
sstore(shl(12, mload(i)), true)
|
sstore(shl(0xc, mload(i)), true)
|
||||||
i := add(i, 0x20)
|
i := add(i, 0x20)
|
||||||
|
|
||||||
if iszero(lt(i, end)) {
|
if iszero(lt(i, end)) {
|
||||||
@ -187,11 +187,11 @@ abstract contract OwnerSettings is
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sellerAllowList(
|
function sellerAllowList(
|
||||||
uint256 sellerKey
|
address sellerKey
|
||||||
) public view returns (bytes32 root) {
|
) public view returns (bytes32 root) {
|
||||||
assembly {
|
assembly {
|
||||||
mstore(0x0c, _SELLER_ALLOWLIST_SLOT_SEED)
|
mstore(0x0c, _SELLER_ALLOWLIST_SLOT_SEED)
|
||||||
mstore(0x00, shr(12, sellerKey))
|
mstore(0x00, sellerKey)
|
||||||
root := sload(keccak256(0x00, 0x20))
|
root := sload(keccak256(0x00, 0x20))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@ pragma solidity 0.8.19;
|
|||||||
/// |__| |__|
|
/// |__| |__|
|
||||||
///
|
///
|
||||||
|
|
||||||
import { OwnerSettings, ERC20, SafeTransferLib } from "./core/OwnerSettings.sol";
|
import { OwnerSettings, ERC20, SafeTransferLib } from "contracts/core/OwnerSettings.sol";
|
||||||
import { BaseUtils } from "./core/BaseUtils.sol";
|
import { BaseUtils } from "contracts/core/BaseUtils.sol";
|
||||||
import { DataTypes as DT } from "./core/DataTypes.sol";
|
import { DataTypes as DT } from "contracts/core/DataTypes.sol";
|
||||||
|
|
||||||
|
|
||||||
contract P2PIX is BaseUtils {
|
contract P2PIX is BaseUtils {
|
||||||
@ -18,6 +18,8 @@ contract P2PIX is BaseUtils {
|
|||||||
// solhint-disable no-inline-assembly
|
// solhint-disable no-inline-assembly
|
||||||
// solhint-disable no-empty-blocks
|
// solhint-disable no-empty-blocks
|
||||||
|
|
||||||
|
using DT for DT.DepositArgs;
|
||||||
|
using DT for DT.LockArgs;
|
||||||
using DT for DT.Lock;
|
using DT for DT.Lock;
|
||||||
using DT for DT.LockStatus;
|
using DT for DT.LockStatus;
|
||||||
|
|
||||||
@ -53,55 +55,49 @@ contract P2PIX is BaseUtils {
|
|||||||
/// @notice Creates a deposit order based on a seller's
|
/// @notice Creates a deposit order based on a seller's
|
||||||
/// offer of an amount of ERC20 tokens.
|
/// offer of an amount of ERC20 tokens.
|
||||||
/// @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. */
|
||||||
/// as the deposit identifier.
|
/* /// as the deposit identifier. */
|
||||||
/// @dev Function sighash: 0xbfe07da6.
|
/// @dev Function sighash: 0xbfe07da6.
|
||||||
function deposit(
|
function deposit(
|
||||||
address _token,
|
DT.DepositArgs calldata args
|
||||||
uint96 _amount,
|
|
||||||
string memory _pixTarget,
|
|
||||||
bool _valid,
|
|
||||||
bytes32 allowlistRoot
|
|
||||||
) public {
|
) public {
|
||||||
ERC20 t = ERC20(_token);
|
|
||||||
uint256 k = _castAddrToKey(msg.sender);
|
|
||||||
|
|
||||||
if (bytes(_pixTarget).length == 0) revert EmptyPixTarget();
|
if (bytes(args.pixTarget).length == 0) revert EmptyPixTarget();
|
||||||
if (!allowedERC20s(t)) revert TokenDenied();
|
if (!allowedERC20s(args.token)) revert TokenDenied();
|
||||||
uint256 _sellerBalance = __sellerBalance(k,t);
|
uint256 _sellerBalance = __sellerBalance(msg.sender, args.token);
|
||||||
|
|
||||||
uint256 currBal = _sellerBalance & BITMASK_SB_ENTRY;
|
uint256 currBal = _sellerBalance & BITMASK_SB_ENTRY;
|
||||||
uint256 _newBal = uint256(currBal + _amount);
|
uint256 _newBal = uint256(currBal + args.amount);
|
||||||
if (_newBal > MAXBALANCE_UPPERBOUND)
|
if (_newBal > MAXBALANCE_UPPERBOUND)
|
||||||
revert MaxBalExceeded();
|
revert MaxBalExceeded();
|
||||||
|
|
||||||
setReentrancyGuard();
|
setReentrancyGuard();
|
||||||
|
|
||||||
if (allowlistRoot != 0) {
|
if (args.allowlistRoot != 0) {
|
||||||
setRoot(msg.sender, allowlistRoot);
|
setRoot(msg.sender, args.allowlistRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes32 pixTargetCasted = getStr(_pixTarget);
|
bytes32 pixTargetCasted = getStr(args.pixTarget);
|
||||||
uint256 validCasted = _castBool(_valid);
|
uint256 validCasted = _castBool(args.valid);
|
||||||
|
|
||||||
_setSellerBalance(
|
_setSellerBalance(
|
||||||
k,
|
msg.sender,
|
||||||
t,
|
args.token,
|
||||||
(_newBal | (validCasted << BITPOS_VALID)),
|
(_newBal | (validCasted << BITPOS_VALID)),
|
||||||
pixTargetCasted
|
pixTargetCasted
|
||||||
);
|
);
|
||||||
|
|
||||||
SafeTransferLib.safeTransferFrom(
|
SafeTransferLib.safeTransferFrom(
|
||||||
t,
|
args.token,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
address(this),
|
address(this),
|
||||||
_amount
|
args.amount
|
||||||
);
|
);
|
||||||
|
|
||||||
clearReentrancyGuard();
|
clearReentrancyGuard();
|
||||||
|
|
||||||
emit DepositAdded(msg.sender, _token, _amount);
|
emit DepositAdded(msg.sender, address(args.token), args.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Enables seller to invalidate future
|
/// @notice Enables seller to invalidate future
|
||||||
@ -109,8 +105,7 @@ contract P2PIX is BaseUtils {
|
|||||||
/// @dev This function does not affect any ongoing active locks.
|
/// @dev This function does not affect any ongoing active locks.
|
||||||
/// @dev Function sighash: 0x72fada5c.
|
/// @dev Function sighash: 0x72fada5c.
|
||||||
function setValidState(ERC20 token, bool state) public {
|
function setValidState(ERC20 token, bool state) public {
|
||||||
uint256 key = _castAddrToKey(msg.sender);
|
uint256 _sellerBalance = __sellerBalance(msg.sender, token);
|
||||||
uint256 _sellerBalance = __sellerBalance(key, token);
|
|
||||||
|
|
||||||
if (_sellerBalance != 0) {
|
if (_sellerBalance != 0) {
|
||||||
uint256 _valid = _castBool(state);
|
uint256 _valid = _castBool(state);
|
||||||
@ -119,7 +114,7 @@ contract P2PIX is BaseUtils {
|
|||||||
(_sellerBalance & BITMASK_SB_ENTRY) |
|
(_sellerBalance & BITMASK_SB_ENTRY) |
|
||||||
(_valid << BITPOS_VALID);
|
(_valid << BITPOS_VALID);
|
||||||
|
|
||||||
_setValidState(key, token, _sellerBalance);
|
_setValidState(msg.sender, token, _sellerBalance);
|
||||||
|
|
||||||
emit ValidSet(msg.sender, address(token), state);
|
emit ValidSet(msg.sender, address(token), state);
|
||||||
} else revert NotInitialized();
|
} else revert NotInitialized();
|
||||||
@ -127,78 +122,73 @@ contract P2PIX is BaseUtils {
|
|||||||
|
|
||||||
/// @notice Public method designed to lock an remaining amount of
|
/// @notice Public method designed to lock an remaining amount of
|
||||||
/// the deposit order of a seller.
|
/// the deposit order of a seller.
|
||||||
|
/// @dev Transaction forwarding must leave `merkleProof` empty;
|
||||||
|
/// otherwise, the trustedForwarder must be previously added
|
||||||
|
/// to a seller whitelist.
|
||||||
/// @dev This method can be performed either by:
|
/// @dev This method can be performed either by:
|
||||||
/// - An user allowed via the seller's allowlist;
|
/// - An user allowed via the seller's allowlist;
|
||||||
/// - An user with enough userRecord to lock the wished amount;
|
/// - An user with enough userRecord to lock the wished amount;
|
||||||
/// @dev There can only exist a lock per each `_amount` partitioned
|
/// @dev There can only exist a lock per each `_amount` partitioned
|
||||||
/// from the total `remaining` value.
|
/// from the total `remaining` value.
|
||||||
/// @dev Locks can only be performed in valid orders.
|
/// @dev Locks can only be performed in valid orders.
|
||||||
/// @param _amount The deposit's remaining amount wished to be locked.
|
/* /// @param _amount The deposit's remaining amount wished to be locked. */
|
||||||
/// @param merkleProof This value should be:
|
/* /// @param merkleProof This value should be: */
|
||||||
/// - Provided as a pass if the `msg.sender` is in the seller's allowlist;
|
/* /// - Provided as a pass if the `msg.sender` is in the seller's allowlist; */
|
||||||
/// - Left empty otherwise;
|
/* /// - Left empty otherwise; */
|
||||||
/// @param expiredLocks An array of `bytes32` identifiers to be
|
/* /// @param expiredLocks An array of `bytes32` identifiers to be */
|
||||||
/// provided so to unexpire locks using this transaction gas push.
|
/* /// provided so to unexpire locks using this transaction gas push. */
|
||||||
/// @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(
|
||||||
address _seller,
|
DT.LockArgs calldata args
|
||||||
address _token,
|
|
||||||
uint80 _amount,
|
|
||||||
bytes32[] calldata merkleProof,
|
|
||||||
uint256[] calldata expiredLocks
|
|
||||||
) public nonReentrant returns (uint256 lockID) {
|
) public nonReentrant returns (uint256 lockID) {
|
||||||
unlockExpired(expiredLocks);
|
unlockExpired(args.expiredLocks);
|
||||||
|
|
||||||
ERC20 t = ERC20(_token);
|
if (!getValid(args.seller, args.token)) revert InvalidDeposit();
|
||||||
if (!getValid(_seller, t)) revert InvalidDeposit();
|
|
||||||
|
|
||||||
uint256 bal = getBalance(_seller, t);
|
uint256 bal = getBalance(args.seller, args.token);
|
||||||
if (bal < _amount) revert NotEnoughTokens();
|
if (bal < args.amount) revert NotEnoughTokens();
|
||||||
|
|
||||||
uint256 k = _castAddrToKey(_seller);
|
uint256 c = lockCounter + 1;
|
||||||
|
|
||||||
uint256 cCounter = lockCounter + 1;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
mapLocks[cCounter].expirationBlock >= block.number
|
mapLocks[c].expirationBlock >= block.number
|
||||||
) revert NotExpired();
|
) revert NotExpired();
|
||||||
|
|
||||||
address sender; uint256 forwarder;
|
address sender; uint256 forwarder;
|
||||||
(sender, forwarder) = _isTrustedForwarder();
|
(sender, forwarder) = _isTrustedForwarder();
|
||||||
|
bytes32 _pixTarget = getPixTarget(args.seller, args.token);
|
||||||
|
|
||||||
DT.Lock memory l = DT.Lock(
|
DT.Lock memory l = DT.Lock(
|
||||||
k,
|
c,
|
||||||
cCounter,
|
|
||||||
(block.number + defaultLockBlocks),
|
(block.number + defaultLockBlocks),
|
||||||
getPixTarget(_seller, t),
|
_pixTarget,
|
||||||
_amount,
|
args.amount,
|
||||||
address(t),
|
address(args.token),
|
||||||
sender
|
sender,
|
||||||
|
args.seller
|
||||||
);
|
);
|
||||||
|
|
||||||
// transaction forwarding must leave `merkleProof` empty;
|
if (args.merkleProof.length != 0) {
|
||||||
// otherwise, the trustedForwarder must be previously added
|
_merkleVerify(args.merkleProof, sellerAllowList(args.seller), sender);
|
||||||
// to a seller whitelist.
|
lockID = _addLock(bal, l);
|
||||||
if (merkleProof.length != 0) {
|
|
||||||
_merkleVerify(merkleProof, sellerAllowList(k), sender);
|
|
||||||
lockID = _addLock(bal, _amount, cCounter, l, t, k);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (l.amount <= REPUTATION_LOWERBOUND) {
|
if (l.amount <= REPUTATION_LOWERBOUND) {
|
||||||
lockID = _addLock(bal, _amount, cCounter, l, t, k);
|
lockID = _addLock(bal, l);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (forwarder != 0) {
|
if (forwarder != 0) {
|
||||||
lockID = _addLock(bal, _amount, cCounter, l, t, k);
|
lockID = _addLock(bal, l);
|
||||||
} else {
|
} else {
|
||||||
uint256 userCredit = userRecord[_castAddrToKey(msg.sender)];
|
uint256 spendLimit; uint256 userCredit =
|
||||||
uint256 spendLimit; (spendLimit) = _limiter(userCredit / WAD);
|
userRecord[_castAddrToKey(msg.sender)];
|
||||||
|
(spendLimit) = _limiter(userCredit / WAD);
|
||||||
if (
|
if (
|
||||||
l.amount > (spendLimit * WAD) ||
|
l.amount > (spendLimit * WAD) ||
|
||||||
l.amount > LOCKAMOUNT_UPPERBOUND
|
l.amount > LOCKAMOUNT_UPPERBOUND
|
||||||
) revert AmountNotAllowed();
|
) revert AmountNotAllowed();
|
||||||
lockID = _addLock(bal, _amount, cCounter, l, t, k);
|
lockID = _addLock(bal, l);
|
||||||
|
|
||||||
/* */}/* */}/* */}
|
/* */}/* */}/* */}
|
||||||
}
|
}
|
||||||
@ -285,12 +275,12 @@ contract P2PIX is BaseUtils {
|
|||||||
_notExpired(l);
|
_notExpired(l);
|
||||||
|
|
||||||
uint256 _sellerBalance =
|
uint256 _sellerBalance =
|
||||||
__sellerBalance(l.sellerKey, ERC20(l.token)) & BITMASK_SB_ENTRY;
|
__sellerBalance(l.seller, ERC20(l.token)) & BITMASK_SB_ENTRY;
|
||||||
|
|
||||||
if ((_sellerBalance + l.amount) > MAXBALANCE_UPPERBOUND)
|
if ((_sellerBalance + l.amount) > MAXBALANCE_UPPERBOUND)
|
||||||
revert MaxBalExceeded();
|
revert MaxBalExceeded();
|
||||||
|
|
||||||
_addSellerBalance(l.sellerKey, ERC20(l.token), l.amount);
|
_addSellerBalance(l.seller, ERC20(l.token), l.amount);
|
||||||
|
|
||||||
l.amount = 0;
|
l.amount = 0;
|
||||||
|
|
||||||
@ -335,12 +325,11 @@ contract P2PIX is BaseUtils {
|
|||||||
if (getValid(msg.sender, token))
|
if (getValid(msg.sender, token))
|
||||||
setValidState(token, false);
|
setValidState(token, false);
|
||||||
|
|
||||||
uint256 key = _castAddrToKey(msg.sender);
|
|
||||||
_decBal(
|
_decBal(
|
||||||
(__sellerBalance(key, token) & BITMASK_SB_ENTRY),
|
(__sellerBalance(msg.sender, token) & BITMASK_SB_ENTRY),
|
||||||
amount,
|
amount,
|
||||||
token,
|
token,
|
||||||
key
|
msg.sender
|
||||||
);
|
);
|
||||||
|
|
||||||
// safeTransfer tokens to seller
|
// safeTransfer tokens to seller
|
||||||
@ -400,22 +389,18 @@ contract P2PIX is BaseUtils {
|
|||||||
|
|
||||||
function _addLock(
|
function _addLock(
|
||||||
uint256 _bal,
|
uint256 _bal,
|
||||||
uint256 _amount,
|
DT.Lock memory _l
|
||||||
uint256 _lockID,
|
|
||||||
DT.Lock memory _l,
|
|
||||||
ERC20 _t,
|
|
||||||
uint256 _k
|
|
||||||
) internal returns(uint256 counter){
|
) internal returns(uint256 counter){
|
||||||
mapLocks[_lockID] = _l;
|
mapLocks[_l.counter] = _l;
|
||||||
|
|
||||||
_decBal(_bal, _amount, _t, _k);
|
_decBal(_bal, _l.amount, ERC20(_l.token), _l.seller);
|
||||||
++lockCounter;
|
++lockCounter;
|
||||||
counter = _lockID;
|
counter = _l.counter;
|
||||||
|
|
||||||
emit LockAdded(
|
emit LockAdded(
|
||||||
_l.buyerAddress,
|
_l.buyerAddress,
|
||||||
_lockID,
|
_l.counter,
|
||||||
_l.sellerKey,
|
_l.seller,
|
||||||
_l.amount
|
_l.amount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -424,7 +409,7 @@ contract P2PIX is BaseUtils {
|
|||||||
uint256 _bal,
|
uint256 _bal,
|
||||||
uint256 _amount,
|
uint256 _amount,
|
||||||
ERC20 _t,
|
ERC20 _t,
|
||||||
uint256 _k
|
address _k
|
||||||
) private {
|
) private {
|
||||||
assembly {
|
assembly {
|
||||||
if iszero(
|
if iszero(
|
||||||
@ -561,7 +546,7 @@ contract P2PIX is BaseUtils {
|
|||||||
);
|
);
|
||||||
unchecked {
|
unchecked {
|
||||||
for (c; c < len; ) {
|
for (c; c < len; ) {
|
||||||
if (mapLocks[ids[c]].sellerKey == 0x0) {
|
if (mapLocks[ids[c]].seller == address(0)) {
|
||||||
sortedIDs[c] = ids[c];
|
sortedIDs[c] = ids[c];
|
||||||
status[c] = type(DT.LockStatus).min;
|
status[c] = type(DT.LockStatus).min;
|
||||||
++c;
|
++c;
|
||||||
|
@ -5,7 +5,7 @@ import * as fs from "fs";
|
|||||||
import { ethers, network } from "hardhat";
|
import { ethers, network } from "hardhat";
|
||||||
import hre from "hardhat";
|
import hre from "hardhat";
|
||||||
|
|
||||||
import { Deploys } from "../test/utils/fixtures";
|
import { Deploys } from "../test/utils/interfaces";
|
||||||
|
|
||||||
let deploysJson: Deploys;
|
let deploysJson: Deploys;
|
||||||
const supply: BigNumber = ethers.utils.parseEther("20000000");
|
const supply: BigNumber = ethers.utils.parseEther("20000000");
|
||||||
|
@ -4,7 +4,7 @@ import * as fs from "fs";
|
|||||||
import { ethers, network } from "hardhat";
|
import { ethers, network } from "hardhat";
|
||||||
import hre from "hardhat";
|
import hre from "hardhat";
|
||||||
|
|
||||||
import { Deploys } from "../test/utils/fixtures";
|
import { Deploys } from "../test/utils/interfaces";
|
||||||
|
|
||||||
let deploysJson: Deploys;
|
let deploysJson: Deploys;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import "@nomiclabs/hardhat-ethers";
|
|||||||
import "@nomiclabs/hardhat-etherscan";
|
import "@nomiclabs/hardhat-etherscan";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { ethers, network } from "hardhat";
|
import { ethers, network } from "hardhat";
|
||||||
import { Deploys } from "../test/utils/fixtures";
|
import { Deploys } from "../test/utils/interfaces";
|
||||||
import { P2PIX__factory } from "../src/types";
|
import { P2PIX__factory } from "../src/types";
|
||||||
|
|
||||||
let deploysJson: Deploys;
|
let deploysJson: Deploys;
|
||||||
|
@ -37,7 +37,7 @@ export interface BaseUtilsInterface extends utils.Interface {
|
|||||||
"isTrustedForwarder(address)": FunctionFragment;
|
"isTrustedForwarder(address)": FunctionFragment;
|
||||||
"owner()": FunctionFragment;
|
"owner()": FunctionFragment;
|
||||||
"reputation()": FunctionFragment;
|
"reputation()": FunctionFragment;
|
||||||
"sellerAllowList(uint256)": FunctionFragment;
|
"sellerAllowList(address)": FunctionFragment;
|
||||||
"setDefaultLockBlocks(uint256)": FunctionFragment;
|
"setDefaultLockBlocks(uint256)": FunctionFragment;
|
||||||
"setOwner(address)": FunctionFragment;
|
"setOwner(address)": FunctionFragment;
|
||||||
"setReputation(address)": FunctionFragment;
|
"setReputation(address)": FunctionFragment;
|
||||||
@ -102,7 +102,7 @@ export interface BaseUtilsInterface extends utils.Interface {
|
|||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "sellerAllowList",
|
functionFragment: "sellerAllowList",
|
||||||
values: [PromiseOrValue<BigNumberish>]
|
values: [PromiseOrValue<string>]
|
||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "setDefaultLockBlocks",
|
functionFragment: "setDefaultLockBlocks",
|
||||||
@ -207,7 +207,7 @@ export interface BaseUtilsInterface extends utils.Interface {
|
|||||||
"DepositAdded(address,address,uint256)": EventFragment;
|
"DepositAdded(address,address,uint256)": EventFragment;
|
||||||
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
||||||
"FundsWithdrawn(address,uint256)": EventFragment;
|
"FundsWithdrawn(address,uint256)": EventFragment;
|
||||||
"LockAdded(address,uint256,uint256,uint256)": EventFragment;
|
"LockAdded(address,uint256,address,uint256)": EventFragment;
|
||||||
"LockBlocksUpdated(uint256)": EventFragment;
|
"LockBlocksUpdated(uint256)": EventFragment;
|
||||||
"LockReleased(address,uint256,uint256)": EventFragment;
|
"LockReleased(address,uint256,uint256)": EventFragment;
|
||||||
"LockReturned(address,uint256)": EventFragment;
|
"LockReturned(address,uint256)": EventFragment;
|
||||||
@ -286,11 +286,11 @@ export type FundsWithdrawnEventFilter = TypedEventFilter<FundsWithdrawnEvent>;
|
|||||||
export interface LockAddedEventObject {
|
export interface LockAddedEventObject {
|
||||||
buyer: string;
|
buyer: string;
|
||||||
lockID: BigNumber;
|
lockID: BigNumber;
|
||||||
seller: BigNumber;
|
seller: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
}
|
}
|
||||||
export type LockAddedEvent = TypedEvent<
|
export type LockAddedEvent = TypedEvent<
|
||||||
[string, BigNumber, BigNumber, BigNumber],
|
[string, BigNumber, string, BigNumber],
|
||||||
LockAddedEventObject
|
LockAddedEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ export interface BaseUtils extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<[string]>;
|
reputation(overrides?: CallOverrides): Promise<[string]>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<[string] & { root: string }>;
|
): Promise<[string] & { root: string }>;
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ export interface BaseUtils extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<string>;
|
reputation(overrides?: CallOverrides): Promise<string>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ export interface BaseUtils extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<string>;
|
reputation(overrides?: CallOverrides): Promise<string>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
@ -710,7 +710,7 @@ export interface BaseUtils extends BaseContract {
|
|||||||
): FundsWithdrawnEventFilter;
|
): FundsWithdrawnEventFilter;
|
||||||
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
||||||
|
|
||||||
"LockAdded(address,uint256,uint256,uint256)"(
|
"LockAdded(address,uint256,address,uint256)"(
|
||||||
buyer?: PromiseOrValue<string> | null,
|
buyer?: PromiseOrValue<string> | null,
|
||||||
lockID?: PromiseOrValue<BigNumberish> | null,
|
lockID?: PromiseOrValue<BigNumberish> | null,
|
||||||
seller?: null,
|
seller?: null,
|
||||||
@ -828,7 +828,7 @@ export interface BaseUtils extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<BigNumber>;
|
reputation(overrides?: CallOverrides): Promise<BigNumber>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<BigNumber>;
|
): Promise<BigNumber>;
|
||||||
|
|
||||||
@ -912,7 +912,7 @@ export interface BaseUtils extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
reputation(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<PopulatedTransaction>;
|
): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export interface EventAndErrorsInterface extends utils.Interface {
|
|||||||
"DepositAdded(address,address,uint256)": EventFragment;
|
"DepositAdded(address,address,uint256)": EventFragment;
|
||||||
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
||||||
"FundsWithdrawn(address,uint256)": EventFragment;
|
"FundsWithdrawn(address,uint256)": EventFragment;
|
||||||
"LockAdded(address,uint256,uint256,uint256)": EventFragment;
|
"LockAdded(address,uint256,address,uint256)": EventFragment;
|
||||||
"LockBlocksUpdated(uint256)": EventFragment;
|
"LockBlocksUpdated(uint256)": EventFragment;
|
||||||
"LockReleased(address,uint256,uint256)": EventFragment;
|
"LockReleased(address,uint256,uint256)": EventFragment;
|
||||||
"LockReturned(address,uint256)": EventFragment;
|
"LockReturned(address,uint256)": EventFragment;
|
||||||
@ -104,11 +104,11 @@ export type FundsWithdrawnEventFilter = TypedEventFilter<FundsWithdrawnEvent>;
|
|||||||
export interface LockAddedEventObject {
|
export interface LockAddedEventObject {
|
||||||
buyer: string;
|
buyer: string;
|
||||||
lockID: BigNumber;
|
lockID: BigNumber;
|
||||||
seller: BigNumber;
|
seller: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
}
|
}
|
||||||
export type LockAddedEvent = TypedEvent<
|
export type LockAddedEvent = TypedEvent<
|
||||||
[string, BigNumber, BigNumber, BigNumber],
|
[string, BigNumber, string, BigNumber],
|
||||||
LockAddedEventObject
|
LockAddedEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ export interface EventAndErrors extends BaseContract {
|
|||||||
): FundsWithdrawnEventFilter;
|
): FundsWithdrawnEventFilter;
|
||||||
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
||||||
|
|
||||||
"LockAdded(address,uint256,uint256,uint256)"(
|
"LockAdded(address,uint256,address,uint256)"(
|
||||||
buyer?: PromiseOrValue<string> | null,
|
buyer?: PromiseOrValue<string> | null,
|
||||||
lockID?: PromiseOrValue<BigNumberish> | null,
|
lockID?: PromiseOrValue<BigNumberish> | null,
|
||||||
seller?: null,
|
seller?: null,
|
||||||
|
@ -34,7 +34,7 @@ export interface OwnerSettingsInterface extends utils.Interface {
|
|||||||
"isTrustedForwarder(address)": FunctionFragment;
|
"isTrustedForwarder(address)": FunctionFragment;
|
||||||
"owner()": FunctionFragment;
|
"owner()": FunctionFragment;
|
||||||
"reputation()": FunctionFragment;
|
"reputation()": FunctionFragment;
|
||||||
"sellerAllowList(uint256)": FunctionFragment;
|
"sellerAllowList(address)": FunctionFragment;
|
||||||
"setDefaultLockBlocks(uint256)": FunctionFragment;
|
"setDefaultLockBlocks(uint256)": FunctionFragment;
|
||||||
"setOwner(address)": FunctionFragment;
|
"setOwner(address)": FunctionFragment;
|
||||||
"setReputation(address)": FunctionFragment;
|
"setReputation(address)": FunctionFragment;
|
||||||
@ -82,7 +82,7 @@ export interface OwnerSettingsInterface extends utils.Interface {
|
|||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "sellerAllowList",
|
functionFragment: "sellerAllowList",
|
||||||
values: [PromiseOrValue<BigNumberish>]
|
values: [PromiseOrValue<string>]
|
||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "setDefaultLockBlocks",
|
functionFragment: "setDefaultLockBlocks",
|
||||||
@ -170,7 +170,7 @@ export interface OwnerSettingsInterface extends utils.Interface {
|
|||||||
"DepositAdded(address,address,uint256)": EventFragment;
|
"DepositAdded(address,address,uint256)": EventFragment;
|
||||||
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
||||||
"FundsWithdrawn(address,uint256)": EventFragment;
|
"FundsWithdrawn(address,uint256)": EventFragment;
|
||||||
"LockAdded(address,uint256,uint256,uint256)": EventFragment;
|
"LockAdded(address,uint256,address,uint256)": EventFragment;
|
||||||
"LockBlocksUpdated(uint256)": EventFragment;
|
"LockBlocksUpdated(uint256)": EventFragment;
|
||||||
"LockReleased(address,uint256,uint256)": EventFragment;
|
"LockReleased(address,uint256,uint256)": EventFragment;
|
||||||
"LockReturned(address,uint256)": EventFragment;
|
"LockReturned(address,uint256)": EventFragment;
|
||||||
@ -249,11 +249,11 @@ export type FundsWithdrawnEventFilter = TypedEventFilter<FundsWithdrawnEvent>;
|
|||||||
export interface LockAddedEventObject {
|
export interface LockAddedEventObject {
|
||||||
buyer: string;
|
buyer: string;
|
||||||
lockID: BigNumber;
|
lockID: BigNumber;
|
||||||
seller: BigNumber;
|
seller: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
}
|
}
|
||||||
export type LockAddedEvent = TypedEvent<
|
export type LockAddedEvent = TypedEvent<
|
||||||
[string, BigNumber, BigNumber, BigNumber],
|
[string, BigNumber, string, BigNumber],
|
||||||
LockAddedEventObject
|
LockAddedEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ export interface OwnerSettings extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<[string]>;
|
reputation(overrides?: CallOverrides): Promise<[string]>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<[string] & { root: string }>;
|
): Promise<[string] & { root: string }>;
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ export interface OwnerSettings extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<string>;
|
reputation(overrides?: CallOverrides): Promise<string>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
@ -531,7 +531,7 @@ export interface OwnerSettings extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<string>;
|
reputation(overrides?: CallOverrides): Promise<string>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
@ -613,7 +613,7 @@ export interface OwnerSettings extends BaseContract {
|
|||||||
): FundsWithdrawnEventFilter;
|
): FundsWithdrawnEventFilter;
|
||||||
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
||||||
|
|
||||||
"LockAdded(address,uint256,uint256,uint256)"(
|
"LockAdded(address,uint256,address,uint256)"(
|
||||||
buyer?: PromiseOrValue<string> | null,
|
buyer?: PromiseOrValue<string> | null,
|
||||||
lockID?: PromiseOrValue<BigNumberish> | null,
|
lockID?: PromiseOrValue<BigNumberish> | null,
|
||||||
seller?: null,
|
seller?: null,
|
||||||
@ -716,7 +716,7 @@ export interface OwnerSettings extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<BigNumber>;
|
reputation(overrides?: CallOverrides): Promise<BigNumber>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<BigNumber>;
|
): Promise<BigNumber>;
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ export interface OwnerSettings extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
reputation(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<PopulatedTransaction>;
|
): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
|
@ -217,9 +217,9 @@ const _abi = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "uint256",
|
internalType: "address",
|
||||||
name: "seller",
|
name: "seller",
|
||||||
type: "uint256",
|
type: "address",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
@ -533,9 +533,9 @@ const _abi = [
|
|||||||
{
|
{
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
internalType: "uint256",
|
internalType: "address",
|
||||||
name: "sellerKey",
|
name: "sellerKey",
|
||||||
type: "uint256",
|
type: "address",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
name: "sellerAllowList",
|
name: "sellerAllowList",
|
||||||
|
@ -210,9 +210,9 @@ const _abi = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "uint256",
|
internalType: "address",
|
||||||
name: "seller",
|
name: "seller",
|
||||||
type: "uint256",
|
type: "address",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
|
@ -215,9 +215,9 @@ const _abi = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
internalType: "uint256",
|
internalType: "address",
|
||||||
name: "seller",
|
name: "seller",
|
||||||
type: "uint256",
|
type: "address",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
indexed: false,
|
indexed: false,
|
||||||
@ -474,9 +474,9 @@ const _abi = [
|
|||||||
{
|
{
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
internalType: "uint256",
|
internalType: "address",
|
||||||
name: "sellerKey",
|
name: "sellerKey",
|
||||||
type: "uint256",
|
type: "address",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
name: "sellerAllowList",
|
name: "sellerAllowList",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -27,13 +27,59 @@ import type {
|
|||||||
PromiseOrValue,
|
PromiseOrValue,
|
||||||
} from "../common";
|
} from "../common";
|
||||||
|
|
||||||
|
export declare namespace DataTypes {
|
||||||
|
export type DepositArgsStruct = {
|
||||||
|
pixTarget: PromiseOrValue<string>;
|
||||||
|
allowlistRoot: PromiseOrValue<BytesLike>;
|
||||||
|
token: PromiseOrValue<string>;
|
||||||
|
amount: PromiseOrValue<BigNumberish>;
|
||||||
|
valid: PromiseOrValue<boolean>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DepositArgsStructOutput = [
|
||||||
|
string,
|
||||||
|
string,
|
||||||
|
string,
|
||||||
|
BigNumber,
|
||||||
|
boolean
|
||||||
|
] & {
|
||||||
|
pixTarget: string;
|
||||||
|
allowlistRoot: string;
|
||||||
|
token: string;
|
||||||
|
amount: BigNumber;
|
||||||
|
valid: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LockArgsStruct = {
|
||||||
|
seller: PromiseOrValue<string>;
|
||||||
|
token: PromiseOrValue<string>;
|
||||||
|
amount: PromiseOrValue<BigNumberish>;
|
||||||
|
merkleProof: PromiseOrValue<BytesLike>[];
|
||||||
|
expiredLocks: PromiseOrValue<BigNumberish>[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LockArgsStructOutput = [
|
||||||
|
string,
|
||||||
|
string,
|
||||||
|
BigNumber,
|
||||||
|
string[],
|
||||||
|
BigNumber[]
|
||||||
|
] & {
|
||||||
|
seller: string;
|
||||||
|
token: string;
|
||||||
|
amount: BigNumber;
|
||||||
|
merkleProof: string[];
|
||||||
|
expiredLocks: BigNumber[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface P2PIXInterface extends utils.Interface {
|
export interface P2PIXInterface extends utils.Interface {
|
||||||
functions: {
|
functions: {
|
||||||
"_castAddrToKey(address)": FunctionFragment;
|
"_castAddrToKey(address)": FunctionFragment;
|
||||||
"_castKeyToAddr(uint256)": FunctionFragment;
|
"_castKeyToAddr(uint256)": FunctionFragment;
|
||||||
"allowedERC20s(address)": FunctionFragment;
|
"allowedERC20s(address)": FunctionFragment;
|
||||||
"defaultLockBlocks()": FunctionFragment;
|
"defaultLockBlocks()": FunctionFragment;
|
||||||
"deposit(address,uint96,string,bool,bytes32)": FunctionFragment;
|
"deposit((string,bytes32,address,uint96,bool))": FunctionFragment;
|
||||||
"getBalance(address,address)": FunctionFragment;
|
"getBalance(address,address)": FunctionFragment;
|
||||||
"getBalances(address[],address)": FunctionFragment;
|
"getBalances(address[],address)": FunctionFragment;
|
||||||
"getLocksStatus(uint256[])": FunctionFragment;
|
"getLocksStatus(uint256[])": FunctionFragment;
|
||||||
@ -42,13 +88,13 @@ export interface P2PIXInterface extends utils.Interface {
|
|||||||
"getStr(string)": FunctionFragment;
|
"getStr(string)": FunctionFragment;
|
||||||
"getValid(address,address)": FunctionFragment;
|
"getValid(address,address)": FunctionFragment;
|
||||||
"isTrustedForwarder(address)": FunctionFragment;
|
"isTrustedForwarder(address)": FunctionFragment;
|
||||||
"lock(address,address,uint80,bytes32[],uint256[])": FunctionFragment;
|
"lock((address,address,uint80,bytes32[],uint256[]))": FunctionFragment;
|
||||||
"lockCounter()": FunctionFragment;
|
"lockCounter()": FunctionFragment;
|
||||||
"mapLocks(uint256)": FunctionFragment;
|
"mapLocks(uint256)": FunctionFragment;
|
||||||
"owner()": FunctionFragment;
|
"owner()": FunctionFragment;
|
||||||
"release(uint256,bytes32,bytes32,bytes32,uint8)": FunctionFragment;
|
"release(uint256,bytes32,bytes32,bytes32,uint8)": FunctionFragment;
|
||||||
"reputation()": FunctionFragment;
|
"reputation()": FunctionFragment;
|
||||||
"sellerAllowList(uint256)": FunctionFragment;
|
"sellerAllowList(address)": FunctionFragment;
|
||||||
"setDefaultLockBlocks(uint256)": FunctionFragment;
|
"setDefaultLockBlocks(uint256)": FunctionFragment;
|
||||||
"setOwner(address)": FunctionFragment;
|
"setOwner(address)": FunctionFragment;
|
||||||
"setReputation(address)": FunctionFragment;
|
"setReputation(address)": FunctionFragment;
|
||||||
@ -121,13 +167,7 @@ export interface P2PIXInterface extends utils.Interface {
|
|||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "deposit",
|
functionFragment: "deposit",
|
||||||
values: [
|
values: [DataTypes.DepositArgsStruct]
|
||||||
PromiseOrValue<string>,
|
|
||||||
PromiseOrValue<BigNumberish>,
|
|
||||||
PromiseOrValue<string>,
|
|
||||||
PromiseOrValue<boolean>,
|
|
||||||
PromiseOrValue<BytesLike>
|
|
||||||
]
|
|
||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "getBalance",
|
functionFragment: "getBalance",
|
||||||
@ -163,13 +203,7 @@ export interface P2PIXInterface extends utils.Interface {
|
|||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "lock",
|
functionFragment: "lock",
|
||||||
values: [
|
values: [DataTypes.LockArgsStruct]
|
||||||
PromiseOrValue<string>,
|
|
||||||
PromiseOrValue<string>,
|
|
||||||
PromiseOrValue<BigNumberish>,
|
|
||||||
PromiseOrValue<BytesLike>[],
|
|
||||||
PromiseOrValue<BigNumberish>[]
|
|
||||||
]
|
|
||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "lockCounter",
|
functionFragment: "lockCounter",
|
||||||
@ -196,7 +230,7 @@ export interface P2PIXInterface extends utils.Interface {
|
|||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "sellerAllowList",
|
functionFragment: "sellerAllowList",
|
||||||
values: [PromiseOrValue<BigNumberish>]
|
values: [PromiseOrValue<string>]
|
||||||
): string;
|
): string;
|
||||||
encodeFunctionData(
|
encodeFunctionData(
|
||||||
functionFragment: "setDefaultLockBlocks",
|
functionFragment: "setDefaultLockBlocks",
|
||||||
@ -362,7 +396,7 @@ export interface P2PIXInterface extends utils.Interface {
|
|||||||
"DepositAdded(address,address,uint256)": EventFragment;
|
"DepositAdded(address,address,uint256)": EventFragment;
|
||||||
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
"DepositWithdrawn(address,address,uint256)": EventFragment;
|
||||||
"FundsWithdrawn(address,uint256)": EventFragment;
|
"FundsWithdrawn(address,uint256)": EventFragment;
|
||||||
"LockAdded(address,uint256,uint256,uint256)": EventFragment;
|
"LockAdded(address,uint256,address,uint256)": EventFragment;
|
||||||
"LockBlocksUpdated(uint256)": EventFragment;
|
"LockBlocksUpdated(uint256)": EventFragment;
|
||||||
"LockReleased(address,uint256,uint256)": EventFragment;
|
"LockReleased(address,uint256,uint256)": EventFragment;
|
||||||
"LockReturned(address,uint256)": EventFragment;
|
"LockReturned(address,uint256)": EventFragment;
|
||||||
@ -441,11 +475,11 @@ export type FundsWithdrawnEventFilter = TypedEventFilter<FundsWithdrawnEvent>;
|
|||||||
export interface LockAddedEventObject {
|
export interface LockAddedEventObject {
|
||||||
buyer: string;
|
buyer: string;
|
||||||
lockID: BigNumber;
|
lockID: BigNumber;
|
||||||
seller: BigNumber;
|
seller: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
}
|
}
|
||||||
export type LockAddedEvent = TypedEvent<
|
export type LockAddedEvent = TypedEvent<
|
||||||
[string, BigNumber, BigNumber, BigNumber],
|
[string, BigNumber, string, BigNumber],
|
||||||
LockAddedEventObject
|
LockAddedEventObject
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -598,11 +632,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
defaultLockBlocks(overrides?: CallOverrides): Promise<[BigNumber]>;
|
defaultLockBlocks(overrides?: CallOverrides): Promise<[BigNumber]>;
|
||||||
|
|
||||||
deposit(
|
deposit(
|
||||||
_token: PromiseOrValue<string>,
|
args: DataTypes.DepositArgsStruct,
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
_pixTarget: PromiseOrValue<string>,
|
|
||||||
_valid: PromiseOrValue<boolean>,
|
|
||||||
allowlistRoot: PromiseOrValue<BytesLike>,
|
|
||||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||||
): Promise<ContractTransaction>;
|
): Promise<ContractTransaction>;
|
||||||
|
|
||||||
@ -652,11 +682,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
): Promise<[boolean]>;
|
): Promise<[boolean]>;
|
||||||
|
|
||||||
lock(
|
lock(
|
||||||
_seller: PromiseOrValue<string>,
|
args: DataTypes.LockArgsStruct,
|
||||||
_token: PromiseOrValue<string>,
|
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
merkleProof: PromiseOrValue<BytesLike>[],
|
|
||||||
expiredLocks: PromiseOrValue<BigNumberish>[],
|
|
||||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||||
): Promise<ContractTransaction>;
|
): Promise<ContractTransaction>;
|
||||||
|
|
||||||
@ -666,14 +692,14 @@ export interface P2PIX extends BaseContract {
|
|||||||
arg0: PromiseOrValue<BigNumberish>,
|
arg0: PromiseOrValue<BigNumberish>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<
|
): Promise<
|
||||||
[BigNumber, BigNumber, BigNumber, string, BigNumber, string, string] & {
|
[BigNumber, BigNumber, string, BigNumber, string, string, string] & {
|
||||||
sellerKey: BigNumber;
|
|
||||||
counter: BigNumber;
|
counter: BigNumber;
|
||||||
expirationBlock: BigNumber;
|
expirationBlock: BigNumber;
|
||||||
pixTarget: string;
|
pixTarget: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
token: string;
|
token: string;
|
||||||
buyerAddress: string;
|
buyerAddress: string;
|
||||||
|
seller: string;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -691,7 +717,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<[string]>;
|
reputation(overrides?: CallOverrides): Promise<[string]>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<[string] & { root: string }>;
|
): Promise<[string] & { root: string }>;
|
||||||
|
|
||||||
@ -789,11 +815,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
defaultLockBlocks(overrides?: CallOverrides): Promise<BigNumber>;
|
defaultLockBlocks(overrides?: CallOverrides): Promise<BigNumber>;
|
||||||
|
|
||||||
deposit(
|
deposit(
|
||||||
_token: PromiseOrValue<string>,
|
args: DataTypes.DepositArgsStruct,
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
_pixTarget: PromiseOrValue<string>,
|
|
||||||
_valid: PromiseOrValue<boolean>,
|
|
||||||
allowlistRoot: PromiseOrValue<BytesLike>,
|
|
||||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||||
): Promise<ContractTransaction>;
|
): Promise<ContractTransaction>;
|
||||||
|
|
||||||
@ -843,11 +865,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
): Promise<boolean>;
|
): Promise<boolean>;
|
||||||
|
|
||||||
lock(
|
lock(
|
||||||
_seller: PromiseOrValue<string>,
|
args: DataTypes.LockArgsStruct,
|
||||||
_token: PromiseOrValue<string>,
|
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
merkleProof: PromiseOrValue<BytesLike>[],
|
|
||||||
expiredLocks: PromiseOrValue<BigNumberish>[],
|
|
||||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||||
): Promise<ContractTransaction>;
|
): Promise<ContractTransaction>;
|
||||||
|
|
||||||
@ -857,14 +875,14 @@ export interface P2PIX extends BaseContract {
|
|||||||
arg0: PromiseOrValue<BigNumberish>,
|
arg0: PromiseOrValue<BigNumberish>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<
|
): Promise<
|
||||||
[BigNumber, BigNumber, BigNumber, string, BigNumber, string, string] & {
|
[BigNumber, BigNumber, string, BigNumber, string, string, string] & {
|
||||||
sellerKey: BigNumber;
|
|
||||||
counter: BigNumber;
|
counter: BigNumber;
|
||||||
expirationBlock: BigNumber;
|
expirationBlock: BigNumber;
|
||||||
pixTarget: string;
|
pixTarget: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
token: string;
|
token: string;
|
||||||
buyerAddress: string;
|
buyerAddress: string;
|
||||||
|
seller: string;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -882,7 +900,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<string>;
|
reputation(overrides?: CallOverrides): Promise<string>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
@ -980,11 +998,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
defaultLockBlocks(overrides?: CallOverrides): Promise<BigNumber>;
|
defaultLockBlocks(overrides?: CallOverrides): Promise<BigNumber>;
|
||||||
|
|
||||||
deposit(
|
deposit(
|
||||||
_token: PromiseOrValue<string>,
|
args: DataTypes.DepositArgsStruct,
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
_pixTarget: PromiseOrValue<string>,
|
|
||||||
_valid: PromiseOrValue<boolean>,
|
|
||||||
allowlistRoot: PromiseOrValue<BytesLike>,
|
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
@ -1034,11 +1048,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
): Promise<boolean>;
|
): Promise<boolean>;
|
||||||
|
|
||||||
lock(
|
lock(
|
||||||
_seller: PromiseOrValue<string>,
|
args: DataTypes.LockArgsStruct,
|
||||||
_token: PromiseOrValue<string>,
|
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
merkleProof: PromiseOrValue<BytesLike>[],
|
|
||||||
expiredLocks: PromiseOrValue<BigNumberish>[],
|
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<BigNumber>;
|
): Promise<BigNumber>;
|
||||||
|
|
||||||
@ -1048,14 +1058,14 @@ export interface P2PIX extends BaseContract {
|
|||||||
arg0: PromiseOrValue<BigNumberish>,
|
arg0: PromiseOrValue<BigNumberish>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<
|
): Promise<
|
||||||
[BigNumber, BigNumber, BigNumber, string, BigNumber, string, string] & {
|
[BigNumber, BigNumber, string, BigNumber, string, string, string] & {
|
||||||
sellerKey: BigNumber;
|
|
||||||
counter: BigNumber;
|
counter: BigNumber;
|
||||||
expirationBlock: BigNumber;
|
expirationBlock: BigNumber;
|
||||||
pixTarget: string;
|
pixTarget: string;
|
||||||
amount: BigNumber;
|
amount: BigNumber;
|
||||||
token: string;
|
token: string;
|
||||||
buyerAddress: string;
|
buyerAddress: string;
|
||||||
|
seller: string;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -1073,7 +1083,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<string>;
|
reputation(overrides?: CallOverrides): Promise<string>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
@ -1189,7 +1199,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
): FundsWithdrawnEventFilter;
|
): FundsWithdrawnEventFilter;
|
||||||
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
FundsWithdrawn(owner?: null, amount?: null): FundsWithdrawnEventFilter;
|
||||||
|
|
||||||
"LockAdded(address,uint256,uint256,uint256)"(
|
"LockAdded(address,uint256,address,uint256)"(
|
||||||
buyer?: PromiseOrValue<string> | null,
|
buyer?: PromiseOrValue<string> | null,
|
||||||
lockID?: PromiseOrValue<BigNumberish> | null,
|
lockID?: PromiseOrValue<BigNumberish> | null,
|
||||||
seller?: null,
|
seller?: null,
|
||||||
@ -1293,11 +1303,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
defaultLockBlocks(overrides?: CallOverrides): Promise<BigNumber>;
|
defaultLockBlocks(overrides?: CallOverrides): Promise<BigNumber>;
|
||||||
|
|
||||||
deposit(
|
deposit(
|
||||||
_token: PromiseOrValue<string>,
|
args: DataTypes.DepositArgsStruct,
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
_pixTarget: PromiseOrValue<string>,
|
|
||||||
_valid: PromiseOrValue<boolean>,
|
|
||||||
allowlistRoot: PromiseOrValue<BytesLike>,
|
|
||||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||||
): Promise<BigNumber>;
|
): Promise<BigNumber>;
|
||||||
|
|
||||||
@ -1347,11 +1353,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
): Promise<BigNumber>;
|
): Promise<BigNumber>;
|
||||||
|
|
||||||
lock(
|
lock(
|
||||||
_seller: PromiseOrValue<string>,
|
args: DataTypes.LockArgsStruct,
|
||||||
_token: PromiseOrValue<string>,
|
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
merkleProof: PromiseOrValue<BytesLike>[],
|
|
||||||
expiredLocks: PromiseOrValue<BigNumberish>[],
|
|
||||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||||
): Promise<BigNumber>;
|
): Promise<BigNumber>;
|
||||||
|
|
||||||
@ -1376,7 +1378,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<BigNumber>;
|
reputation(overrides?: CallOverrides): Promise<BigNumber>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<BigNumber>;
|
): Promise<BigNumber>;
|
||||||
|
|
||||||
@ -1475,11 +1477,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
defaultLockBlocks(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
defaultLockBlocks(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
deposit(
|
deposit(
|
||||||
_token: PromiseOrValue<string>,
|
args: DataTypes.DepositArgsStruct,
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
_pixTarget: PromiseOrValue<string>,
|
|
||||||
_valid: PromiseOrValue<boolean>,
|
|
||||||
allowlistRoot: PromiseOrValue<BytesLike>,
|
|
||||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||||
): Promise<PopulatedTransaction>;
|
): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
@ -1529,11 +1527,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
): Promise<PopulatedTransaction>;
|
): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
lock(
|
lock(
|
||||||
_seller: PromiseOrValue<string>,
|
args: DataTypes.LockArgsStruct,
|
||||||
_token: PromiseOrValue<string>,
|
|
||||||
_amount: PromiseOrValue<BigNumberish>,
|
|
||||||
merkleProof: PromiseOrValue<BytesLike>[],
|
|
||||||
expiredLocks: PromiseOrValue<BigNumberish>[],
|
|
||||||
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
overrides?: Overrides & { from?: PromiseOrValue<string> }
|
||||||
): Promise<PopulatedTransaction>;
|
): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
@ -1558,7 +1552,7 @@ export interface P2PIX extends BaseContract {
|
|||||||
reputation(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
reputation(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
sellerAllowList(
|
sellerAllowList(
|
||||||
sellerKey: PromiseOrValue<BigNumberish>,
|
sellerKey: PromiseOrValue<string>,
|
||||||
overrides?: CallOverrides
|
overrides?: CallOverrides
|
||||||
): Promise<PopulatedTransaction>;
|
): Promise<PopulatedTransaction>;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -12,53 +12,26 @@ import {
|
|||||||
Reputation,
|
Reputation,
|
||||||
} from "../../src/types";
|
} from "../../src/types";
|
||||||
|
|
||||||
// exported interfaces
|
import { Call, RepFixture, P2PixAndReputation, DepositArgs, LockArgs } from "./interfaces";
|
||||||
export interface Deploys {
|
|
||||||
signers: string[];
|
|
||||||
p2pix: string;
|
|
||||||
token: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Lock {
|
|
||||||
sellerKey: BigNumber;
|
|
||||||
counter: BigNumber;
|
|
||||||
expirationBlock: BigNumber;
|
|
||||||
pixTarget: string;
|
|
||||||
token: string;
|
|
||||||
buyerAddress: string;
|
|
||||||
amount: BigNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Call {
|
|
||||||
target: string;
|
|
||||||
callData: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Result {
|
|
||||||
success: boolean;
|
|
||||||
returnData: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface P2pixFixture {
|
|
||||||
p2pix: P2PIX;
|
|
||||||
erc20: MockToken;
|
|
||||||
proof: string[];
|
|
||||||
merkleRoot: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RepFixture {
|
|
||||||
reputation: Reputation;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MtcFixture {
|
|
||||||
multicall: Multicall;
|
|
||||||
}
|
|
||||||
|
|
||||||
type P2PixAndReputation = P2pixFixture &
|
|
||||||
RepFixture &
|
|
||||||
MtcFixture;
|
|
||||||
|
|
||||||
// exported constants
|
// exported constants
|
||||||
|
export const createDepositArgs = (pixTarget: string, allowlistRoot: string, token: string, amount: BigNumber, valid:boolean): DepositArgs => ({
|
||||||
|
pixTarget,
|
||||||
|
allowlistRoot,
|
||||||
|
token,
|
||||||
|
amount,
|
||||||
|
valid,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const createLockArgs = (seller: string, token: string, amount: BigNumber, merkleProof: string[], expiredLocks: BigNumber[]): LockArgs => ({
|
||||||
|
seller,
|
||||||
|
token,
|
||||||
|
amount,
|
||||||
|
merkleProof,
|
||||||
|
expiredLocks,
|
||||||
|
});
|
||||||
|
|
||||||
export const getSignerAddrs = (
|
export const getSignerAddrs = (
|
||||||
amount: number,
|
amount: number,
|
||||||
addrs: SignerWithAddress[],
|
addrs: SignerWithAddress[],
|
||||||
|
71
test/utils/interfaces.ts
Normal file
71
test/utils/interfaces.ts
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
import { BigNumber } from "ethers";
|
||||||
|
|
||||||
|
import {
|
||||||
|
MockToken,
|
||||||
|
Multicall,
|
||||||
|
P2PIX,
|
||||||
|
Reputation,
|
||||||
|
} from "../../src/types";
|
||||||
|
|
||||||
|
|
||||||
|
// exported interfaces
|
||||||
|
export interface Deploys {
|
||||||
|
signers: string[];
|
||||||
|
p2pix: string;
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DepositArgs {
|
||||||
|
pixTarget: string;
|
||||||
|
allowlistRoot: string;
|
||||||
|
token: string;
|
||||||
|
amount: BigNumber;
|
||||||
|
valid: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LockArgs {
|
||||||
|
seller: string;
|
||||||
|
token: string;
|
||||||
|
amount: BigNumber;
|
||||||
|
merkleProof: string[];
|
||||||
|
expiredLocks: BigNumber[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Lock {
|
||||||
|
counter: BigNumber;
|
||||||
|
expirationBlock: BigNumber;
|
||||||
|
pixTarget: string;
|
||||||
|
amount: BigNumber;
|
||||||
|
token: string;
|
||||||
|
buyerAddress: string;
|
||||||
|
seller: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Call {
|
||||||
|
target: string;
|
||||||
|
callData: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Result {
|
||||||
|
success: boolean;
|
||||||
|
returnData: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface P2pixFixture {
|
||||||
|
p2pix: P2PIX;
|
||||||
|
erc20: MockToken;
|
||||||
|
proof: string[];
|
||||||
|
merkleRoot: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RepFixture {
|
||||||
|
reputation: Reputation;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MtcFixture {
|
||||||
|
multicall: Multicall;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type P2PixAndReputation = P2pixFixture &
|
||||||
|
RepFixture &
|
||||||
|
MtcFixture;
|
Loading…
x
Reference in New Issue
Block a user