From 401c99fdb9fa1fac5e93344a9db908e1b9f45575 Mon Sep 17 00:00:00 2001 From: gzeon <95478735+gzeoneth@users.noreply.github.com> Date: Thu, 4 May 2023 00:28:15 +0800 Subject: [PATCH] refacotr: get inbox address from arb sdk --- index.ts | 5 +++-- utils/clients/tenderly.ts | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 8cf73aaf2a4..7b530012585 100644 --- a/index.ts +++ b/index.ts @@ -6,7 +6,7 @@ import dotenv from 'dotenv' dotenv.config() import { BigNumber, BigNumberish, Contract } from 'ethers' import { DAO_NAME, GOVERNOR_ADDRESS, SIM_NAME } from './utils/constants' -import { provider } from './utils/clients/ethers' +import { arb1provider, l1provider, provider } from './utils/clients/ethers' import { simulate } from './utils/clients/tenderly' import { AllCheckResults, GovernorType, SimulationConfig, SimulationConfigBase, SimulationConfigArbL2ToL1, SimulationData, SimulationResult, SimulationConfigArbRetryable } from './types' import ALL_CHECKS from './checks' @@ -28,6 +28,7 @@ import { EventArgs, parseTypedLogs } from '@arbitrum/sdk/dist/lib/dataEntities/e import { InboxMessageDeliveredEvent } from '@arbitrum/sdk/dist/lib/abi/Inbox' import { MessageDeliveredEvent } from '@arbitrum/sdk/dist/lib/abi/Bridge' import { InboxMessageKind } from '@arbitrum/sdk/dist/lib/dataEntities/message' +import { getL2Network }from '@arbitrum/sdk' // This function find L2ToL1 events in a simulation result and create a new simulation for each of them async function simL2toL1(sr: SimulationResult, simname:string){ @@ -78,7 +79,7 @@ async function simRetryable(sr: SimulationResult, simname:string){ bridgeMessageEvent: EventArgs }[] = [] for (const bm of bridgeMessages) { - if (bm.inbox !== '0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f') continue // arb1 inbox + if (bm.inbox !== (await getL2Network(arb1provider as any)).ethBridge.inbox) continue // arb1 inbox const im = inboxMessages.filter(i => i.messageNum.eq(bm.messageIndex))[0] if (!im) { throw new Error( diff --git a/utils/clients/tenderly.ts b/utils/clients/tenderly.ts index d360357e2ed..e1aa4a4c39e 100644 --- a/utils/clients/tenderly.ts +++ b/utils/clients/tenderly.ts @@ -553,7 +553,6 @@ async function simulateArbitrumL2ToL1(config: SimulationConfigArbL2ToL1): Promis const network = await l1provider.getNetwork() const blockNumberToUse = (await getLatestBlock(network.chainId)) - 3 // subtracting a few blocks to ensure tenderly has the block const latestBlock = await l1provider.getBlock(blockNumberToUse) - // const governor = getGovernor(governorType, governorAddress) const proposalId = BigNumber.from(parentId).add(config.idoffset) @@ -662,7 +661,6 @@ async function simulateArbitrumRetryable(config: SimulationConfigArbRetryable): const network = await arb1provider.getNetwork() const blockNumberToUse = (await getLatestBlock(network.chainId)) - 3 // subtracting a few blocks to ensure tenderly has the block const latestBlock = await arb1provider.getBlock(blockNumberToUse) - // const governor = getGovernor(governorType, governorAddress) const proposalId = BigNumber.from(parentId).add(config.idoffset)