Skip to content

Commit

Permalink
chore: added dispute template registry to tests and deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybuidl committed Aug 6, 2023
1 parent 94a5f9a commit d66ada5
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 8 deletions.
5 changes: 3 additions & 2 deletions contracts/deploy/00-home-chain-arbitrable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
};
Expand Down
8 changes: 7 additions & 1 deletion contracts/deploy/00-home-chain-arbitration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
};
Expand Down
9 changes: 8 additions & 1 deletion contracts/deploy/03-vea-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
});
};
Expand Down
3 changes: 2 additions & 1 deletion contracts/deploy/04-foreign-arbitrable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
};
Expand Down
3 changes: 2 additions & 1 deletion contracts/deploy/04-klerosliquid-to-v2-gnosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion contracts/deploy/04-resolver-to-v2-gnosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 11 additions & 1 deletion contracts/test/evidence/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,22 @@ describe("Home Evidence contract", async () => {

let arbitrator;
let evidenceModule;
let disputeTemplateRegistry;

beforeEach("Setup contracts", async () => {
[deployer, user1, user2, user3, user4] = await ethers.getSigners();

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,
Expand Down Expand Up @@ -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.");

Expand Down

0 comments on commit d66ada5

Please sign in to comment.