Skip to content

Commit fdec913

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
run prettier
1 parent fad076f commit fdec913

File tree

10 files changed

+41
-62
lines changed

10 files changed

+41
-62
lines changed

contracts/feature/ContractMetadata.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ abstract contract ContractMetadata is IContractMetadata {
1818

1919
/// @dev Returns whether contract metadata can be set in the given execution context.
2020
function _canSetContractURI() internal virtual returns (bool);
21-
}
21+
}

contracts/feature/Ownable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ abstract contract Ownable is IOwnable {
1919

2020
/// @dev Returns whether owner can be set in the given execution context.
2121
function _canSetOwner() internal virtual returns (bool);
22-
}
22+
}

contracts/feature/PlatformFee.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ abstract contract PlatformFee is IPlatformFee {
2828

2929
/// @dev Returns whether platform fee info can be set in the given execution context.
3030
function _canSetPlatformFeeInfo() internal virtual returns (bool);
31-
}
31+
}

contracts/feature/PrimarySale.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ abstract contract PrimarySale is IPrimarySale {
2121

2222
/// @dev Returns whether primary sale recipient can be set in the given execution context.
2323
function _canSetPrimarySaleRecipient() internal virtual returns (bool);
24-
}
24+
}

contracts/feature/Royalty.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ abstract contract Royalty is IRoyalty {
6868

6969
/// @dev Returns whether royalty info can be set in the given execution context.
7070
function _canSetRoyaltyInfo() internal virtual returns (bool);
71-
}
71+
}

contracts/feature/TokenStore.sol

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import "./TokenBundle.sol";
1515
import "../lib/CurrencyTransferLib.sol";
1616

1717
contract TokenStore is TokenBundle, ERC721Holder, ERC1155Holder {
18-
1918
/// @dev The address of the native token wrapper contract.
2019
address private immutable nativeTokenWrapper;
2120

@@ -29,25 +28,18 @@ contract TokenStore is TokenBundle, ERC721Holder, ERC1155Holder {
2928
Token[] calldata _tokens,
3029
string calldata _uriForTokens,
3130
uint256 _idForTokens
32-
)
33-
internal
34-
{
31+
) internal {
3532
_setBundle(_tokens, _idForTokens);
3633
_setUriOfBundle(_uriForTokens, _idForTokens);
3734
_transferTokenBatch(_tokenOwner, address(this), _tokens);
3835
}
3936

4037
/// @dev Release stored / escrowed ERC1155, ERC721, ERC20 tokens.
41-
function _releaseTokens(
42-
address _recipient,
43-
uint256 _idForContent
44-
)
45-
internal
46-
{
38+
function _releaseTokens(address _recipient, uint256 _idForContent) internal {
4739
uint256 count = getTokenCountOfBundle(_idForContent);
4840
Token[] memory tokensToRelease = new Token[](count);
4941

50-
for(uint256 i = 0; i < count; i += 1) {
42+
for (uint256 i = 0; i < count; i += 1) {
5143
tokensToRelease[i] = getTokenOfBundle(_idForContent, i);
5244
}
5345

@@ -87,4 +79,4 @@ contract TokenStore is TokenBundle, ERC721Holder, ERC1155Holder {
8779
_transferToken(_from, _to, _tokens[i]);
8880
}
8981
}
90-
}
82+
}

contracts/feature/interface/IContractMetadata.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ interface IContractMetadata {
1212
function setContractURI(string calldata _uri) external;
1313

1414
event ContractURIUpdated(string prevURI, string newURI);
15-
}
15+
}

contracts/interfaces/IMultiwrap.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import "../feature/interface/ITokenBundle.sol";
1111
*/
1212

1313
interface IMultiwrap is ITokenBundle {
14-
1514
/// @dev Emitted when tokens are wrapped.
1615
event TokensWrapped(
1716
address indexed wrapper,

contracts/multiwrap/Multiwrap.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ contract Multiwrap is
148148
string calldata _uriForWrappedToken,
149149
address _recipient
150150
) external payable nonReentrant onlyRoleWithSwitch(MINTER_ROLE) returns (uint256 tokenId) {
151-
152151
tokenId = nextTokenIdToMint;
153152
nextTokenIdToMint += 1;
154153

@@ -161,7 +160,6 @@ contract Multiwrap is
161160

162161
/// @dev Unwrap a wrapped NFT to retrieve underlying ERC1155, ERC721, ERC20 tokens.
163162
function unwrap(uint256 _tokenId, address _recipient) external nonReentrant onlyRoleWithSwitch(UNWRAP_ROLE) {
164-
165163
require(_tokenId < nextTokenIdToMint, "invalid tokenId");
166164
require(_isApprovedOrOwner(_msgSender(), _tokenId), "unapproved called");
167165

src/test/Multiwrap.t.sol

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { Wallet } from "./utils/Wallet.sol";
1010
import "./utils/BaseTest.sol";
1111

1212
contract 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

Comments
 (0)