Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions contracts/tokenbridge/ethereum/L1AtomicTokenBridgeCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,26 @@ contract L1AtomicTokenBridgeCreator is Initializable, OwnableUpgradeable {
address public l2CustomGatewayTemplate;
address public l2WethGatewayTemplate;
address public l2WethTemplate;
address public l2MulticallTemplate;

// WETH address on L1
address public l1Weth;

// Multicall2 address on L1, this should NOT be ArbMulticall2
address public l1Multicall;

// immutable canonical address for L2 factory
// other canonical addresses (dependent on L2 template implementations) can be fetched through `getCanonicalL2***Address` functions
address public canonicalL2FactoryAddress;

constructor() {
// immutable ArbMulticall2 template deployed on L1
// Note - due to contract size limits, multicall template and its bytecode hash are set in constructor as immutables
address public immutable l2MulticallTemplate;
// code hash used for calculation of L2 multicall address
bytes32 public immutable ARB_MULTICALL_CODE_HASH;

constructor(address _l2MulticallTemplate) {
l2MulticallTemplate = _l2MulticallTemplate;
ARB_MULTICALL_CODE_HASH = keccak256(_creationCodeFor(l2MulticallTemplate.code));
_disableInitializers();
}

Expand Down Expand Up @@ -140,8 +150,8 @@ contract L1AtomicTokenBridgeCreator is Initializable, OwnableUpgradeable {
address _l2CustomGatewayTemplate,
address _l2WethGatewayTemplate,
address _l2WethTemplate,
address _l2MulticallTemplate,
address _l1Weth,
address _l1Multicall,
uint256 _gasLimitForL2FactoryDeployment
) external onlyOwner {
l1Templates = _l1Templates;
Expand All @@ -152,9 +162,9 @@ contract L1AtomicTokenBridgeCreator is Initializable, OwnableUpgradeable {
l2CustomGatewayTemplate = _l2CustomGatewayTemplate;
l2WethGatewayTemplate = _l2WethGatewayTemplate;
l2WethTemplate = _l2WethTemplate;
l2MulticallTemplate = _l2MulticallTemplate;

l1Weth = _l1Weth;
l1Multicall = _l1Multicall;

gasLimitForL2FactoryDeployment = _gasLimitForL2FactoryDeployment;

Expand Down Expand Up @@ -599,6 +609,14 @@ contract L1AtomicTokenBridgeCreator is Initializable, OwnableUpgradeable {
);
}

function getCanonicalL2Multicall(uint256 chainId) public view returns (address) {
return Create2.computeAddress(
_getL2Salt(OrbitSalts.L2_MULTICALL, chainId),
ARB_MULTICALL_CODE_HASH,
canonicalL2FactoryAddress
);
}

function _getFeeToken(address inbox) internal view returns (address) {
address bridge = address(IInbox(inbox).bridge());

Expand Down
11 changes: 11 additions & 0 deletions scripts/atomicTokenBridgeDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
ArbMulticall2__factory,
IRollupCore__factory,
IBridge__factory,
Multicall2__factory,
} from '../build/types'
import {
abi as UpgradeExecutorABI,
Expand Down Expand Up @@ -378,6 +379,9 @@ export const deployL1TokenBridgeCreator = async (
).deploy()
await l2MulticallAddressOnL1.deployed()

const l1Multicall = await new Multicall2__factory(l1Deployer).deploy()
await l1Multicall.deployed()

//// run retryable estimate for deploying L2 factory
const deployFactoryGasParams = await getEstimateForDeployingFactory(
l1Deployer,
Expand All @@ -395,6 +399,7 @@ export const deployL1TokenBridgeCreator = async (
l2WethAddressOnL1.address,
l2MulticallAddressOnL1.address,
l1WethAddress,
l1Multicall.address,
deployFactoryGasParams.gasLimit
)
).wait()
Expand Down Expand Up @@ -503,6 +508,12 @@ export const deployL1TokenBridgeCreator = async (
'l2MulticallAddressOnL1',
l2MulticallAddressOnL1.address
)

await l1Verifier.verifyWithAddress(
'l1Multicall',
l1Multicall.address
)

await new Promise(resolve => setTimeout(resolve, 2000))
console.log('\n\n Contract verification done \n\n')
}
Expand Down
1 change: 1 addition & 0 deletions scripts/contractVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class ContractVerifier {
'contracts/tokenbridge/arbitrum/gateway/L2WethGateway.sol:L2WethGateway',
l2WethAddressOnL1: 'contracts/tokenbridge/libraries/aeWETH.sol:aeWETH',
l2MulticallAddressOnL1: 'contracts/rpc-utils/MulticallV2.sol:ArbMulticall2',
l1Multicall: 'contracts/rpc-utils/MulticallV2.sol:Multicall2',
}

constructor(chainId: number, apiKey: string) {
Expand Down