Skip to content

Commit bfaefd2

Browse files
committed
chore: keeper bot script
1 parent a22ade0 commit bfaefd2

File tree

6 files changed

+76
-71
lines changed

6 files changed

+76
-71
lines changed

contracts/scripts/deploy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ async function main() {
1717
const ConstantRNG = await ethers.getContractFactory("ConstantNG");
1818
const constantRNG = await ConstantRNG.deploy(42);
1919

20-
await constantRNG.deployed();
20+
await constantRNG.deploymentTransaction();
2121

22-
console.log("ConstantRNG deployed to:", constantRNG.address);
22+
console.log("ConstantRNG deployed to:", constantRNG.target);
2323
}
2424

2525
// We recommend this pattern to be able to use async/await everywhere

contracts/scripts/disputeCreatorBot.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import env from "./utils/env";
22
import loggerFactory from "./utils/logger";
33
import hre = require("hardhat");
44
import { KlerosCore, DisputeResolver } from "../typechain-types";
5-
import { BigNumber } from "ethers";
5+
66
const { ethers } = hre;
77

88
const HEARTBEAT_URL = env.optionalNoDefault("HEARTBEAT_URL_DISPUTOR_BOT");
@@ -43,7 +43,7 @@ export default async function main() {
4343
];
4444
const randomTemplate = templates[Math.floor(Math.random() * templates.length)];
4545
const nbOfChoices = 2;
46-
const cost = (await core.functions["arbitrationCost(bytes)"](extraData)).cost;
46+
const cost = await core["arbitrationCost(bytes)"](extraData);
4747
const tx = await resolver.createDisputeForTemplate(
4848
extraData,
4949
randomTemplate,
@@ -55,10 +55,10 @@ export default async function main() {
5555
);
5656

5757
logger.info(`Dispute creation tx: ${tx.hash}`);
58-
const blockNumber = await tx.wait().then((receipt) => receipt.blockNumber);
58+
const blockNumber = await tx.wait().then((receipt) => receipt?.blockNumber);
5959
const disputeId = await resolver
6060
.queryFilter(resolver.filters.DisputeRequest(), blockNumber, blockNumber)
61-
.then((events) => BigNumber.from(events[0].args[1]));
61+
.then((events) => ethers.toBigInt(events[0].args[1]));
6262
logger.info(`Dispute created with disputeId ${disputeId.toString()}`);
6363

6464
logger.info("Shutting down");

contracts/scripts/getCourtsV1.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const configByChain = new Map<number, Config>([
3737

3838
async function main() {
3939
const chainId = Number(await hre.getChainId());
40-
const courtAddress = configByChain.get(chainId)?.courtAddress ?? hre.ethers.constants.AddressZero;
40+
const courtAddress = configByChain.get(chainId)?.courtAddress ?? hre.ethers.ZeroAddress;
4141
const courtsV1 = (await ethers.getContractAt("IKlerosLiquid", courtAddress)) as IKlerosLiquid;
4242

4343
const courts: Court[] = [];
@@ -47,7 +47,7 @@ async function main() {
4747
(result) =>
4848
({
4949
id: courtId,
50-
parent: result.parent.toNumber(),
50+
parent: ethers.getNumber(result.parent),
5151
hiddenVotes: result.hiddenVotes,
5252
minStake: result.minStake.toString(),
5353
alpha: result.alpha.toString(),
@@ -58,7 +58,7 @@ async function main() {
5858
);
5959

6060
court.timesPerPeriod = await courtsV1.getSubcourt(courtId).then((result) => {
61-
return result.timesPerPeriod.map((bn) => bn.toNumber());
61+
return result.timesPerPeriod.map((bn) => ethers.getNumber(bn));
6262
});
6363

6464
court.id = courtId;

contracts/scripts/getPoliciesV1.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const policyRegistryByChain = new Map<number, string>([
1818

1919
async function main() {
2020
const chainId = Number(await hre.getChainId());
21-
const policyRegistryAddress = policyRegistryByChain.get(chainId) ?? hre.ethers.constants.AddressZero;
21+
const policyRegistryAddress = policyRegistryByChain.get(chainId) ?? hre.ethers.ZeroAddress;
2222
const policyRegistryV1 = await ethers.getContractAt("PolicyRegistry", policyRegistryAddress);
2323

2424
const fetchPolicy = (url: string): Promise<Policy> => {

0 commit comments

Comments
 (0)