Skip to content

Commit bc5502a

Browse files
authored
Merge pull request #84 from kleros/chore/devnet-redeploy-jul2025
Arbitrator devnet redeploy
2 parents f780881 + 46838e7 commit bc5502a

File tree

8 files changed

+367
-237
lines changed

8 files changed

+367
-237
lines changed

contracts/hardhat.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import "hardhat-deploy-ethers";
1111
import "hardhat-watcher";
1212
import "hardhat-docgen";
1313
require("./scripts/setDisputeTemplate");
14+
require("./scripts/changeArbitrator");
1415
// import "hardhat-contract-sizer"; // prevents hardhat-deploy from finding chalk...
1516
// import "hardhat-tracer"; // prevents hardhat-deploy from finding chalk...
1617

contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@
8686
},
8787
"dependencies": {
8888
"@kleros/curate-v2-templates": "workspace:^",
89-
"@kleros/kleros-v2-contracts": "^0.9.3"
89+
"@kleros/kleros-v2-contracts": "^0.10.0"
9090
}
9191
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { task } from "hardhat/config";
2+
import { CurateFactory, CurateV2 } from "../typechain-types";
3+
import { DeploymentName, getContractsEthers } from "@kleros/kleros-v2-contracts";
4+
5+
const NETWORK_TO_DEPLOYMENT: Record<string, DeploymentName> = {
6+
arbitrumSepoliaDevnet: "devnet",
7+
arbitrumSepolia: "testnet",
8+
arbitrum: "mainnetNeo",
9+
} as const;
10+
11+
task("change-arbitrator", "Changes the arbitrator").setAction(async (args, hre) => {
12+
const { ethers, deployments } = hre;
13+
const deployer = await ethers.getSigners().then((signers) => signers[0].getAddress());
14+
const networkName = deployments.getNetworkName();
15+
const deploymentName = NETWORK_TO_DEPLOYMENT[networkName];
16+
const { klerosCore, evidence } = await getContractsEthers(ethers.provider, deploymentName);
17+
18+
const changeArbitrator = async (curate: CurateV2) => {
19+
const extraData = await curate.getArbitratorExtraData();
20+
console.log("Changing the arbitrator for", curate.target);
21+
console.log("klerosCore.target", klerosCore.target);
22+
console.log("extraData", extraData);
23+
console.log("evidence.target", evidence.target);
24+
const tx = await curate
25+
.changeArbitrationParams(klerosCore.target, extraData, evidence.target)
26+
.then((tx) => tx.wait());
27+
console.log("Arbitration params changed", tx?.hash);
28+
};
29+
30+
// Update the master copy of CurateV2
31+
console.log("Updating the CurateV2 master copy...");
32+
const curateMaster = await ethers.getContract<CurateV2>("CurateV2");
33+
await changeArbitrator(curateMaster);
34+
35+
// Update every curated lists created by the factory
36+
const factory = await ethers.getContract<CurateFactory>("CurateFactory");
37+
const events = await factory.queryFilter(factory.filters.NewList(), 0, "latest");
38+
console.log(`Found ${events.length} NewList events:`);
39+
for (let i = 0; i < events.length; i++) {
40+
const event = events[i];
41+
const curate = await ethers.getContractAtWithSignerAddress<CurateV2>("CurateV2", event.args._address, deployer);
42+
const governor = await curate.governor();
43+
console.log(
44+
`${i + 1}. List address: ${
45+
curate.target
46+
}, governor: ${governor}, templateIdRegistration: ${await curate.templateIdRegistration()}, templateIdRemoval: ${await curate.templateIdRemoval()}`
47+
);
48+
49+
if (deployer.toLowerCase() !== governor.toLowerCase()) {
50+
console.log(`Skipping curate ${curate.target} - signer ${deployer} is not the governor ${governor}`);
51+
continue;
52+
}
53+
54+
await changeArbitrator(curate);
55+
}
56+
57+
hre.run("set-dispute-template");
58+
});
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { task } from "hardhat/config";
2+
import { HardhatRuntimeEnvironment } from "hardhat/types";
3+
import { IDisputeTemplateRegistry } from "@kleros/kleros-v2-contracts";
4+
5+
task("getDisputeTemplate", "Gets a dispute template by ID")
6+
.addPositionalParam("templateId", "The ID of the template to query")
7+
.setAction(async function ({ templateId }: { templateId: string }, hre: HardhatRuntimeEnvironment) {
8+
const { ethers } = hre;
9+
10+
// Get the contract instance
11+
const disputeTemplateRegistry = await ethers.getContract<IDisputeTemplateRegistry>("DisputeTemplateRegistry");
12+
13+
// Query the events
14+
const filter = disputeTemplateRegistry.filters.DisputeTemplate(BigInt(templateId));
15+
const events = await disputeTemplateRegistry.queryFilter(filter);
16+
17+
if (events.length === 0) {
18+
console.log(`No template found with ID ${templateId}`);
19+
return;
20+
}
21+
22+
// Process events synchronously
23+
for (const event of events) {
24+
console.log("\nTemplate Details:");
25+
console.log("----------------");
26+
console.log(`Template ID: ${event.args._templateId}`);
27+
console.log(`Template Tag: ${event.args._templateTag}`);
28+
console.log(`Template Data: ${event.args._templateData}`);
29+
console.log(`Template Data Mappings: ${event.args._templateDataMappings}`);
30+
console.log(`Block Number: ${event.blockNumber}`);
31+
console.log(`Transaction Hash: ${event.transactionHash}`);
32+
}
33+
});

contracts/scripts/setDisputeTemplate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ task("set-dispute-template", "Sets the dispute template").setAction(async (args,
1818
};
1919

2020
// Update the master copy of CurateV2
21+
console.log("Updating the CurateV2 master copy...");
2122
const curateMaster = await ethers.getContract<CurateV2>("CurateV2");
2223
await changeTemplates(curateMaster);
2324

templates/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const sharedTemplateProperties = `
77
"arbitrableChainID": "421614",
88
"arbitrableAddress": "{{arbitrableAddress}}",
99
"arbitratorChainID": "421614",
10-
"arbitratorAddress": "0x4838e31E0ea315232c431598110FE677cAF2D6E6",
10+
"arbitratorAddress": "0x1Bd44c4a4511DbFa7DC1d5BC201635596E7200f9",
1111
"metadata": {
1212
"itemName": "{{itemName}}",
1313
"itemDescription": "{{itemDescription}}",

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@graphql-codegen/cli": "^4.0.1",
4848
"@graphql-codegen/client-preset": "^4.2.0",
4949
"@kleros/curate-v2-tsconfig": "workspace:^",
50-
"@kleros/kleros-v2-contracts": "^0.9.3",
50+
"@kleros/kleros-v2-contracts": "^0.10.0",
5151
"@types/react": "^18.3.12",
5252
"@types/react-dom": "^18.3.1",
5353
"@types/react-modal": "^3.16.3",

0 commit comments

Comments
 (0)