@@ -3,52 +3,46 @@ const config = require('../config/config.json')
3
3
const hre = require ( 'hardhat' )
4
4
5
5
async function main ( ) {
6
- let fxChild
6
+ let fxChild , erc20Token , erc721Token , erc1155Token
7
7
8
8
const network = await hre . ethers . provider . getNetwork ( )
9
9
10
10
if ( network . chainId === 137 ) { // Polygon Mainnet
11
11
fxChild = config . mainnet . fxChild . address
12
+ erc20Token = config . mainnet . fxERC20 . address
13
+ erc721Token = config . mainnet . fxERC721 . address
14
+ erc1155Token = config . mainnet . fxERC1155 . address
12
15
} else if ( network . chainId === 80001 ) { // Mumbai Testnet
13
16
fxChild = config . testnet . fxChild . address
17
+ erc20Token = config . testnet . fxERC20 . address
18
+ erc721Token = config . testnet . fxERC721 . address
19
+ erc1155Token = config . testnet . fxERC1155 . address
14
20
} else {
15
21
fxChild = process . env . FX_CHILD
22
+ erc20Token = process . env . FX_ERC20
23
+ erc721Token = process . env . FX_ERC721
24
+ erc1155Token = process . env . FX_ERC1155
16
25
}
17
26
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
-
24
27
const ERC20 = await hre . ethers . getContractFactory ( 'FxERC20ChildTunnel' )
25
- const erc20 = await ERC20 . deploy ( fxChild , erc20Token . address )
28
+ const erc20 = await ERC20 . deploy ( fxChild , erc20Token )
26
29
await erc20 . deployTransaction . wait ( )
27
30
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 )
34
32
35
33
const ERC721 = await hre . ethers . getContractFactory ( 'FxERC721ChildTunnel' )
36
- const erc721 = await ERC721 . deploy ( fxChild , erc721Token . address )
34
+ const erc721 = await ERC721 . deploy ( fxChild , erc721Token )
37
35
console . log ( erc721 . deployTransaction )
38
36
await erc721 . deployTransaction . wait ( )
39
37
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 )
46
39
47
40
const ERC1155 = await hre . ethers . getContractFactory ( 'FxERC1155ChildTunnel' )
48
- const erc1155 = await ERC1155 . deploy ( fxChild , erc1155Token . address )
41
+ const erc1155 = await ERC1155 . deploy ( fxChild , erc1155Token )
49
42
console . log ( erc1155 . deployTransaction )
50
43
await erc1155 . deployTransaction . wait ( )
51
44
console . log ( 'ERC1155ChildTunnel deployed to:' , erc1155 . address )
45
+ console . log ( 'npx hardhat verify --network mumbai' , erc1155 . address , fxChild , erc1155Token )
52
46
}
53
47
54
48
main ( )
0 commit comments