@@ -10,7 +10,6 @@ import { Wallet } from "./utils/Wallet.sol";
1010import "./utils/BaseTest.sol " ;
1111
1212contract MultiwrapReentrant is MockERC20 , ITokenBundle {
13-
1413 Multiwrap internal multiwrap;
1514 uint256 internal tokenIdOfWrapped = 0 ;
1615
@@ -64,24 +63,30 @@ contract MultiwrapTest is BaseTest {
6463 tokenOwner = getWallet ();
6564 uriForWrappedToken = "ipfs://baseURI/ " ;
6665
67- wrappedContent.push (ITokenBundle.Token ({
68- assetContract: address (erc20),
69- tokenType: ITokenBundle.TokenType.ERC20 ,
70- tokenId: 0 ,
71- totalAmount: 10 ether
72- }));
73- wrappedContent.push (ITokenBundle.Token ({
74- assetContract: address (erc721),
75- tokenType: ITokenBundle.TokenType.ERC721 ,
76- tokenId: 0 ,
77- totalAmount: 1
78- }));
79- wrappedContent.push (ITokenBundle.Token ({
80- assetContract: address (erc1155),
81- tokenType: ITokenBundle.TokenType.ERC1155 ,
82- tokenId: 0 ,
83- totalAmount: 100
84- }));
66+ wrappedContent.push (
67+ ITokenBundle.Token ({
68+ assetContract: address (erc20),
69+ tokenType: ITokenBundle.TokenType.ERC20 ,
70+ tokenId: 0 ,
71+ totalAmount: 10 ether
72+ })
73+ );
74+ wrappedContent.push (
75+ ITokenBundle.Token ({
76+ assetContract: address (erc721),
77+ tokenType: ITokenBundle.TokenType.ERC721 ,
78+ tokenId: 0 ,
79+ totalAmount: 1
80+ })
81+ );
82+ wrappedContent.push (
83+ ITokenBundle.Token ({
84+ assetContract: address (erc1155),
85+ tokenType: ITokenBundle.TokenType.ERC1155 ,
86+ tokenId: 0 ,
87+ totalAmount: 100
88+ })
89+ );
8590
8691 // Mint tokens-to-wrap to `tokenOwner`
8792 erc20.mint (address (tokenOwner), 10 ether);
@@ -103,16 +108,15 @@ contract MultiwrapTest is BaseTest {
103108 * - `wrap`
104109 * - `unwrap`
105110 */
106-
111+
107112 /*///////////////////////////////////////////////////////////////
108113 Unit tests: `wrap`
109114 //////////////////////////////////////////////////////////////*/
110-
115+
111116 /**
112117 * note: Testing state changes; token owner calls `wrap` to wrap owned tokens.
113118 */
114119 function test_state_wrap () public {
115-
116120 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
117121 address recipient = address (0x123 );
118122
@@ -123,7 +127,7 @@ contract MultiwrapTest is BaseTest {
123127
124128 ITokenBundle.Token[] memory contentsOfWrappedToken = multiwrap.getWrappedContents (expectedIdForWrappedToken);
125129 assertEq (contentsOfWrappedToken.length , wrappedContent.length );
126- for (uint256 i = 0 ; i < contentsOfWrappedToken.length ; i += 1 ) {
130+ for (uint256 i = 0 ; i < contentsOfWrappedToken.length ; i += 1 ) {
127131 assertEq (contentsOfWrappedToken[i].assetContract, wrappedContent[i].assetContract);
128132 assertEq (uint256 (contentsOfWrappedToken[i].tokenType), uint256 (wrappedContent[i].tokenType));
129133 assertEq (contentsOfWrappedToken[i].tokenId, wrappedContent[i].tokenId);
@@ -141,7 +145,7 @@ contract MultiwrapTest is BaseTest {
141145 address recipient = address (0x123 );
142146
143147 vm.prank (address (tokenOwner));
144-
148+
145149 vm.expectEmit (true , true , true , true );
146150 emit TokensWrapped (address (tokenOwner), recipient, expectedIdForWrappedToken, wrappedContent);
147151
@@ -152,7 +156,6 @@ contract MultiwrapTest is BaseTest {
152156 * note: Testing token balances; token owner calls `wrap` to wrap owned tokens.
153157 */
154158 function test_balances_wrap () public {
155-
156159 // ERC20 balance
157160 assertEq (erc20.balanceOf (address (tokenOwner)), 10 ether);
158161 assertEq (erc20.balanceOf (address (multiwrap)), 0 );
@@ -163,8 +166,7 @@ contract MultiwrapTest is BaseTest {
163166 // ERC1155 balance
164167 assertEq (erc1155.balanceOf (address (tokenOwner), 0 ), 100 );
165168 assertEq (erc1155.balanceOf (address (multiwrap), 0 ), 0 );
166-
167-
169+
168170 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
169171 address recipient = address (0x123 );
170172
@@ -209,12 +211,11 @@ contract MultiwrapTest is BaseTest {
209211 vm.expectRevert ("ReentrancyGuard: reentrant call " );
210212 multiwrap.wrap (reentrantContentToWrap, uriForWrappedToken, recipient);
211213 }
212-
214+
213215 /**
214216 * note: Testing revert condition; token owner calls `wrap` to wrap owned tokens, without MINTER_ROLE.
215217 */
216218 function test_revert_wrap_access_MINTER_ROLE () public {
217-
218219 vm.prank (address (tokenOwner));
219220 multiwrap.renounceRole (keccak256 ("MINTER_ROLE " ), address (tokenOwner));
220221
@@ -238,7 +239,6 @@ contract MultiwrapTest is BaseTest {
238239 * note: Testing revert condition; token owner calls `wrap` to wrap un-owned ERC20 tokens.
239240 */
240241 function test_revert_wrap_notOwner_ERC20 () public {
241-
242242 tokenOwner.transferERC20 (address (erc20), address (0x12 ), 10 ether);
243243
244244 address recipient = address (0x123 );
@@ -252,7 +252,6 @@ contract MultiwrapTest is BaseTest {
252252 * note: Testing revert condition; token owner calls `wrap` to wrap un-owned ERC721 tokens.
253253 */
254254 function test_revert_wrap_notOwner_ERC721 () public {
255-
256255 tokenOwner.transferERC721 (address (erc721), address (0x12 ), 0 );
257256
258257 address recipient = address (0x123 );
@@ -266,7 +265,6 @@ contract MultiwrapTest is BaseTest {
266265 * note: Testing revert condition; token owner calls `wrap` to wrap un-owned ERC1155 tokens.
267266 */
268267 function test_revert_wrap_notOwner_ERC1155 () public {
269-
270268 tokenOwner.transferERC1155 (address (erc1155), address (0x12 ), 0 , 100 , "" );
271269
272270 address recipient = address (0x123 );
@@ -277,7 +275,6 @@ contract MultiwrapTest is BaseTest {
277275 }
278276
279277 function test_revert_wrap_noTokensToWrap () public {
280-
281278 ITokenBundle.Token[] memory emptyContent;
282279
283280 address recipient = address (0x123 );
@@ -295,7 +292,6 @@ contract MultiwrapTest is BaseTest {
295292 * note: Testing state changes; wrapped token owner calls `unwrap` to unwrap underlying tokens.
296293 */
297294 function test_state_unwrap () public {
298-
299295 // ===== setup: wrap tokens =====
300296 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
301297 address recipient = address (0x123 );
@@ -321,7 +317,6 @@ contract MultiwrapTest is BaseTest {
321317 * note: Testing state changes; wrapped token owner calls `unwrap` to unwrap underlying tokens.
322318 */
323319 function test_state_unwrap_approvedCaller () public {
324-
325320 // ===== setup: wrap tokens =====
326321 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
327322 address recipient = address (0x123 );
@@ -349,7 +344,6 @@ contract MultiwrapTest is BaseTest {
349344 }
350345
351346 function test_event_unwrap_TokensUnwrapped () public {
352-
353347 // ===== setup: wrap tokens =====
354348 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
355349 address recipient = address (0x123 );
@@ -368,7 +362,6 @@ contract MultiwrapTest is BaseTest {
368362 }
369363
370364 function test_balances_unwrap () public {
371-
372365 // ===== setup: wrap tokens =====
373366 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
374367 address recipient = address (0x123 );
@@ -405,7 +398,6 @@ contract MultiwrapTest is BaseTest {
405398 }
406399
407400 function test_revert_unwrap_invalidTokenId () public {
408-
409401 // ===== setup: wrap tokens =====
410402 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
411403 address recipient = address (0x123 );
@@ -421,7 +413,6 @@ contract MultiwrapTest is BaseTest {
421413 }
422414
423415 function test_revert_unwrap_unapprovedCaller () public {
424-
425416 // ===== setup: wrap tokens =====
426417 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
427418 address recipient = address (0x123 );
@@ -437,7 +428,6 @@ contract MultiwrapTest is BaseTest {
437428 }
438429
439430 function test_revert_unwrap_notOwner () public {
440-
441431 // ===== setup: wrap tokens =====
442432 uint256 expectedIdForWrappedToken = multiwrap.nextTokenIdToMint ();
443433 address recipient = address (0x123 );
@@ -481,4 +471,4 @@ contract MultiwrapTest is BaseTest {
481471 vm.expectRevert (bytes (errorMsg));
482472 multiwrap.unwrap (expectedIdForWrappedToken, recipient);
483473 }
484- }
474+ }
0 commit comments