@@ -3,6 +3,7 @@ import { DeployFunction } from "hardhat-deploy/types";
33import { ethers } from "hardhat" ;
44
55const HOME_CHAIN_IDS = [ 42161 , 421611 , 31337 ] ; // ArbOne, ArbRinkeby, Hardhat
6+ const epochPeriod = 86400 ; // 24 hours
67
78// TODO: use deterministic deployments
89
@@ -22,7 +23,8 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment)
2223
2324 const fastBridgeSender = await deploy ( "FastBridgeSenderToEthereumMock" , {
2425 from : deployer ,
25- args : [ deployer , fastBridgeReceiver . address , ethers . constants . AddressZero , arbSysMock . address ] ,
26+ contract : "FastBridgeSenderMock" ,
27+ args : [ epochPeriod , fastBridgeReceiver . address , arbSysMock . address ] ,
2628 log : true ,
2729 } ) ; // nonce+0
2830
@@ -32,44 +34,29 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment)
3234
3335 const homeGateway = await deploy ( "HomeGatewayToEthereum" , {
3436 from : deployer ,
35- args : [ klerosCore . address , fastBridgeSender . address , foreignGateway . address , foreignChainId ] ,
37+ contract : "HomeGateway" ,
38+ args : [ deployer , klerosCore . address , fastBridgeSender . address , foreignGateway . address , foreignChainId ] ,
3639 gasLimit : 4000000 ,
3740 log : true ,
3841 } ) ; // nonce+1
3942
40- const fastSender = await hre . ethers
41- . getContractAt ( "FastBridgeSenderToEthereumMock" , fastBridgeSender . address )
42- . then ( ( contract ) => contract . fastBridgeSender ( ) ) ;
43-
44- if ( fastSender === ethers . constants . AddressZero ) {
45- await execute (
46- "FastBridgeSenderToEthereumMock" ,
47- {
48- from : deployer ,
49- log : true ,
50- } ,
51- "changeFastSender" ,
52- homeGateway . address
53- ) ;
54-
55- const outbox = await deploy ( "OutboxMock" , {
56- from : deployer ,
57- args : [ fastBridgeSender . address ] ,
58- log : true ,
59- } ) ;
60-
61- const bridge = await deploy ( "BridgeMock" , {
62- from : deployer ,
63- args : [ outbox . address ] ,
64- log : true ,
65- } ) ;
66-
67- await deploy ( "InboxMock" , {
68- from : deployer ,
69- args : [ bridge . address ] ,
70- log : true ,
71- } ) ;
72- }
43+ const outbox = await deploy ( "OutboxMock" , {
44+ from : deployer ,
45+ args : [ fastBridgeSender . address ] ,
46+ log : true ,
47+ } ) ;
48+
49+ const bridge = await deploy ( "BridgeMock" , {
50+ from : deployer ,
51+ args : [ outbox . address ] ,
52+ log : true ,
53+ } ) ;
54+
55+ await deploy ( "InboxMock" , {
56+ from : deployer ,
57+ args : [ bridge . address ] ,
58+ log : true ,
59+ } ) ;
7360 } ;
7461
7562 // ----------------------------------------------------------------------------------------------
@@ -78,7 +65,8 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment)
7865
7966 const fastBridgeSender = await deploy ( "FastBridgeSenderToEthereum" , {
8067 from : deployer ,
81- args : [ deployer , fastBridgeReceiver . address , ethers . constants . AddressZero ] ,
68+ contract : "FastBridgeSender" ,
69+ args : [ epochPeriod , fastBridgeReceiver . address ] ,
8270 log : true ,
8371 } ) ; // nonce+0
8472
@@ -87,22 +75,10 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment)
8775 const foreignChainId = Number ( await hre . companionNetworks . foreign . getChainId ( ) ) ;
8876 const homeGateway = await deploy ( "HomeGatewayToEthereum" , {
8977 from : deployer ,
90- args : [ klerosCore . address , fastBridgeSender . address , foreignGateway . address , foreignChainId ] ,
78+ contract : "HomeGateway" ,
79+ args : [ deployer , klerosCore . address , fastBridgeSender . address , foreignGateway . address , foreignChainId ] ,
9180 log : true ,
92- } ) ; // nonce+1
93-
94- const fastSender = await hre . ethers
95- . getContractAt ( "FastBridgeSenderToEthereum" , fastBridgeSender . address )
96- . then ( ( contract ) => contract . fastBridgeSender ( ) ) ;
97-
98- if ( fastSender === ethers . constants . AddressZero ) {
99- await execute (
100- "FastBridgeSenderToEthereum" ,
101- { from : deployer , log : true } ,
102- "changeFastSender" ,
103- homeGateway . address
104- ) ;
105- }
81+ } ) ; // nonce+
10682 } ;
10783
10884 // ----------------------------------------------------------------------------------------------
0 commit comments