1+ import { use } from 'chai' ;
12import { ethers } from 'hardhat' ;
23const hre = require ( 'hardhat' ) ;
34const fs = require ( 'fs' ) ;
@@ -19,6 +20,8 @@ async function main() {
1920
2021 let walletImplementationContractName = '' ;
2122 let walletFactoryContractName = 'WalletFactory' ;
23+ let forwarderContractName = 'Forwarder' ;
24+ let forwarderFactoryContractName = 'ForwarderFactory' ;
2225 const chainId = await deployer . getChainId ( ) ;
2326 switch ( await deployer . getChainId ( ) ) {
2427 // https://chainlist.org/
@@ -27,6 +30,8 @@ async function main() {
2730 //hteth
2831 case 17000 :
2932 walletImplementationContractName = 'WalletSimple' ;
33+ forwarderContractName = 'ForwarderV4' ;
34+ forwarderFactoryContractName = 'ForwarderFactoryV4' ;
3035 break ;
3136 //matic
3237 case 137 :
@@ -87,22 +92,24 @@ async function main() {
8792 // In case of new coins like arbeth, opeth, zketh, we need to deploy new forwarder and forwarder factory i.e.
8893 // ForwarderV4 and ForwarderFactoryV4.
8994 // If we have to deploy contracts for the older coins like eth, avax, polygon, we need to deploy Forwarder and ForwarderFactory
90- const Forwarder = await ethers . getContractFactory ( 'ForwarderV4' ) ;
95+ const Forwarder = await ethers . getContractFactory ( forwarderContractName ) ;
9196 const forwarder = await Forwarder . deploy ( gasParams ) ;
9297 await forwarder . deployed ( ) ;
9398 output . forwarderImplementation = forwarder . address ;
94- console . log ( 'ForwarderV4 deployed at ' + forwarder . address ) ;
99+ console . log ( ` ${ forwarderContractName } deployed at ` + forwarder . address ) ;
95100
96101 const ForwarderFactory = await ethers . getContractFactory (
97- 'ForwarderFactoryV4'
102+ forwarderFactoryContractName
98103 ) ;
99104 const forwarderFactory = await ForwarderFactory . deploy (
100105 forwarder . address ,
101106 gasParams
102107 ) ;
103108 await forwarderFactory . deployed ( ) ;
104109 output . forwarderFactory = forwarderFactory . address ;
105- console . log ( 'ForwarderFactoryV4 deployed at ' + forwarderFactory . address ) ;
110+ console . log (
111+ `${ forwarderFactoryContractName } deployed at ` + forwarderFactory . address
112+ ) ;
106113
107114 fs . writeFileSync ( 'output.json' , JSON . stringify ( output ) ) ;
108115
@@ -121,13 +128,13 @@ async function main() {
121128 walletImplementationContractName ,
122129 walletSimple . address ,
123130 [ ] ,
124- `contracts/coins/ ${ walletImplementationContractName } .sol:${ walletImplementationContractName } `
131+ `contracts/${ walletImplementationContractName } .sol:${ walletImplementationContractName } `
125132 ) ;
126133 await verifyContract ( 'WalletFactory' , walletFactory . address , [
127134 walletSimple . address
128135 ] ) ;
129- await verifyContract ( 'ForwarderV4' , forwarder . address , [ ] ) ;
130- await verifyContract ( 'ForwarderFactoryV4' , forwarderFactory . address , [
136+ await verifyContract ( forwarderContractName , forwarder . address , [ ] ) ;
137+ await verifyContract ( forwarderFactoryContractName , forwarderFactory . address , [
131138 forwarder . address
132139 ] ) ;
133140 console . log ( 'Contracts verified' ) ;
0 commit comments