@@ -29,7 +29,7 @@ contract AnlogTokenV2Test is Test {
2929 using PrimitiveUtils for GmpMessage;
3030 using SigningUtils for SigningKey;
3131
32- AnlogTokenV2 public token ;
32+ AnlogTokenV2 public tokenV2 ;
3333
3434 address constant MINTER = address (0 );
3535 address constant UPGRADER = address (1 );
@@ -59,7 +59,7 @@ contract AnlogTokenV2Test is Test {
5959 /// @notice deploys an UUPS proxy.
6060 /// Here we start with the V2 implementation right away.
6161 /// For V1->V2 upgrade see another test.
62- function setUp () public {
62+ function setUp () public virtual {
6363 sepoliaFork = vm.createFork (SEPOLIA_RPC_URL);
6464 vm.selectFork (sepoliaFork);
6565 assertEq (vm.activeFork (), sepoliaFork);
@@ -71,7 +71,7 @@ contract AnlogTokenV2Test is Test {
7171 address proxy = Upgrades.deployUUPSProxy (
7272 "AnlogTokenV2.sol " , abi.encodeCall (AnlogTokenV2.initialize, (MINTER, UPGRADER, PAUSER, UNPAUSER)), opts
7373 );
74- token = AnlogTokenV2 (proxy);
74+ tokenV2 = AnlogTokenV2 (proxy);
7575 }
7676
7777 modifier setRoute () {
@@ -98,17 +98,17 @@ contract AnlogTokenV2Test is Test {
9898 }
9999
100100 modifier preMint (address to , uint256 amount ) {
101- assertEq (token .totalSupply (), 0 );
101+ assertEq (tokenV2 .totalSupply (), 0 );
102102 vm.prank (MINTER);
103- token .mint (to, amount);
104- assertEq (token .totalSupply (), amount);
105- assertEq (token .balanceOf (to), amount);
103+ tokenV2 .mint (to, amount);
104+ assertEq (tokenV2 .totalSupply (), amount);
105+ assertEq (tokenV2 .balanceOf (to), amount);
106106 _;
107107 }
108108
109109 modifier paused () {
110110 vm.prank (PAUSER);
111- token .pause ();
111+ tokenV2 .pause ();
112112 _;
113113 }
114114
@@ -119,125 +119,125 @@ contract AnlogTokenV2Test is Test {
119119 return Signature ({xCoord: signer.xCoord (), e: e, s: s});
120120 }
121121
122- function test_name_and_ticker () public view {
123- assertEq (token .name (), "Wrapped Analog One Token " );
124- assertEq (token .symbol (), "WANLOG " );
122+ function test_name_and_ticker () public virtual {
123+ assertEq (tokenV2 .name (), "Wrapped Analog One Token " );
124+ assertEq (tokenV2 .symbol (), "WANLOG " );
125125 }
126126
127- function test_decimals () public view {
128- assertEq (token .decimals (), 12 );
127+ function test_decimals () public virtual {
128+ assertEq (tokenV2 .decimals (), 12 );
129129 }
130130
131- function test_Mint () public preMint (address (this ), 20_000 ) {
132- assertEq (token .balanceOf (address (this )), 20_000 );
131+ function test_Mint () public virtual preMint (address (this ), 20_000 ) {
132+ assertEq (tokenV2 .balanceOf (address (this )), 20_000 );
133133 }
134134
135- function test_Transfer () public preMint (address (this ), 20_000 ) {
136- assertEq (token .balanceOf (address (2 )), 0 );
137- token .transfer (address (2 ), 5_000 );
138- assertEq (token .balanceOf (address (2 )), 5_000 );
135+ function test_Transfer () public virtual preMint (address (this ), 20_000 ) {
136+ assertEq (tokenV2 .balanceOf (address (2 )), 0 );
137+ tokenV2 .transfer (address (2 ), 5_000 );
138+ assertEq (tokenV2 .balanceOf (address (2 )), 5_000 );
139139 }
140140
141- function test_Pause () public preMint (address (this ), 20_000 ) paused {
141+ function test_Pause () public virtual preMint (address (this ), 20_000 ) paused {
142142 // error EnforcedPause()
143143 vm.expectRevert (PausableUpgradeable.EnforcedPause.selector );
144- token .transfer (address (2 ), 5_000 );
144+ tokenV2 .transfer (address (2 ), 5_000 );
145145
146146 vm.prank (MINTER);
147147 vm.expectRevert (PausableUpgradeable.EnforcedPause.selector );
148- token .mint (address (this ), 1 );
148+ tokenV2 .mint (address (this ), 1 );
149149 }
150150
151- function test_UnPause () public preMint (address (this ), 20_000 ) paused {
151+ function test_UnPause () public virtual preMint (address (this ), 20_000 ) paused {
152152 vm.prank (UNPAUSER);
153- token .unpause ();
153+ tokenV2 .unpause ();
154154
155- token .transfer (address (2 ), 5_000 );
156- assertEq (token .balanceOf (address (2 )), 5_000 );
155+ tokenV2 .transfer (address (2 ), 5_000 );
156+ assertEq (tokenV2 .balanceOf (address (2 )), 5_000 );
157157 }
158158
159- function test_GrantRole () public preMint (address (this ), 20_000 ) {
160- assertFalse (token .hasRole (keccak256 ("MINTER_ROLE " ), NEW_MINTER));
159+ function test_GrantRole () public virtual preMint (address (this ), 20_000 ) {
160+ assertFalse (tokenV2 .hasRole (keccak256 ("MINTER_ROLE " ), NEW_MINTER));
161161
162162 vm.prank (UPGRADER);
163- token .grantRole (keccak256 ("MINTER_ROLE " ), NEW_MINTER);
163+ tokenV2 .grantRole (keccak256 ("MINTER_ROLE " ), NEW_MINTER);
164164
165165 vm.prank (NEW_MINTER);
166- token .mint (NEW_MINTER, 5_000 );
167- assertEq (token .balanceOf (NEW_MINTER), 5_000 );
168- assertEq (token .totalSupply (), 25_000 );
166+ tokenV2 .mint (NEW_MINTER, 5_000 );
167+ assertEq (tokenV2 .balanceOf (NEW_MINTER), 5_000 );
168+ assertEq (tokenV2 .totalSupply (), 25_000 );
169169 }
170170
171- function test_RevokeRole () public preMint (address (this ), 20_000 ) {
171+ function test_RevokeRole () public virtual preMint (address (this ), 20_000 ) {
172172 vm.prank (UPGRADER);
173- token .revokeRole (keccak256 ("MINTER_ROLE " ), MINTER);
173+ tokenV2 .revokeRole (keccak256 ("MINTER_ROLE " ), MINTER);
174174
175175 vm.prank (MINTER);
176176 vm.expectRevert (
177177 abi.encodeWithSelector (
178178 IAccessControl.AccessControlUnauthorizedAccount.selector , MINTER, keccak256 ("MINTER_ROLE " )
179179 )
180180 );
181- token .mint (MINTER, 5_000 );
181+ tokenV2 .mint (MINTER, 5_000 );
182182 }
183183
184- function test_RevertWhen_Unauthorized_RevokeRole () public {
184+ function test_RevertWhen_Unauthorized_RevokeRole () public virtual {
185185 vm.prank (PAUSER);
186186 vm.expectRevert (abi.encodeWithSelector (IAccessControl.AccessControlUnauthorizedAccount.selector , PAUSER, 0x00 ));
187- token .revokeRole (keccak256 ("MINTER_ROLE " ), MINTER);
187+ tokenV2 .revokeRole (keccak256 ("MINTER_ROLE " ), MINTER);
188188
189- assert (token .hasRole (keccak256 ("MINTER_ROLE " ), MINTER));
189+ assert (tokenV2 .hasRole (keccak256 ("MINTER_ROLE " ), MINTER));
190190 }
191191
192- function test_RevertWhen_Unauthorized_Mint () public {
192+ function test_RevertWhen_Unauthorized_Mint () public virtual {
193193 vm.prank (UPGRADER);
194194 vm.expectRevert (
195195 abi.encodeWithSelector (
196196 IAccessControl.AccessControlUnauthorizedAccount.selector , UPGRADER, keccak256 ("MINTER_ROLE " )
197197 )
198198 );
199- token .mint (UPGRADER, 100_000 );
199+ tokenV2 .mint (UPGRADER, 100_000 );
200200 }
201201
202- function test_RevertWhen_Unauthorized_Pause () public {
202+ function test_RevertWhen_Unauthorized_Pause () public virtual {
203203 vm.prank (MINTER);
204204 vm.expectRevert (
205205 abi.encodeWithSelector (
206206 IAccessControl.AccessControlUnauthorizedAccount.selector , MINTER, keccak256 ("PAUSER_ROLE " )
207207 )
208208 );
209- token .pause ();
209+ tokenV2 .pause ();
210210 }
211211
212- function test_RevertWhen_Unauthorized_UnPause () public paused {
212+ function test_RevertWhen_Unauthorized_UnPause () public virtual paused {
213213 vm.prank (MINTER);
214214 vm.expectRevert (
215215 abi.encodeWithSelector (
216216 IAccessControl.AccessControlUnauthorizedAccount.selector , MINTER, keccak256 ("UNPAUSER_ROLE " )
217217 )
218218 );
219- token .unpause ();
219+ tokenV2 .unpause ();
220220 }
221221
222- function test_TeleportOut_Below_ED () public preMint (address (this ), MIN_TELEPORT_VAL - 1 ) {
222+ function test_TeleportOut_Below_ED () public virtual preMint (address (this ), MIN_TELEPORT_VAL - 1 ) {
223223 bytes32 dest = bytes32 (bytes20 (UPGRADER));
224224 vm.expectRevert ("value below minimum required " );
225- token .teleport (dest, MIN_TELEPORT_VAL - 1 );
225+ tokenV2 .teleport (dest, MIN_TELEPORT_VAL - 1 );
226226 }
227227
228- function test_TeleportOut_Low_Value () public preMint (address (this ), MIN_TELEPORT_VAL) setRoute {
228+ function test_TeleportOut_Low_Value () public virtual preMint (address (this ), MIN_TELEPORT_VAL) setRoute {
229229 bytes32 dest = bytes32 (bytes20 (uint160 (UPGRADER)));
230230
231- vm.expectEmit (address (token ));
231+ vm.expectEmit (address (tokenV2 ));
232232 emit IERC20 .Transfer (address (this ), address (0 ), MIN_TELEPORT_VAL);
233233 vm.expectRevert ("insufficient tx value " );
234- token .teleport (dest, MIN_TELEPORT_VAL);
234+ tokenV2 .teleport (dest, MIN_TELEPORT_VAL);
235235 }
236236
237- function test_TeleportOut () public preMint (address (this ), MIN_TELEPORT_VAL) setRoute {
237+ function test_TeleportOut () public virtual preMint (address (this ), MIN_TELEPORT_VAL) setRoute {
238238 address payable gw = payable (GATEWAY);
239239 bytes32 dest = bytes32 (uint256 (uint160 (UPGRADER)));
240- uint256 cost = token .estimateTeleportCost ();
240+ uint256 cost = tokenV2 .estimateTeleportCost ();
241241
242242 GmpSender source = GmpSender.wrap (bytes32 (uint256 (uint160 (SIGNER_ADDRESS))));
243243
@@ -256,7 +256,7 @@ contract AnlogTokenV2Test is Test {
256256
257257 bytes32 messageID = gmp.eip712hash ();
258258
259- vm.expectEmit (address (token ));
259+ vm.expectEmit (address (tokenV2 ));
260260 emit IERC20 .Transfer (address (this ), address (0 ), MIN_TELEPORT_VAL);
261261
262262 vm.expectEmit (true , true , true , true , address (GATEWAY));
@@ -271,13 +271,13 @@ contract AnlogTokenV2Test is Test {
271271 gmp.data
272272 );
273273
274- vm.expectEmit (true , true , true , true , address (token ));
274+ vm.expectEmit (true , true , true , true , address (tokenV2 ));
275275 emit AnlogTokenV2.OutboundTransfer (messageID, address (this ), dest, MIN_TELEPORT_VAL);
276276
277- token .teleport {value: cost}(dest, MIN_TELEPORT_VAL);
277+ tokenV2 .teleport {value: cost}(dest, MIN_TELEPORT_VAL);
278278 }
279279
280- function test_TeleportIn () public setRoute setShard {
280+ function test_TeleportIn () public virtual setRoute setShard {
281281 address payable gw = payable (GATEWAY);
282282 GmpSender source = GmpSender.wrap (bytes32 (uint256 (uint160 (0 ))));
283283
@@ -287,14 +287,14 @@ contract AnlogTokenV2Test is Test {
287287 GmpMessage memory gmp = GmpMessage ({
288288 source: source,
289289 srcNetwork: TIMECHAIN_ID,
290- dest: address (token ),
290+ dest: address (tokenV2 ),
291291 destNetwork: Gateway (gw).networkId (),
292292 gasLimit: 100_000 ,
293293 nonce: 0 ,
294294 data: abi.encode (command)
295295 });
296296
297- assertEq (token .totalSupply (), 0 );
297+ assertEq (tokenV2 .totalSupply (), 0 );
298298
299299 Signature memory sig = sign (gmp);
300300 bytes32 messageID = gmp.eip712hash ();
@@ -305,7 +305,7 @@ contract AnlogTokenV2Test is Test {
305305 Gateway (gw).execute (sig, gmp);
306306 assertTrue (Gateway (gw).gmpInfo (messageID).status == GmpStatus.SUCCESS, "failed to execute GMP message " );
307307
308- assertEq (token .balanceOf (UPGRADER), MIN_TELEPORT_VAL);
309- assertEq (token .totalSupply (), MIN_TELEPORT_VAL);
308+ assertEq (tokenV2 .balanceOf (UPGRADER), MIN_TELEPORT_VAL);
309+ assertEq (tokenV2 .totalSupply (), MIN_TELEPORT_VAL);
310310 }
311311}
0 commit comments