@@ -17,7 +17,7 @@ interface IERC165 {
17
17
18
18
abstract contract TokenBundle is ITokenBundle {
19
19
/// @dev Mapping from bundle UID => bundle info.
20
- mapping (uint256 => BundleInfo) private bundle;
20
+ mapping (uint256 => BundleInfo) public bundle;
21
21
22
22
/// @dev Returns the total number of assets in a particular bundle.
23
23
function getTokenCountOfBundle (uint256 _bundleId ) public view returns (uint256 ) {
@@ -38,8 +38,8 @@ abstract contract TokenBundle is ITokenBundle {
38
38
function _createBundle (Token[] calldata _tokensToBind , uint256 _bundleId ) internal {
39
39
uint256 targetCount = _tokensToBind.length ;
40
40
41
- require (targetCount > 0 , "TokenBundle: no tokens to bind. " );
42
- require (bundle[_bundleId].count == 0 , "TokenBundle: existent at bundleId " );
41
+ require (targetCount > 0 , "no tokens to bind " );
42
+ require (bundle[_bundleId].count == 0 , "existent at bundleId " );
43
43
44
44
for (uint256 i = 0 ; i < targetCount; i += 1 ) {
45
45
_checkTokenType (_tokensToBind[i]);
@@ -50,8 +50,8 @@ abstract contract TokenBundle is ITokenBundle {
50
50
}
51
51
52
52
/// @dev Lets the calling contract update a bundle, by passing in a list of tokens and a unique id.
53
- function _updateBundle (Token[] calldata _tokensToBind , uint256 _bundleId ) internal {
54
- require (_tokensToBind.length > 0 , "TokenBundle: no tokens to bind. " );
53
+ function _updateBundle (Token[] memory _tokensToBind , uint256 _bundleId ) internal {
54
+ require (_tokensToBind.length > 0 , "no tokens to bind " );
55
55
56
56
uint256 currentCount = bundle[_bundleId].count;
57
57
uint256 targetCount = _tokensToBind.length ;
@@ -84,7 +84,7 @@ abstract contract TokenBundle is ITokenBundle {
84
84
uint256 _bundleId ,
85
85
uint256 _index
86
86
) internal {
87
- require (_index < bundle[_bundleId].count, "TokenBundle: index DNE. " );
87
+ require (_index < bundle[_bundleId].count, "index DNE " );
88
88
_checkTokenType (_tokenToBind);
89
89
bundle[_bundleId].tokens[_index] = _tokenToBind;
90
90
}
@@ -93,32 +93,32 @@ abstract contract TokenBundle is ITokenBundle {
93
93
function _checkTokenType (Token memory _token ) internal view {
94
94
if (_token.tokenType == TokenType.ERC721 ) {
95
95
try IERC165 (_token.assetContract).supportsInterface (0x80ac58cd ) returns (bool supported721 ) {
96
- require (supported721, "Asset doesn't match TokenType " );
96
+ require (supported721, "! TokenType " );
97
97
} catch {
98
- revert ("Asset doesn't match TokenType " );
98
+ revert ("! TokenType " );
99
99
}
100
100
} else if (_token.tokenType == TokenType.ERC1155 ) {
101
101
try IERC165 (_token.assetContract).supportsInterface (0xd9b67a26 ) returns (bool supported1155 ) {
102
- require (supported1155, "Asset doesn't match TokenType " );
102
+ require (supported1155, "! TokenType " );
103
103
} catch {
104
- revert ("Asset doesn't match TokenType " );
104
+ revert ("! TokenType " );
105
105
}
106
106
} else if (_token.tokenType == TokenType.ERC20 ) {
107
107
if (_token.assetContract != CurrencyTransferLib.NATIVE_TOKEN) {
108
108
// 0x36372b07
109
109
try IERC165 (_token.assetContract).supportsInterface (0x80ac58cd ) returns (bool supported721 ) {
110
- require (! supported721, "Asset doesn't match TokenType " );
110
+ require (! supported721, "! TokenType " );
111
111
112
112
try IERC165 (_token.assetContract).supportsInterface (0xd9b67a26 ) returns (bool supported1155 ) {
113
- require (! supported1155, "Asset doesn't match TokenType " );
113
+ require (! supported1155, "! TokenType " );
114
114
} catch Error (string memory ) {} catch {}
115
115
} catch Error (string memory ) {} catch {}
116
116
}
117
117
}
118
118
}
119
119
120
120
/// @dev Lets the calling contract set/update the uri of a particular bundle.
121
- function _setUriOfBundle (string calldata _uri , uint256 _bundleId ) internal {
121
+ function _setUriOfBundle (string memory _uri , uint256 _bundleId ) internal {
122
122
bundle[_bundleId].uri = _uri;
123
123
}
124
124
0 commit comments