Skip to content

Commit

Permalink
Properly set seq inbox blob reader
Browse files Browse the repository at this point in the history
  • Loading branch information
gvladika committed Feb 13, 2024
1 parent d78de7f commit 2c83dec
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions scripts/deploymentUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ethers } from 'hardhat'
import { ContractFactory, Contract, Overrides } from 'ethers'
import { ContractFactory, Contract, Overrides, ethers } from 'ethers'
import '@nomiclabs/hardhat-ethers'
import { run } from 'hardhat'
import {
Expand All @@ -8,6 +7,8 @@ import {
} from '@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json'
import { maxDataSize } from './config'
import { Toolkit4844 } from '../test/contract/toolkit4844'
import { ArbSys__factory } from '../build/types'
import { ARB_SYS_ADDRESS } from '@arbitrum/sdk/dist/lib/dataEntities/constants'

// Define a verification function
export async function verifyContract(
Expand Down Expand Up @@ -83,11 +84,15 @@ export async function deployUpgradeExecutor(): Promise<Contract> {
export async function deployAllContracts(
signer: any
): Promise<Record<string, Contract>> {
const isOnArb = await _isRunningOnArbitrum(signer)

const ethBridge = await deployContract('Bridge', signer, [])
const reader4844 = await Toolkit4844.deployReader4844(signer)
const reader4844 = isOnArb
? (await Toolkit4844.deployReader4844(signer)).address
: ethers.constants.AddressZero
const ethSequencerInbox = await deployContract('SequencerInbox', signer, [
maxDataSize,
reader4844.address,
reader4844,
false,
])

Expand All @@ -102,7 +107,7 @@ export async function deployAllContracts(
const erc20Bridge = await deployContract('ERC20Bridge', signer, [])
const erc20SequencerInbox = await deployContract('SequencerInbox', signer, [
maxDataSize,
reader4844.address,
reader4844,
true,
])
const erc20Inbox = await deployContract('ERC20Inbox', signer, [maxDataSize])
Expand Down Expand Up @@ -167,3 +172,14 @@ export async function deployAllContracts(
deployHelper,
}
}

// Check if we're deploying to an Arbitrum chain
async function _isRunningOnArbitrum(signer: any): Promise<Boolean> {
const arbSys = ArbSys__factory.connect(ARB_SYS_ADDRESS, signer)
try {
await arbSys.arbOSVersion()
return true
} catch (error) {
return false
}
}

0 comments on commit 2c83dec

Please sign in to comment.