Skip to content

Commit 6c27574

Browse files
zmalatraxjaybuidl
authored andcommitted
feat(proxy): update deployment scripts
1 parent 871fd60 commit 6c27574

File tree

1 file changed

+54
-15
lines changed

1 file changed

+54
-15
lines changed

contracts/deploy/00-home-chain-arbitration.ts

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,36 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
7676
log: true,
7777
});
7878

79-
const nonce = await ethers.provider.getTransactionCount(deployer);
80-
const KlerosCoreAddress = getContractAddress(deployer, nonce + 1);
81-
console.log("calculated future KlerosCore address for nonce %d: %s", nonce, KlerosCoreAddress);
79+
let nonce;
80+
let KlerosCoreAddress;
81+
82+
const klerosCoreDeployment = await deployments.getOrNull("KlerosCore");
83+
if (!klerosCoreDeployment) {
84+
nonce = await ethers.provider.getTransactionCount(deployer);
85+
KlerosCoreAddress = getContractAddress(deployer, nonce + 3); // Deploying an upgradeable version of SortionModule requires 2 transactions instead of 1 (implementation then proxy)
86+
console.log("calculated future KlerosCore address for nonce %d: %s", nonce, KlerosCoreAddress);
87+
} else {
88+
KlerosCoreAddress = klerosCoreDeployment.address;
89+
}
8290

8391
const sortitionModule = await deploy("SortitionModule", {
8492
from: deployer,
85-
args: [deployer, KlerosCoreAddress, 1800, 1800, rng.address, RNG_LOOKAHEAD], // minStakingTime, maxFreezingTime
93+
proxy: {
94+
proxyContract: "UUPSProxy",
95+
proxyArgs: ["{implementation}", "{data}"],
96+
checkProxyAdmin: false,
97+
checkABIConflict: false,
98+
execute: {
99+
init: {
100+
methodName: "initialize",
101+
args: [deployer, KlerosCoreAddress, 1800, 1800, rng.address, RNG_LOOKAHEAD], // minStakingTime, maxFreezingTime
102+
},
103+
onUpgrade: {
104+
methodName: "governor",
105+
args: [],
106+
},
107+
},
108+
},
86109
log: true,
87110
});
88111

@@ -94,17 +117,33 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
94117
const feeForJuror = BigNumber.from(10).pow(17);
95118
const klerosCore = await deploy("KlerosCore", {
96119
from: deployer,
97-
args: [
98-
deployer,
99-
pnk,
100-
AddressZero,
101-
disputeKit.address,
102-
false,
103-
[minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump
104-
[0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod
105-
ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K
106-
sortitionModule.address,
107-
],
120+
proxy: {
121+
proxyContract: "UUPSProxy",
122+
proxyArgs: ["{implementation}", "{data}"],
123+
checkProxyAdmin: false,
124+
checkABIConflict: false,
125+
execute: {
126+
init: {
127+
methodName: "initialize",
128+
args: [
129+
deployer,
130+
pnk,
131+
AddressZero,
132+
disputeKit.address,
133+
false,
134+
[minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump
135+
[0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod
136+
ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K
137+
sortitionModule.address,
138+
],
139+
},
140+
onUpgrade: {
141+
methodName: "governor",
142+
args: [],
143+
},
144+
},
145+
},
146+
args: [],
108147
log: true,
109148
});
110149

0 commit comments

Comments
 (0)