Compare commits

...

8 Commits

Author SHA1 Message Date
hueso
91ab0fae80 expired bond goes to seller 2025-08-02 21:35:22 -03:00
hueso
b2198306e6 bond to override lock limit 2025-08-02 21:35:22 -03:00
hueso
e57428525b updated RPC urls 2025-08-02 21:10:31 -03:00
hueso
538258a709 rootstock testnet re-deployment 2025-08-02 21:10:31 -03:00
hueso
30335bbe5b bump solidity verison 2025-08-02 21:10:31 -03:00
hueso
f924593ee2 Ethers v5 -> v6 migration
Updated dependencies and removed unused ones.
2025-08-02 21:09:40 -03:00
hueso
811d5344a3 Partial hardhat -> viem migration for tests.
Typescript updated to v5.
Notably all calls to p2pix.callStatic.getStr() were replaced by viem.stringToHex() due to bug in ethers (https://github.com/ethers-io/ethers.js/issues/4965)
Full migration to viem might not be possible currently due to hard-chai-matchers incompatibility:
> The hardhat-chai-matchers plugin is designed to work with hardhat-ethers. Attempting to use it in conjunction with hardhat-viem results in compatibility issues.
https://hardhat.org/hardhat-chai-matchers/docs/overview
2025-06-11 11:55:24 -03:00
hueso
4f1f8d6025 sepolia deployment 2024-07-18 17:59:44 -03:00
31 changed files with 4782 additions and 10339 deletions

View File

@ -1,2 +0,0 @@
extends:
- "@commitlint/config-conventional"

3
.czrc
View File

@ -1,3 +0,0 @@
{
"path": "cz-conventional-changelog"
}

1
.husky/.gitignore vendored
View File

@ -1 +0,0 @@
_

View File

@ -1,4 +0,0 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn dlx commitlint --edit $1

View File

@ -1,4 +0,0 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn dlx lint-staged

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

942
.yarn/releases/yarn-4.9.2.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
compressionLevel: mixed
enableGlobalCache: false
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-3.2.1.cjs
yarnPath: .yarn/releases/yarn-4.9.2.cjs

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.19;
import { IReputation } from "./lib/interfaces/IReputation.sol";

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.19;
import { ERC20, OwnerSettings } from "contracts/core/OwnerSettings.sol";

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.19;
abstract contract Constants {
/// Constants
@ -44,4 +44,5 @@ abstract contract Constants {
uint256 constant MAXBALANCE_UPPERBOUND = 1e8 ether;
uint256 constant REPUTATION_LOWERBOUND = 1e2 ether;
uint256 constant LOCKAMOUNT_UPPERBOUND = 1e6 ether;
uint256 constant BOND_DIVISOR = 4; // 6,25%
}

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.19;
import { ERC20 } from "contracts/lib/tokens/ERC20.sol";
@ -13,6 +13,7 @@ library DataTypes {
ERC20 token;
address buyerAddress;
address seller;
bool bond;
}
// prettier-ignore

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.19;
import { ERC20 } from "contracts/lib/tokens/ERC20.sol";

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.19;
import { ERC2771Context as ERC2771 } from "contracts/lib/metatx/ERC2771Context.sol";
import { ERC20, SafeTransferLib } from "contracts/lib/utils/SafeTransferLib.sol";

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.19;
import { ERC20 } from "../tokens/ERC20.sol";

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.19;
/// ______ __
/// .-----.|__ |.-----.|__|.--.--.
@ -135,7 +135,8 @@ contract P2PIX is BaseUtils {
ERC20 token,
uint80 amount,
bytes32[] calldata merkleProof,
uint256[] calldata expiredLocks
uint256[] calldata expiredLocks,
bool bond
) public nonReentrant returns (uint256 lockID) {
unlockExpired(expiredLocks);
@ -154,10 +155,17 @@ contract P2PIX is BaseUtils {
bytes32 _pixTarget = getPixTarget(seller, token);
// transaction forwarding must leave `merkleProof` empty;
// otherwise, the trustedForwarder must be previously added
// to a seller whitelist.
if (merkleProof.length != 0) {
if (bond){
SafeTransferLib.safeTransferFrom(
token,
_msgSender(),
address(this),
amount >> BOND_DIVISOR
);
} else if (merkleProof.length != 0) {
// transaction forwarding must leave `merkleProof` empty;
// otherwise, the trustedForwarder must be previously added
// to a seller whitelist.
_merkleVerify( merkleProof, sellerAllowList(seller), _msgSender());
} else if ( amount > REPUTATION_LOWERBOUND && msg.sender == _msgSender() ) {
@ -178,7 +186,8 @@ contract P2PIX is BaseUtils {
amount,
token,
_msgSender(),
seller
seller,
bond
);
_addLock(bal, l);
@ -237,7 +246,7 @@ contract P2PIX is BaseUtils {
SafeTransferLib.safeTransfer(
t,
l.buyerAddress,
lockAmount
l.bond ? lockAmount + lockAmount >> BOND_DIVISOR : lockAmount
);
emit LockReleased(l.buyerAddress, lockID, lockAmount);
@ -266,7 +275,7 @@ contract P2PIX is BaseUtils {
if ((_sellerBalance + l.amount) > MAXBALANCE_UPPERBOUND)
revert MaxBalExceeded();
_addSellerBalance(l.seller, l.token, l.amount);
_addSellerBalance(l.seller, l.token, l.bond ? l.amount + l.amount >> BOND_DIVISOR : l.amount);
l.amount = 0;

View File

@ -1,8 +1,9 @@
{
"signers": [
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
"0x8963E134E6d22Ee9A26ac62a99964aB391ead816"
],
"token": "0xfE841c74250e57640390f46d914C88d22C51e82e",
"p2pix": "0x98ba35eb14b38D6Aa709338283af3e922476dE34"
"p2pix": "0x57Dcba05980761169508886eEdc6f5E7EC0411Dc"
}

8
deploys/sepolia.json Normal file
View File

@ -0,0 +1,8 @@
{
"signers": [
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
],
"p2pix": "0xb7cD135F5eFD9760981e02E2a898790b688939fe",
"token": "0x3eBE67A2C7bdB2081CBd34ba3281E90377462289"
}

View File

@ -94,3 +94,9 @@ uint256 REPUTATION_LOWERBOUND
uint256 LOCKAMOUNT_UPPERBOUND
```
### BOND_DIVISOR
```solidity
uint256 BOND_DIVISOR
```

View File

@ -13,6 +13,7 @@ struct Lock {
contract ERC20 token;
address buyerAddress;
address seller;
bool bond;
}
```

View File

@ -67,7 +67,7 @@ _Function sighash: 0x6d82d9e0_
### lock
```solidity
function lock(address seller, contract ERC20 token, uint80 amount, bytes32[] merkleProof, uint256[] expiredLocks) public returns (uint256 lockID)
function lock(address seller, contract ERC20 token, uint80 amount, bytes32[] merkleProof, uint256[] expiredLocks, bool bond) public returns (uint256 lockID)
```
Public method designed to lock an remaining amount of
@ -78,7 +78,7 @@ to a seller whitelist.
This method can be performed either by:
- An user allowed via the seller's allowlist;
- An user with enough userRecord to lock the wished amount;
There can only exist a lock per each `_amount` partitioned
There can only exist a lock per each `amount` partitioned
from the total `remaining` value.
Locks can only be performed in valid orders.
@ -93,6 +93,7 @@ _Function sighash: 0xdc43221c_
| amount | uint80 | The deposit's remaining amount wished to be locked. |
| merkleProof | bytes32[] | Provided as a pass if the `msg.sender` is in the seller's allowlist; Left empty otherwise; |
| expiredLocks | uint256[] | An array of identifiers to be provided so to unexpire locks using this transaction gas push. |
| bond | bool | |
#### Return Values

View File

@ -1,7 +1,6 @@
import "@nomicfoundation/hardhat-chai-matchers";
import "@nomicfoundation/hardhat-toolbox";
import { config as dotenvConfig } from "dotenv";
import "hardhat-tracer";
import { HardhatUserConfig } from "hardhat/config";
import { NetworkUserConfig } from "hardhat/types";
import "hardhat-contract-sizer";
@ -15,14 +14,6 @@ if (!mnemonic) {
throw new Error("Please set your MNEMONIC in a .env file");
}
const infuraApiKey: string | undefined =
process.env.INFURA_API_KEY;
if (!infuraApiKey) {
throw new Error(
"Please set your INFURA_API_KEY in a .env file",
);
}
const alchemyApiKey: string | undefined =
process.env.ALCHEMY_API_KEY;
if (!alchemyApiKey) {
@ -35,33 +26,16 @@ const chainIds = {
// "{INSERT_NAME}": {INSERT_ID},
hardhat: 31337,
mainnet: 1,
sepolia: 11155111,
goerli: 5,
"eth-sepolia": 11155111,
"polygon-mumbai": 80001,
rootstock:30,
rsktestnet:31,
"rootstock-testnet":31,
};
function getChainConfig(
chain: keyof typeof chainIds,
): NetworkUserConfig {
let jsonRpcUrl: string;
switch (chain) {
case "polygon-mumbai":
jsonRpcUrl =
"https://polygon-mumbai.g.alchemy.com/v2/" +
alchemyApiKey;
break;
case "rsktestnet":
jsonRpcUrl = "https://public-node.testnet.rsk.co/";
break;
case "rootstock":
jsonRpcUrl = "https://public-node.rsk.co/"
break;
default:
jsonRpcUrl =
"https://" + chain + ".infura.io/v3/" + infuraApiKey;
}
let jsonRpcUrl = "https://" + chain + ".g.alchemy.com/v2/" + alchemyApiKey;
return {
// Comment out for default hardhat account settings
accounts: {
@ -90,6 +64,7 @@ const config: HardhatUserConfig = {
process.env.REPORT_GAS &&
process.env.REPORT_GAS != "false"
),
offline: true,
showTimeSpent: true,
showMethodSig: true,
token: "ETH",
@ -109,11 +84,10 @@ const config: HardhatUserConfig = {
},
// network: getChainConfig("{INSERT_NAME}"),
mainnet: getChainConfig("mainnet"),
goerli: getChainConfig("goerli"),
sepolia: getChainConfig("sepolia"),
"polygon-mumbai": getChainConfig("polygon-mumbai"),
sepolia: getChainConfig("eth-sepolia"),
mumbai: getChainConfig("polygon-mumbai"),
rootstock: getChainConfig("rootstock"),
rsktestnet: getChainConfig("rsktestnet"),
rsktestnet: getChainConfig("rootstock-testnet"),
},
paths: {
artifacts: "./artifacts",
@ -122,10 +96,10 @@ const config: HardhatUserConfig = {
tests: "./test",
},
solidity: {
version: "0.8.19",
version: "0.8.28",
settings: {
viaIR: true,
evmVersion: "paris",
evmVersion: "cancun",
optimizer: {
enabled: true,
runs: 20_000,
@ -145,7 +119,7 @@ const config: HardhatUserConfig = {
},
typechain: {
outDir: "src/types",
target: "ethers-v5",
target: "ethers-v6",
},
docgen: {
pages: "files",

View File

@ -9,10 +9,9 @@
"url": "https://github.com/doiim/p2pix-smart-contracts/issues"
},
"scripts": {
"clean": "shx rm -rf ./artifacts ./cache ./coverage ./src/types ./coverage.json && yarn typechain",
"commit": "git-cz",
"compile": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile",
"typechain": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat typechain",
"clean": "hardhat clean",
"compile": "hardhat compile",
"typechain": "hardhat typechain",
"test": "hardhat test",
"deploy1:localhost": "hardhat run scripts/1-deploy-mockToken.ts --network localhost",
"deploy2:localhost": "hardhat run scripts/2-deploy-p2pix.ts --network localhost",
@ -24,71 +23,49 @@
"lint": "yarn lint:sol && yarn lint:ts && yarn prettier:check",
"lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"",
"lint:ts": "eslint --config ./.eslintrc.yaml --ignore-path ./.eslintignore --ext .js,.ts .",
"_postinstall": "husky install",
"postpublish": "pinst --enable",
"prepublishOnly": "pinst --disable",
"prettier": "prettier --config ./.prettierrc.yaml --write \"**/*.{js,json,md,sol,ts,yaml,yml}\"",
"prettier:check": "prettier --check --config ./.prettierrc.yaml \"**/*.{js,json,md,sol,ts,yaml,yml}\""
},
"devDependencies": {
"@commitlint/cli": "^17.2.0",
"@commitlint/config-conventional": "^17.2.0",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.4",
"@nomicfoundation/hardhat-network-helpers": "1.0.6",
"@nomicfoundation/hardhat-toolbox": "^2.0.0",
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@nomiclabs/hardhat-etherscan": "^3.1.2",
"@trivago/prettier-plugin-sort-imports": "^3.4.0",
"@typechain/ethers-v5": "^10.1.1",
"@typechain/hardhat": "^6.1.4",
"@types/chai": "^4.3.3",
"@types/fs-extra": "^9.0.13",
"@types/mocha": "^9.1.1",
"@types/node": "^18.11.9",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"chai": "^4.3.6",
"chalk": "4.x",
"commitizen": "^4.2.5",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"dotenv": "^16.0.3",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"ethers": "^5.7.2",
"fs-extra": "^10.1.0",
"hardhat": "^2.12.2",
"hardhat-contract-sizer": "^2.8.0",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-tracer": "beta",
"husky": "^8.0.1",
"@ethersproject/abi": "^5.8.0",
"@ethersproject/providers": "^5.8.0",
"@nomicfoundation/hardhat-chai-matchers": "^2.1.0",
"@nomicfoundation/hardhat-ethers": "^3.1.0",
"@nomicfoundation/hardhat-ignition": "^0.15.13",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.14",
"@nomicfoundation/hardhat-network-helpers": "^1.1.0",
"@nomicfoundation/hardhat-toolbox": "^6.1.0",
"@nomicfoundation/hardhat-verify": "^2.1.0",
"@nomicfoundation/hardhat-viem": "^2.1.0",
"@nomicfoundation/ignition-core": "^0.15.13",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^24.1.0",
"chai": "4.5.0",
"dotenv": "^16.6.1",
"eslint": "^9.32.0",
"eslint-config-prettier": "^10.1.8",
"ethers": "^6.15.0",
"hardhat": "^2.26.1",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-gas-reporter": "^2.3.0",
"keccak256": "^1.0.6",
"lint-staged": "^13.0.3",
"lodash": "^4.17.21",
"merkletreejs": "^0.2.32",
"mocha": "^10.1.0",
"pinst": "^3.0.0",
"prettier": "^2.7.1",
"prettier-plugin-solidity": "^1.0.0-rc.1",
"shx": "^0.3.4",
"solhint": "^3.3.7",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.8.2",
"merkletreejs": "^0.5.2",
"mocha": "^10.8.2",
"solidity-coverage": "^0.8.16",
"solidity-docgen": "^0.6.0-beta.36",
"ts-generator": "^0.1.1",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
"typescript": "^4.8.4"
"ts-node": "^10.9.2",
"typechain": "^8.3.2",
"typescript": "^5.8.3",
"viem": "^2.33.1"
},
"files": [
"/contracts"
],
"packageManager": "yarn@3.2.1",
"packageManager": "yarn@4.9.2",
"publishConfig": {
"access": "public"
}

View File

@ -1,14 +1,11 @@
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import { BigNumber } from "ethers";
import "@nomicfoundation/hardhat-ethers";
import * as fs from "fs";
import { ethers, network } from "hardhat";
import hre from "hardhat";
import { Deploys } from "../test/utils/interfaces";
let deploysJson: Deploys;
const supply: BigNumber = ethers.utils.parseEther("20000000");
const supply: BigInt = ethers.parseEther("20000000");
const main = async () => {
try {
@ -25,15 +22,11 @@ const main = async () => {
const [deployer] = await ethers.getSigners();
console.log(`Deploying contracts with ${deployer.address}`);
const ERC20Factory = await ethers.getContractFactory(
"MockToken",
);
const erc20 = await ERC20Factory.deploy(supply);
await erc20.deployed();
let erc20 = await ethers.deployContract("MockToken", [supply]);
erc20 = await erc20.waitForDeployment();
deploysJson.token = erc20.address;
console.log("🚀 Mock Token Deployed:", erc20.address);
await erc20.deployTransaction.wait(6);
deploysJson.token = await erc20.getAddress();
console.log("🚀 Mock Token Deployed:", await erc20.getAddress());
fs.writeFileSync(
`./deploys/${network.name}.json`,

View File

@ -1,8 +1,6 @@
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import "@nomicfoundation/hardhat-ethers";
import * as fs from "fs";
import { ethers, network } from "hardhat";
import hre from "hardhat";
import { Deploys } from "../test/utils/interfaces";
@ -23,32 +21,24 @@ const main = async () => {
const [deployer] = await ethers.getSigners();
console.log(`Deploying contracts with ${deployer.address}`);
const Reputation = await ethers.getContractFactory(
"Reputation",
);
const Multicall = await ethers.getContractFactory(
"Multicall",
);
const reputation = await Reputation.deploy();
await reputation.deployed();
const mutlicall = await Multicall.deploy();
await mutlicall.deployed();
const P2PIX = await ethers.getContractFactory("P2PIX");
const p2pix = await P2PIX.deploy(
let reputation = await ethers.deployContract("Reputation");
let multicall = await ethers.deployContract("Multicall");
let p2pix = await ethers.deployContract("P2PIX", [
10,
deploysJson.signers,
reputation.address,
reputation.target,
[deploysJson.token],
[true],
);
await p2pix.deployed();
]);
deploysJson.p2pix = p2pix.address;
console.log("🚀 P2PIX Deployed:", p2pix.address);
console.log("🌠 Reputation Deployed:", reputation.address);
console.log("🛰 Multicall Deployed:", mutlicall.address);
await p2pix.deployTransaction.wait(6);
reputation = await reputation.waitForDeployment();
multicall = await multicall.waitForDeployment();
p2pix = await p2pix.waitForDeployment();
deploysJson.p2pix = await p2pix.getAddress();
console.log("🚀 P2PIX Deployed:", await p2pix.getAddress());
console.log("🌠 Reputation Deployed:", await reputation.getAddress());
console.log("🛰 Multicall Deployed:", await multicall.getAddress());
fs.writeFileSync(
`./deploys/${network.name}.json`,

View File

@ -1,6 +1,6 @@
import "@nomicfoundation/hardhat-chai-matchers";
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { expect } from "chai";
import { ethers, network } from "hardhat";
@ -15,7 +15,7 @@ describe("Reputation", () => {
before("Set signers and reset network", async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[owner] = await (ethers as any).getSigners();
[owner] = await ethers.getSigners();
await network.provider.send("hardhat_reset");
});
@ -60,7 +60,7 @@ describe("Reputation", () => {
},
{
x: Number.MAX_SAFE_INTEGER,
shouldRevert: "overflow",
expected: curve(Number.MAX_SAFE_INTEGER),
},
{
x: Number.POSITIVE_INFINITY,

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { BigNumber, Signer } from "ethers";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { Signer } from "ethers";
import { ethers } from "hardhat";
import keccak256 from "keccak256";
import { MerkleTree } from "merkletreejs";
@ -14,7 +14,6 @@ import {
import { Call, RepFixture, P2PixAndReputation, DepositArgs, LockArgs, ReleaseArgs } from "./interfaces";
// exported constants
export const getSignerAddrs = (
amount: number,
@ -23,16 +22,16 @@ export const getSignerAddrs = (
return addrs.slice(0, amount).map(({ address }) => address);
};
export const getBnFrom = (nums: number[]): BigNumber[] => {
const bns = nums.map(num => ethers.BigNumber.from(num));
export const getBnFrom = (nums: number[]): BigInt[] => {
const bns = nums.map(num => BigInt(num));
return bns;
};
export const getLockData = (
addr: string,
locks: BigNumber[][],
locks: BigInt[][],
): Call[] => {
const iface = new ethers.utils.Interface(
const iface = new ethers.Interface(
P2PIX__factory.abi,
);
return locks.map(lock => ({
@ -72,13 +71,8 @@ export const curve = (x: number): number => {
// exported async functions
export async function repFixture(): Promise<RepFixture> {
const Reputation = await ethers.getContractFactory(
"Reputation",
);
const reputation =
(await Reputation.deploy()) as Reputation;
return { reputation };
const reputation = await ethers.deployContract("Reputation");
return { reputation: await reputation.waitForDeployment() };
}
export async function p2pixFixture(): Promise<P2PixAndReputation> {
@ -87,30 +81,21 @@ export async function p2pixFixture(): Promise<P2PixAndReputation> {
await ethers.getSigners(),
);
const Reputation = await ethers.getContractFactory(
"Reputation",
);
const reputation =
(await Reputation.deploy()) as Reputation;
const reputation = await ethers.deployContract("Reputation");
const ERC20 = await ethers.getContractFactory("MockToken");
const erc20 = (await ERC20.deploy(
ethers.utils.parseEther("20000000"), // 20M
)) as MockToken;
const erc20 = await ethers.deployContract("MockToken", [
ethers.parseEther("20000000") // 20M
]) as MockToken;
const P2PIX = await ethers.getContractFactory("P2PIX");
const p2pix = (await P2PIX.deploy(
const p2pix = await ethers.deployContract("P2PIX", [
10,
validSigners,
reputation.address,
[erc20.address],
reputation.target,
[erc20.target],
[true],
)) as P2PIX;
]);
const Multicall = await ethers.getContractFactory(
"Multicall",
);
const multicall = (await Multicall.deploy()) as Multicall;
const multicall = await ethers.deployContract("Multicall");
const signers = await ethers.getSigners();
const whitelisted = signers.slice(0, 2);
@ -126,10 +111,10 @@ export async function p2pixFixture(): Promise<P2PixAndReputation> {
);
return {
multicall,
reputation,
erc20,
p2pix,
multicall: await multicall.waitForDeployment(),
reputation: await reputation.waitForDeployment(),
erc20: await erc20.waitForDeployment(),
p2pix: await p2pix.waitForDeployment(),
merkleRoot,
proof,
};

View File

@ -1,5 +1,3 @@
import { BigNumber } from "ethers";
import {
MockToken,
Multicall,
@ -19,29 +17,29 @@ export interface DepositArgs {
pixTarget: string;
allowlistRoot: string;
token: string;
amount: BigNumber;
amount: BigInt;
valid: boolean;
}
export interface LockArgs {
seller: string;
token: string;
amount: BigNumber;
amount: BigInt;
merkleProof: string[];
expiredLocks: BigNumber[];
expiredLocks: BigInt[];
}
export interface ReleaseArgs {
lockID: BigNumber;
lockID: BigInt;
pixTimestamp: string;
signature: string;
}
export interface Lock {
counter: BigNumber;
expirationBlock: BigNumber;
counter: BigInt;
expirationBlock: BigInt;
pixTarget: string;
amount: BigNumber;
amount: BigInt;
token: string;
buyerAddress: string;
seller: string;

11473
yarn.lock

File diff suppressed because it is too large Load Diff