@@ -3,52 +3,46 @@ const config = require('../config/config.json')
33const hre = require ( 'hardhat' )
44
55async function main ( ) {
6- let fxChild
6+ let fxChild , erc20Token , erc721Token , erc1155Token
77
88 const network = await hre . ethers . provider . getNetwork ( )
99
1010 if ( network . chainId === 137 ) { // Polygon Mainnet
1111 fxChild = config . mainnet . fxChild . address
12+ erc20Token = config . mainnet . fxERC20 . address
13+ erc721Token = config . mainnet . fxERC721 . address
14+ erc1155Token = config . mainnet . fxERC1155 . address
1215 } else if ( network . chainId === 80001 ) { // Mumbai Testnet
1316 fxChild = config . testnet . fxChild . address
17+ erc20Token = config . testnet . fxERC20 . address
18+ erc721Token = config . testnet . fxERC721 . address
19+ erc1155Token = config . testnet . fxERC1155 . address
1420 } else {
1521 fxChild = process . env . FX_CHILD
22+ erc20Token = process . env . FX_ERC20
23+ erc721Token = process . env . FX_ERC721
24+ erc1155Token = process . env . FX_ERC1155
1625 }
1726
18- const ERC20Token = await hre . ethers . getContractFactory ( 'FxERC20' )
19- const erc20Token = await ERC20Token . deploy ( )
20- console . log ( erc20Token . deployTransaction )
21- await erc20Token . deployTransaction . wait ( )
22- console . log ( 'FxERC20 deployed to:' , erc20Token . address )
23-
2427 const ERC20 = await hre . ethers . getContractFactory ( 'FxERC20ChildTunnel' )
25- const erc20 = await ERC20 . deploy ( fxChild , erc20Token . address )
28+ const erc20 = await ERC20 . deploy ( fxChild , erc20Token )
2629 await erc20 . deployTransaction . wait ( )
2730 console . log ( 'ERC20ChildTunnel deployed to:' , erc20 . address )
28-
29- const ERC721Token = await hre . ethers . getContractFactory ( 'FxERC721' )
30- const erc721Token = await ERC721Token . deploy ( )
31- console . log ( erc721Token . deployTransaction )
32- await erc721Token . deployTransaction . wait ( )
33- console . log ( 'FxERC721 deployed to:' , erc721Token . address )
31+ console . log ( 'npx hardhat verify --network mumbai' , erc20 . address , fxChild , erc20Token )
3432
3533 const ERC721 = await hre . ethers . getContractFactory ( 'FxERC721ChildTunnel' )
36- const erc721 = await ERC721 . deploy ( fxChild , erc721Token . address )
34+ const erc721 = await ERC721 . deploy ( fxChild , erc721Token )
3735 console . log ( erc721 . deployTransaction )
3836 await erc721 . deployTransaction . wait ( )
3937 console . log ( 'ERC721ChildTunnel deployed to:' , erc721 . address )
40-
41- const ERC1155Token = await hre . ethers . getContractFactory ( 'FxERC1155' )
42- const erc1155Token = await ERC1155Token . deploy ( )
43- console . log ( erc1155Token . deployTransaction )
44- await erc1155Token . deployTransaction . wait ( )
45- console . log ( 'FxERC1155 deployed to:' , erc1155Token . address )
38+ console . log ( 'npx hardhat verify --network mumbai' , erc721 . address , fxChild , erc721Token )
4639
4740 const ERC1155 = await hre . ethers . getContractFactory ( 'FxERC1155ChildTunnel' )
48- const erc1155 = await ERC1155 . deploy ( fxChild , erc1155Token . address )
41+ const erc1155 = await ERC1155 . deploy ( fxChild , erc1155Token )
4942 console . log ( erc1155 . deployTransaction )
5043 await erc1155 . deployTransaction . wait ( )
5144 console . log ( 'ERC1155ChildTunnel deployed to:' , erc1155 . address )
45+ console . log ( 'npx hardhat verify --network mumbai' , erc1155 . address , fxChild , erc1155Token )
5246}
5347
5448main ( )
0 commit comments