Skip to content

Commit 80cd463

Browse files
zmalatraxjaybuidl
authored andcommitted
feat(proxy): update test script
1 parent 6c27574 commit 80cd463

File tree

1 file changed

+57
-26
lines changed

1 file changed

+57
-26
lines changed

contracts/test/arbitration/index.ts

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from "chai";
2-
import { ethers } from "hardhat";
2+
import { deployments, ethers } from "hardhat";
33
import { BigNumber } from "ethers";
44
import getContractAddress from "../../deploy-helpers/getContractAddress";
55

@@ -83,34 +83,65 @@ async function deployContracts(deployer) {
8383
await disputeKit.deployed();
8484
let nonce;
8585
nonce = await deployer.getTransactionCount();
86-
nonce += 1;
86+
nonce += 3; // SortitionModule is upgradeable, it deploys an implementation and a proxy
8787
const KlerosCoreAddress = getContractAddress(deployer.address, nonce);
8888

89-
const sortitionModuleFactory = await ethers.getContractFactory("SortitionModule", deployer);
90-
const sortitionModule = await sortitionModuleFactory.deploy(
91-
deployer.address,
92-
KlerosCoreAddress,
93-
120,
94-
120,
95-
rng.address,
96-
LOOKAHEAD
97-
); // minStakingTime, maxFreezingTime
98-
99-
const klerosCoreFactory = await ethers.getContractFactory("KlerosCore", {
100-
signer: deployer,
89+
const sortitionModuleDeployment = await deployments.deploy("SortitionModule_DisputeKitClassic", {
90+
contract: "SortitionModule",
91+
from: deployer.address,
92+
proxy: {
93+
proxyContract: "UUPSProxy",
94+
proxyArgs: ["{implementation}", "{data}"],
95+
execute: {
96+
init: {
97+
methodName: "initialize",
98+
args: [deployer.address, KlerosCoreAddress, 120, 120, rng.address, LOOKAHEAD], // minStakingTime, maxFreezingTime
99+
},
100+
onUpgrade: {
101+
methodName: "governor",
102+
args: [],
103+
},
104+
},
105+
},
106+
log: true,
107+
args: [],
101108
});
102-
const core = await klerosCoreFactory.deploy(
103-
deployer.address,
104-
ethers.constants.AddressZero, // should be an ERC20
105-
ethers.constants.AddressZero, // should be a Juror Prosecution module
106-
disputeKit.address,
107-
false,
108-
[200, 10000, 100, 3],
109-
[0, 0, 0, 0],
110-
0xfa,
111-
sortitionModule.address
112-
);
113-
await core.deployed();
109+
110+
const sortitionModule = await ethers.getContractAt("SortitionModule", sortitionModuleDeployment.address);
111+
112+
const coreDeployment = await deployments.deploy("KlerosCore_DisputeKitClassic", {
113+
contract: "KlerosCore",
114+
from: deployer.address,
115+
proxy: {
116+
proxyContract: "UUPSProxy",
117+
proxyArgs: ["{implementation}", "{data}"],
118+
checkProxyAdmin: false,
119+
checkABIConflict: false,
120+
execute: {
121+
init: {
122+
methodName: "initialize",
123+
args: [
124+
deployer.address,
125+
ethers.constants.AddressZero, // should be an ERC20
126+
ethers.constants.AddressZero, // should be a Juror Prosecution module
127+
disputeKit.address,
128+
false,
129+
[200, 10000, 100, 3],
130+
[0, 0, 0, 0],
131+
"0xfa",
132+
sortitionModule.address,
133+
],
134+
},
135+
onUpgrade: {
136+
methodName: "governor",
137+
args: [],
138+
},
139+
},
140+
},
141+
args: [],
142+
log: true,
143+
});
144+
const core = await ethers.getContractAt("KlerosCore", coreDeployment.address);
114145

115146
await disputeKit.changeCore(core.address);
116147

0 commit comments

Comments
 (0)