Skip to content

Commit

Permalink
refacotr: get inbox address from arb sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
gzeoneth committed May 3, 2023
1 parent f19f476 commit 401c99f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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){
Expand Down Expand Up @@ -78,7 +79,7 @@ async function simRetryable(sr: SimulationResult, simname:string){
bridgeMessageEvent: EventArgs<MessageDeliveredEvent>
}[] = []
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(
Expand Down
2 changes: 0 additions & 2 deletions utils/clients/tenderly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 401c99f

Please sign in to comment.