From a28974355a9c31c4c86bb5c116b221424cf5caf6 Mon Sep 17 00:00:00 2001 From: marino <102478601+kemuru@users.noreply.github.com> Date: Mon, 26 Jun 2023 11:06:19 +0100 Subject: [PATCH 1/2] fix(scripts): handle no mock contract --- contracts/scripts/simulations/utils.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contracts/scripts/simulations/utils.ts b/contracts/scripts/simulations/utils.ts index 895b4105b..bba63c531 100644 --- a/contracts/scripts/simulations/utils.ts +++ b/contracts/scripts/simulations/utils.ts @@ -16,7 +16,7 @@ export enum Period { Appeal, } -export const options = { gasLimit: 10000000, gasPrice: 5000000000 }; +export const options = { gasLimit: 10000000, gasPrice: 50000000000 }; export const getContracts = async (hre) => { const core = (await hre.ethers.getContract("KlerosCore")) as KlerosCore; @@ -25,7 +25,13 @@ export const getContracts = async (hre) => { const pnk = (await hre.ethers.getContract("PNK")) as PNK; const randomizerRng = (await hre.ethers.getContract("RandomizerRNG")) as RandomizerRNG; const arbitrable = (await hre.ethers.getContract("ArbitrableExampleEthFee")) as ArbitrableExampleEthFee; - const randomizerMock = (await hre.ethers.getContract("RandomizerMock")) as RandomizerMock; + let randomizerMock: RandomizerMock | undefined; + + try { + randomizerMock = (await hre.ethers.getContract("RandomizerMock")) as RandomizerMock; + } catch (error) { + console.log("RandomizerMock contract not found"); + } return { core, From 239e7e89e16d2210f5653596a47e6ecfaea23dff Mon Sep 17 00:00:00 2001 From: marino <102478601+kemuru@users.noreply.github.com> Date: Tue, 27 Jun 2023 17:21:35 +0100 Subject: [PATCH 2/2] fix(simulations): shorter way of handling non-existing contract --- contracts/scripts/simulations/utils.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/contracts/scripts/simulations/utils.ts b/contracts/scripts/simulations/utils.ts index bba63c531..58d06959a 100644 --- a/contracts/scripts/simulations/utils.ts +++ b/contracts/scripts/simulations/utils.ts @@ -25,13 +25,7 @@ export const getContracts = async (hre) => { const pnk = (await hre.ethers.getContract("PNK")) as PNK; const randomizerRng = (await hre.ethers.getContract("RandomizerRNG")) as RandomizerRNG; const arbitrable = (await hre.ethers.getContract("ArbitrableExampleEthFee")) as ArbitrableExampleEthFee; - let randomizerMock: RandomizerMock | undefined; - - try { - randomizerMock = (await hre.ethers.getContract("RandomizerMock")) as RandomizerMock; - } catch (error) { - console.log("RandomizerMock contract not found"); - } + const randomizerMock = (await hre.ethers.getContract("RandomizerMock").catch(() => undefined)) as RandomizerMock; return { core,