@@ -2,7 +2,7 @@ import { parseEther } from "ethers/lib/utils";
22
33import { HardhatRuntimeEnvironment } from "hardhat/types" ;
44import { DeployFunction } from "hardhat-deploy/types" ;
5-
5+ import { ethers } from "hardhat" ;
66import getContractAddress from "../deploy-helpers/getContractAddress" ;
77
88enum ForeignChains {
@@ -15,16 +15,22 @@ const paramsByChainId = {
1515 deposit : parseEther ( "0.1" ) ,
1616 epochPeriod : 86400 , // 1 day
1717 homeChainId : 42161 , // arbitrum
18+ arbInbox : "0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f" , // https://developer.offchainlabs.com/docs/useful_addresses
19+ genesis : 1652709415 // sample genesis time
1820 } ,
1921 4 : {
2022 deposit : parseEther ( "0.1" ) ,
2123 epochPeriod : 120 , // 2 min
22- homeChainId : 421611 ,
24+ homeChainId : 421611 , // arbitrum testnet
25+ arbInbox : "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e" , //https://developer.offchainlabs.com/docs/useful_addresses
26+ genesis : 1652709415 // sample genesis time
2327 } ,
2428 31337 : {
2529 deposit : parseEther ( "0.1" ) ,
2630 epochPeriod : 120 , // 2 min
2731 homeChainId : 31337 ,
32+ arbInbox : ethers . constants . AddressZero ,
33+ genesis : 1652709415 // sample genesis time
2834 } ,
2935} ;
3036
@@ -56,20 +62,25 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme
5662 nonce = await homeChainProvider . getTransactionCount ( deployer ) ;
5763 nonce += 1 ; // HomeGatewayToEthereum deploy tx will the third tx after this on its home network, so we add two to the current nonce.
5864 }
59- const { deposit, epochPeriod, homeChainId } = paramsByChainId [ chainId ] ;
65+ const { deposit, epochPeriod, homeChainId, arbInbox , genesis } = paramsByChainId [ chainId ] ;
6066 const bridgeAlpha = 5000 ;
6167 const homeChainIdAsBytes32 = hexZeroPad ( homeChainId , 32 ) ;
6268 const chainIdAsBytes32 = hexZeroPad ( "0x" + chainId . toString ( 16 ) , 32 ) ;
6369
6470 const homeGatewayAddress = getContractAddress ( deployer , nonce ) ;
6571 console . log ( "calculated future HomeGatewayToEthereum address for nonce %d: %s" , nonce , homeGatewayAddress ) ;
72+ nonce -= 1 ;
73+ const fastBridgeSenderAddress = getContractAddress ( deployer , nonce ) ;
74+ console . log ( "calculated future fastBridgeSender address for nonce %d: %s" , nonce , fastBridgeSenderAddress ) ;
6675
6776 const fastBridgeReceiver = await deploy ( "FastBridgeReceiverOnEthereum" , {
6877 from : deployer ,
6978 args : [
70- ethers . constants . AddressZero , // should be Arbitrum Inbox
79+ arbInbox , // should be Arbitrum Inbox
7180 deposit ,
7281 epochPeriod ,
82+ fastBridgeSenderAddress ,
83+ genesis // sample genesis time
7384 ] ,
7485 log : true ,
7586 } ) ;
0 commit comments