@@ -9,13 +9,10 @@ const {
9
9
constants : { AddressZero } ,
10
10
utils : { defaultAbiCoder, keccak256, toUtf8Bytes } ,
11
11
} = ethers ;
12
-
13
12
const { deployAll, deployContract } = require ( '../scripts/deploy' ) ;
14
13
const { getRandomBytes32, expectRevert } = require ( './utils' ) ;
15
14
16
- // const MESSAGE_TYPE_INTERCHAIN_TRANSFER = 0;
17
15
const MESSAGE_TYPE_DEPLOY_INTERCHAIN_TOKEN = 1 ;
18
- // const MESSAGE_TYPE_DEPLOY_TOKEN_MANAGER = 2;
19
16
20
17
const LOCK_UNLOCK = 2 ;
21
18
const MINT_BURN = 0 ;
@@ -35,7 +32,7 @@ describe('InterchainTokenFactory', () => {
35
32
36
33
before ( async ( ) => {
37
34
[ wallet , otherWallet ] = await ethers . getSigners ( ) ;
38
- [ service , gateway , gasService , tokenFactory ] = await deployAll ( wallet , chainName , [ destinationChain ] ) ;
35
+ ( { service, gateway, gasService, tokenFactory } = await deployAll ( wallet , chainName , [ destinationChain ] ) ) ;
39
36
} ) ;
40
37
41
38
describe ( 'Token Factory Deployment' , async ( ) => {
@@ -72,9 +69,11 @@ describe('InterchainTokenFactory', () => {
72
69
await ( await token . setTokenId ( tokenId ) ) . wait ( ) ;
73
70
}
74
71
75
- it ( 'Should register a token' , async ( ) => {
72
+ before ( async ( ) => {
76
73
await deployToken ( ) ;
74
+ } ) ;
77
75
76
+ it ( 'Should register a token' , async ( ) => {
78
77
const params = defaultAbiCoder . encode ( [ 'bytes' , 'address' ] , [ '0x' , token . address ] ) ;
79
78
80
79
await expect ( tokenFactory . registerCanonicalInterchainToken ( token . address ) )
@@ -84,19 +83,11 @@ describe('InterchainTokenFactory', () => {
84
83
85
84
it ( 'Should initiate a remote interchain token deployment with no original chain name provided' , async ( ) => {
86
85
const gasValue = 1234 ;
87
-
88
- await deployToken ( ) ;
89
-
90
- const params = defaultAbiCoder . encode ( [ 'bytes' , 'address' ] , [ '0x' , token . address ] ) ;
91
86
const payload = defaultAbiCoder . encode (
92
87
[ 'uint256' , 'bytes32' , 'string' , 'string' , 'uint8' , 'bytes' ] ,
93
88
[ MESSAGE_TYPE_DEPLOY_INTERCHAIN_TOKEN , tokenId , name , symbol , decimals , '0x' ] ,
94
89
) ;
95
90
96
- await expect ( tokenFactory . registerCanonicalInterchainToken ( token . address ) )
97
- . to . emit ( service , 'TokenManagerDeployed' )
98
- . withArgs ( tokenId , tokenManagerAddress , LOCK_UNLOCK , params ) ;
99
-
100
91
await expect (
101
92
tokenFactory . deployRemoteCanonicalInterchainToken ( '' , token . address , destinationChain , gasValue , {
102
93
value : gasValue ,
@@ -112,19 +103,11 @@ describe('InterchainTokenFactory', () => {
112
103
113
104
it ( 'Should initiate a remote interchain token deployment' , async ( ) => {
114
105
const gasValue = 1234 ;
115
-
116
- await deployToken ( ) ;
117
-
118
- const params = defaultAbiCoder . encode ( [ 'bytes' , 'address' ] , [ '0x' , token . address ] ) ;
119
106
const payload = defaultAbiCoder . encode (
120
107
[ 'uint256' , 'bytes32' , 'string' , 'string' , 'uint8' , 'bytes' ] ,
121
108
[ MESSAGE_TYPE_DEPLOY_INTERCHAIN_TOKEN , tokenId , name , symbol , decimals , '0x' ] ,
122
109
) ;
123
110
124
- await expect ( tokenFactory . registerCanonicalInterchainToken ( token . address ) )
125
- . to . emit ( service , 'TokenManagerDeployed' )
126
- . withArgs ( tokenId , tokenManagerAddress , LOCK_UNLOCK , params ) ;
127
-
128
111
await expect (
129
112
tokenFactory . deployRemoteCanonicalInterchainToken ( chainName , token . address , destinationChain , gasValue , {
130
113
value : gasValue ,
@@ -138,19 +121,7 @@ describe('InterchainTokenFactory', () => {
138
121
. withArgs ( service . address , destinationChain , service . address , keccak256 ( payload ) , payload ) ;
139
122
} ) ;
140
123
141
- it ( 'Should transfer some tokens to the factory' , async ( ) => {
142
- await deployToken ( ) ;
143
-
144
- const params = defaultAbiCoder . encode ( [ 'bytes' , 'address' ] , [ '0x' , token . address ] ) ;
145
-
146
- await expect ( tokenFactory . registerCanonicalInterchainToken ( token . address ) )
147
- . to . emit ( service , 'TokenManagerDeployed' )
148
- . withArgs ( tokenId , tokenManagerAddress , LOCK_UNLOCK , params ) ;
149
- } ) ;
150
-
151
124
it ( 'Should revert when trying to register a canonical lock/unlock gateway token' , async ( ) => {
152
- await deployToken ( ) ;
153
-
154
125
const tokenCap = 0 ;
155
126
const mintLimit = 0 ;
156
127
const tokenAddress = token . address ;
0 commit comments