From d66ada5d7f6596cf7a925ffd580d9719783fc659 Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Sun, 6 Aug 2023 23:33:03 +0100 Subject: [PATCH] chore: added dispute template registry to tests and deploy scripts --- contracts/deploy/00-home-chain-arbitrable.ts | 5 +++-- contracts/deploy/00-home-chain-arbitration.ts | 8 +++++++- contracts/deploy/03-vea-mock.ts | 9 ++++++++- contracts/deploy/04-foreign-arbitrable.ts | 3 ++- contracts/deploy/04-klerosliquid-to-v2-gnosis.ts | 3 ++- contracts/deploy/04-resolver-to-v2-gnosis.ts | 3 ++- contracts/test/evidence/index.ts | 12 +++++++++++- 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/contracts/deploy/00-home-chain-arbitrable.ts b/contracts/deploy/00-home-chain-arbitrable.ts index 62f731fdf..611901f6d 100644 --- a/contracts/deploy/00-home-chain-arbitrable.ts +++ b/contracts/deploy/00-home-chain-arbitrable.ts @@ -18,19 +18,20 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) console.log("Deploying to %s with deployer %s", HomeChains[chainId], deployer); const klerosCore = await deployments.get("KlerosCore"); + const disputeTemplateRegistry = await deployments.get("DisputeTemplateRegistry"); const extraData = "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003"; // General court, 3 jurors const weth = await deployments.get("WETH"); await deploy("ArbitrableExample", { from: deployer, - args: [klerosCore.address, disputeTemplate, extraData, weth.address], + args: [klerosCore.address, disputeTemplate, extraData, disputeTemplateRegistry.address, weth.address], log: true, }); await deploy("DisputeResolver", { from: deployer, - args: [klerosCore.address], + args: [klerosCore.address, disputeTemplateRegistry.address], log: true, }); }; diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index 6b68badbb..701832e29 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -121,9 +121,15 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) await execute("KlerosCore", { from: deployer, log: true }, "changeCurrencyRates", dai, 60327783, 11); await execute("KlerosCore", { from: deployer, log: true }, "changeCurrencyRates", weth, 1, 1); + const disputeTemplateRegistry = await deploy("DisputeTemplateRegistry", { + from: deployer, + args: [], + log: true, + }); + await deploy("DisputeResolver", { from: deployer, - args: [klerosCore.address], + args: [klerosCore.address, disputeTemplateRegistry.address], log: true, }); }; diff --git a/contracts/deploy/03-vea-mock.ts b/contracts/deploy/03-vea-mock.ts index 6bf753ce5..eff18b679 100644 --- a/contracts/deploy/03-vea-mock.ts +++ b/contracts/deploy/03-vea-mock.ts @@ -18,6 +18,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) console.log("Deploying to chainId %s with deployer %s", HARDHAT_NETWORK, deployer); const klerosCore = await deployments.get("KlerosCore"); + const disputeTemplateRegistry = await deployments.get("DisputeTemplateRegistry"); const vea = await deploy("VeaMock", { from: deployer, @@ -67,7 +68,13 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const extraData = "0x00"; await deploy("ArbitrableExample", { from: deployer, - args: [foreignGateway.address, disputeTemplate, extraData, ethers.constants.AddressZero], + args: [ + foreignGateway.address, + disputeTemplate, + extraData, + disputeTemplateRegistry.address, + ethers.constants.AddressZero, + ], log: true, }); }; diff --git a/contracts/deploy/04-foreign-arbitrable.ts b/contracts/deploy/04-foreign-arbitrable.ts index 725c5c03c..f3dbe61c0 100644 --- a/contracts/deploy/04-foreign-arbitrable.ts +++ b/contracts/deploy/04-foreign-arbitrable.ts @@ -31,10 +31,11 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const extraData = "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003"; // General court, 3 jurors + const disputeTemplateRegistry = await deployments.get("DisputeTemplateRegistry"); const weth = await deployments.get("WETH"); await deploy("ArbitrableExample", { from: deployer, - args: [foreignGateway.address, disputeTemplate, extraData, weth.address], + args: [foreignGateway.address, disputeTemplate, extraData, disputeTemplateRegistry.address, weth.address], log: true, }); }; diff --git a/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts b/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts index c96bbf326..6b48ea4a0 100644 --- a/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts +++ b/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts @@ -99,9 +99,10 @@ const deployKlerosLiquid: DeployFunction = async (hre: HardhatRuntimeEnvironment ); // const xKlerosLiquidV2 = await deployments.get("xKlerosLiquidV2"); + const disputeTemplateRegistry = await deployments.get("DisputeTemplateRegistry"); await deploy("ArbitrableExample", { from: deployer, - args: [xKlerosLiquidV2.address, 0, disputeTemplate, extraData, weth.address], + args: [xKlerosLiquidV2.address, 0, disputeTemplate, extraData, disputeTemplateRegistry.address, weth.address], log: true, maxFeePerGas: ONE_GWEI, maxPriorityFeePerGas: ONE_GWEI, diff --git a/contracts/deploy/04-resolver-to-v2-gnosis.ts b/contracts/deploy/04-resolver-to-v2-gnosis.ts index ceed24413..d4318d00c 100644 --- a/contracts/deploy/04-resolver-to-v2-gnosis.ts +++ b/contracts/deploy/04-resolver-to-v2-gnosis.ts @@ -20,10 +20,11 @@ const deployResolver: DeployFunction = async (hre: HardhatRuntimeEnvironment) => console.log("Deploying to chainId %s with deployer %s", chainId, deployer); const foreignGateway = await deployments.get("ForeignGatewayOnGnosis"); + const disputeTemplateRegistry = await deployments.get("DisputeTemplateRegistry"); await deploy("DisputeResolver", { from: deployer, - args: [foreignGateway.address], + args: [foreignGateway.address, disputeTemplateRegistry.address], log: true, maxFeePerGas: ONE_GWEI, maxPriorityFeePerGas: ONE_GWEI, diff --git a/contracts/test/evidence/index.ts b/contracts/test/evidence/index.ts index 281dc119f..6f1c5803b 100644 --- a/contracts/test/evidence/index.ts +++ b/contracts/test/evidence/index.ts @@ -36,6 +36,7 @@ describe("Home Evidence contract", async () => { let arbitrator; let evidenceModule; + let disputeTemplateRegistry; beforeEach("Setup contracts", async () => { [deployer, user1, user2, user3, user4] = await ethers.getSigners(); @@ -43,10 +44,14 @@ describe("Home Evidence contract", async () => { const Arbitrator = await ethers.getContractFactory("CentralizedArbitrator"); arbitrator = await Arbitrator.deploy(String(arbitrationFee), appealTimeout, String(appealFee)); + const DisputeTemplateRegistry = await ethers.getContractFactory("DisputeTemplateRegistry"); + disputeTemplateRegistry = await DisputeTemplateRegistry.deploy(); + const EvidenceModule = await ethers.getContractFactory("ModeratedEvidenceModule"); evidenceModule = await EvidenceModule.deploy( arbitrator.address, deployer.address, // governor + disputeTemplateRegistry.address, totalCostMultiplier, initialDepositMultiplier, bondTimeout, @@ -80,7 +85,12 @@ describe("Home Evidence contract", async () => { expect(newArbitratorData.disputeTemplateId).to.equal(oldArbitratorData.disputeTemplateId.add(BigNumber.from(1))); expect(newArbitratorData.arbitratorExtraData).to.equal(oldArbitratorData.arbitratorExtraData); - const [_templateId, _, _templateData] = getEmittedEvent("DisputeTemplate", receipt).args; + const disputeTemplateEvents = await disputeTemplateRegistry.queryFilter( + disputeTemplateRegistry.filters.DisputeTemplate(), + receipt.blockNumber, + receipt.blockNumber + ); + const [_templateId, _, _templateData] = disputeTemplateEvents[0].args; expect(_templateData).to.equal(newDisputeTemplate, "Wrong Template Data."); expect(_templateId).to.equal(newArbitratorData.disputeTemplateId, "Wrong Template ID.");