Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/deploy/01-foreign-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme
await execute(
"ForeignGatewayOnEthereum",
{ from: deployer, log: true },
"changeSubcourtJurorFee",
"changeCourtJurorFee",
0,
ethers.BigNumber.from(10).pow(17)
);
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/03-vea-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment)
await execute(
"ForeignGatewayOnEthereum",
{ from: deployer, log: true },
"changeSubcourtJurorFee",
"changeCourtJurorFee",
0,
ethers.BigNumber.from(10).pow(17)
);
Expand Down
52 changes: 26 additions & 26 deletions contracts/scripts/populateCourts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,70 +41,70 @@ async function main() {
const core = (await ethers.getContractAt("KlerosCore", klerosCoreDeployment.address)) as KlerosCore;

for (const court of courtsV2) {
const subcourtPresent = await core.courts(court.id).catch(() => {});
if (subcourtPresent) {
console.log("Subcourt %d found: %O", court.id, subcourtPresent);
const courtPresent = await core.courts(court.id).catch(() => {});
if (courtPresent) {
console.log("Court %d found: %O", court.id, courtPresent);

// Subcourt.parent and sortitionSumTreeK cannot be changed.
// Court.parent and sortitionSumTreeK cannot be changed.

if (subcourtPresent.hiddenVotes !== court.hiddenVotes) {
if (courtPresent.hiddenVotes !== court.hiddenVotes) {
console.log(
"Subcourt %d: changing hiddenVotes from %d to %d",
"Court %d: changing hiddenVotes from %d to %d",
court.id,
subcourtPresent.hiddenVotes,
courtPresent.hiddenVotes,
court.hiddenVotes
);
await core.changeSubcourtHiddenVotes(court.id, court.hiddenVotes);
await core.changeCourtHiddenVotes(court.id, court.hiddenVotes);
}

if (!subcourtPresent.minStake.eq(court.minStake)) {
console.log("Subcourt %d: changing minStake from %d to %d", court.id, subcourtPresent.minStake, court.minStake);
await core.changeSubcourtMinStake(court.id, court.minStake);
if (!courtPresent.minStake.eq(court.minStake)) {
console.log("Court %d: changing minStake from %d to %d", court.id, courtPresent.minStake, court.minStake);
await core.changeCourtMinStake(court.id, court.minStake);
}

if (!subcourtPresent.alpha.eq(court.alpha)) {
console.log("Subcourt %d: changing alpha from %d to %d", court.id, subcourtPresent.alpha, court.alpha);
await core.changeSubcourtAlpha(court.id, court.alpha);
if (!courtPresent.alpha.eq(court.alpha)) {
console.log("Court %d: changing alpha from %d to %d", court.id, courtPresent.alpha, court.alpha);
await core.changeCourtAlpha(court.id, court.alpha);
}

if (!subcourtPresent.feeForJuror.eq(court.feeForJuror)) {
if (!courtPresent.feeForJuror.eq(court.feeForJuror)) {
console.log(
"Subcourt %d: changing feeForJuror from %d to %d",
"Court %d: changing feeForJuror from %d to %d",
court.id,
subcourtPresent.feeForJuror,
courtPresent.feeForJuror,
court.feeForJuror
);
await core.changeSubcourtJurorFee(court.id, court.feeForJuror);
await core.changeCourtJurorFee(court.id, court.feeForJuror);
}

if (!subcourtPresent.jurorsForCourtJump.eq(court.jurorsForCourtJump)) {
if (!courtPresent.jurorsForCourtJump.eq(court.jurorsForCourtJump)) {
console.log(
"Subcourt %d: changing jurorsForCourtJump from %d to %d",
"Court %d: changing jurorsForCourtJump from %d to %d",
court.id,
subcourtPresent.jurorsForCourtJump,
courtPresent.jurorsForCourtJump,
court.jurorsForCourtJump
);
await core.changeSubcourtJurorsForJump(court.id, court.jurorsForCourtJump);
await core.changeCourtJurorsForJump(court.id, court.jurorsForCourtJump);
}

const timesPerPeriodPresent = (await core.getTimesPerPeriod(court.id)).map((bn) => bn.toNumber());
if (!timesPerPeriodPresent.every((val, index) => val === court.timesPerPeriod[index])) {
console.log(
"Subcourt %d: changing timesPerPeriod from %O to %O",
"Court %d: changing timesPerPeriod from %O to %O",
court.id,
timesPerPeriodPresent,
court.timesPerPeriod
);
await core.changeSubcourtTimesPerPeriod(court.id, [
await core.changeCourtTimesPerPeriod(court.id, [
court.timesPerPeriod[0],
court.timesPerPeriod[1],
court.timesPerPeriod[2],
court.timesPerPeriod[3],
]);
}
} else {
console.log("Subcourt %d not found, creating it with", court.id, court);
await core.createSubcourt(
console.log("Court %d not found, creating it with", court.id, court);
await core.createCourt(
court.parent,
court.hiddenVotes,
court.minStake,
Expand Down
Loading