From 55fc45fc730909126a402087ceed8d6e299f2d42 Mon Sep 17 00:00:00 2001 From: PedroCailleret Date: Tue, 14 Feb 2023 19:56:34 -0300 Subject: [PATCH] Deployment scripts updated --- README.md | 18 ++-- .../DataTypes.sol/DataTypes.dbg.json | 2 +- .../EventAndErrors.dbg.json | 2 +- .../Reputation.sol/Reputation.dbg.json | 2 +- .../lib/auth/Owned.sol/Owned.dbg.json | 2 +- .../IReputation.sol/IReputation.dbg.json | 2 +- .../lib/mock/mockToken.sol/MockToken.dbg.json | 2 +- .../lib/tokens/ERC20.sol/ERC20.dbg.json | 2 +- .../MerkleProofLib.dbg.json | 2 +- .../utils/Multicall.sol/Multicall.dbg.json | 2 +- .../ReentrancyGuard.dbg.json | 2 +- .../SafeTransferLib.dbg.json | 2 +- artifacts/contracts/p2pix.sol/P2PIX.dbg.json | 2 +- deploys/goerli.json | 4 +- deploys/polygon-mumbai.json | 4 +- scripts/2-deploy-p2pix.ts | 11 +++ test/p2pix.test.ts | 97 ------------------- 17 files changed, 37 insertions(+), 121 deletions(-) diff --git a/README.md b/README.md index 14dc5ed..e7a3141 100644 --- a/README.md +++ b/README.md @@ -50,19 +50,21 @@ ### V2 -| Testnet | Token Address | P2pix Address | Reputation Address | -| ------- | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| Goerli | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0xefa5cE4351cda51192509cf8De7d8881ADAE95DD | 0x939d3c357dc7017cDbDE681BF8e552b54595318A | -| Mumbai | 0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29 | 0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b | 0x1fd30b94f20d2f73e9630261342ba68f244da92b | +| Testnet | Token Address | P2pix Address | Reputation Address | Multicall Address | +| ------- | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| Goerli | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0x2414817FF64A114d91eCFA16a834d3fCf69103d4 | 0x2CFD9354Ec7614fEf036EFd6A730dA1d5fC2762A | 0x8FE009992d96A86c7f0Bccdaf1eC3471E302a8a6 | +| Mumbai | 0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29 | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0x570445E3eF413bCDb5De79ed27B1c3840683e385 | 0x718B2C4DE4F9654E1349F610ff561249bfe1c418 | - - + + + - - + + + ## Usage diff --git a/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json b/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json index e4b0eb9..adb3dfd 100644 --- a/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json +++ b/artifacts/contracts/DataTypes.sol/DataTypes.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json index e4b0eb9..adb3dfd 100644 --- a/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json +++ b/artifacts/contracts/EventAndErrors.sol/EventAndErrors.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/Reputation.sol/Reputation.dbg.json b/artifacts/contracts/Reputation.sol/Reputation.dbg.json index e4b0eb9..adb3dfd 100644 --- a/artifacts/contracts/Reputation.sol/Reputation.dbg.json +++ b/artifacts/contracts/Reputation.sol/Reputation.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json b/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json index 1914ecd..27e859a 100644 --- a/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json +++ b/artifacts/contracts/lib/auth/Owned.sol/Owned.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json b/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json index 1914ecd..27e859a 100644 --- a/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json +++ b/artifacts/contracts/lib/interfaces/IReputation.sol/IReputation.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json index 1914ecd..27e859a 100644 --- a/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json +++ b/artifacts/contracts/lib/mock/mockToken.sol/MockToken.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json b/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json index 1914ecd..27e859a 100644 --- a/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json +++ b/artifacts/contracts/lib/tokens/ERC20.sol/ERC20.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json b/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json index 1914ecd..27e859a 100644 --- a/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json +++ b/artifacts/contracts/lib/utils/MerkleProofLib.sol/MerkleProofLib.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/lib/utils/Multicall.sol/Multicall.dbg.json b/artifacts/contracts/lib/utils/Multicall.sol/Multicall.dbg.json index 48e5d52..27e859a 100644 --- a/artifacts/contracts/lib/utils/Multicall.sol/Multicall.dbg.json +++ b/artifacts/contracts/lib/utils/Multicall.sol/Multicall.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/666cc6ce6bd689a930692ddaa3c0f679.json" + "buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json b/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json index 1914ecd..27e859a 100644 --- a/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +++ b/artifacts/contracts/lib/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/b4d8e73fede96cca1403a1884959873e.json" + "buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json b/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json index 48e5d52..27e859a 100644 --- a/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json +++ b/artifacts/contracts/lib/utils/SafeTransferLib.sol/SafeTransferLib.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/666cc6ce6bd689a930692ddaa3c0f679.json" + "buildInfo": "../../../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/artifacts/contracts/p2pix.sol/P2PIX.dbg.json b/artifacts/contracts/p2pix.sol/P2PIX.dbg.json index ea01694..adb3dfd 100644 --- a/artifacts/contracts/p2pix.sol/P2PIX.dbg.json +++ b/artifacts/contracts/p2pix.sol/P2PIX.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/666cc6ce6bd689a930692ddaa3c0f679.json" + "buildInfo": "../../build-info/901b067f80b6616939e558d795c555e5.json" } diff --git a/deploys/goerli.json b/deploys/goerli.json index 2d422d7..7c6322d 100644 --- a/deploys/goerli.json +++ b/deploys/goerli.json @@ -3,6 +3,6 @@ "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" ], - "p2pix": "0xefa5cE4351cda51192509cf8De7d8881ADAE95DD", + "p2pix": "0x2414817FF64A114d91eCFA16a834d3fCf69103d4", "token": "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00" -} +} \ No newline at end of file diff --git a/deploys/polygon-mumbai.json b/deploys/polygon-mumbai.json index b736331..fe1fb25 100644 --- a/deploys/polygon-mumbai.json +++ b/deploys/polygon-mumbai.json @@ -3,6 +3,6 @@ "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" ], - "p2pix": "0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b", + "p2pix": "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00", "token": "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29" -} +} \ No newline at end of file diff --git a/scripts/2-deploy-p2pix.ts b/scripts/2-deploy-p2pix.ts index dd4def2..d308202 100644 --- a/scripts/2-deploy-p2pix.ts +++ b/scripts/2-deploy-p2pix.ts @@ -26,8 +26,13 @@ const main = async () => { const Reputation = await ethers.getContractFactory( "Reputation", ); + const Multicall = await ethers.getContractFactory( + "Multicall", + ); const reputation = await Reputation.deploy(); await reputation.deployed(); + const mutlicall = await Multicall.deploy(); + await mutlicall.deployed(); const P2PIX = await ethers.getContractFactory("P2PIX"); const p2pix = await P2PIX.deploy( @@ -41,6 +46,8 @@ const main = async () => { deploysJson.p2pix = p2pix.address; console.log("🚀 P2PIX Deployed:", p2pix.address); + console.log("🌠 Reputation Deployed:", reputation.address); + console.log("🛰 Multicall Deployed:", mutlicall.address); await p2pix.deployTransaction.wait(6); fs.writeFileSync( @@ -64,6 +71,10 @@ const main = async () => { address: reputation.address, constructorArguments: [], }); + await hre.run("verify:verify", { + address: mutlicall.address, + constructorArguments: [], + }); }; main() diff --git a/test/p2pix.test.ts b/test/p2pix.test.ts index 4e51ee4..2a6aafe 100644 --- a/test/p2pix.test.ts +++ b/test/p2pix.test.ts @@ -7,7 +7,6 @@ import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; import { expect } from "chai"; import { BigNumber, - Bytes, BytesLike, ContractReceipt, ContractTransaction, @@ -554,42 +553,6 @@ describe("P2PIX", () => { expect(tx3).to.be.ok; expect(tx4).to.be.ok; - // await expect(tx) - // .to.emit(p2pix, "DepositAdded") - // .withArgs(owner.address, erc20.address, price); - // await expect(tx).to.changeTokenBalances( - // erc20, - // [owner.address, p2pix.address], - // ["-100000000000000000000", price], - // ); - - // await expect(tx2) - // .to.emit(p2pix, "DepositAdded") - // .withArgs(acc01.address, erc20.address, price2); - // await expect(tx2).to.changeTokenBalances( - // erc20, - // [acc01.address, p2pix.address], - // ["-200000000000000000000", price2], - // ); - - // await expect(tx3) - // .to.emit(p2pix, "DepositAdded") - // .withArgs(acc02.address, erc20.address, price3); - // await expect(tx3).to.changeTokenBalances( - // erc20, - // [acc02.address, p2pix.address], - // ["-300000000000000000000", price3], - // ); - - // await expect(tx4) - // .to.emit(p2pix, "DepositAdded") - // .withArgs(acc03.address, erc20.address, price4); - // await expect(tx4).to.changeTokenBalances( - // erc20, - // [acc03.address, p2pix.address], - // ["-400000000000000000000", price4], - // ); - const transactions = [tx, tx2, tx3, tx4]; const addresses = [ owner.address, @@ -713,36 +676,7 @@ describe("P2PIX", () => { P2PixErrors.NotEnoughTokens, ); }); - // test invalid since lockID has been replaced by a counter. - // it.only("should revert if a non expired lock has the same ID encoded", async () => { - // const pTarget = ethers.BigNumber.from(1337); - // await erc20.approve(p2pix.address, price); - // await p2pix.deposit( - // erc20.address, - // price, - // pTarget, - // true, - // ethers.constants.HashZero, - // ); - // await p2pix - // .connect(acc03) - // .lock( - // owner.address, - // erc20.address, - // acc02.address, - // acc03.address, - // 0, 1, [], []); - // console.log(await p2pix.callStatic.getValid(owner.address,erc20.address)) - // const fail = p2pix - // .connect(acc03) - // .lock(owner.address, erc20.address, acc02.address, acc03.address, 0, 1, [], []); - - // await expect(fail).to.be.revertedWithCustomError( - // p2pix, - // P2PixErrors.NotExpired, - // ); - // }); it("should revert if an invalid allowlist merkleproof is provided", async () => { await erc20.approve(p2pix.address, price); await p2pix.deposit( @@ -1906,37 +1840,6 @@ describe("P2PIX", () => { expect(acc01Record2).to.eq(6); // 0 + 6 expect(acc03Record2).to.eq(185); // 100 + 50 + 25 + 10 - // await expect(tx).to.changeTokenBalances( - // erc20, - // [ - // acc01.address, - // acc02.address, - // acc03.address, - // p2pix.address, - // ], - // [0, 100, 0, "-100"], - // ); - // await expect(tx1).to.changeTokenBalances( - // erc20, - // [ - // acc01.address, - // acc02.address, - // acc03.address, - // p2pix.address, - // ], - // [0, 47, 3, "-50"], - // ); - // await expect(tx2).to.changeTokenBalances( - // erc20, - // [ - // acc01.address, - // acc02.address, - // acc03.address, - // p2pix.address, - // ], - // [0, 20, 5, "-25"], - // ); - const addresses = [ acc01.address, acc02.address,