@@ -4,7 +4,6 @@ pragma solidity ^0.8.0;
4
4
import "./interface/ITokenBundle.sol " ;
5
5
6
6
abstract contract TokenBundle is ITokenBundle {
7
-
8
7
/// @dev Mapping from bundle UID => bundle info.
9
8
mapping (uint256 => BundleInfo) private bundle;
10
9
@@ -25,16 +24,14 @@ abstract contract TokenBundle is ITokenBundle {
25
24
26
25
/// @dev Lets the calling contract create/update a bundle, by passing in a list of tokens and a unique id.
27
26
function _setBundle (Token[] calldata _tokensToBind , uint256 _bundleId ) internal {
28
-
29
27
require (_tokensToBind.length > 0 , "TokenBundle: no tokens to bind. " );
30
28
31
29
uint256 currentCount = bundle[_bundleId].count;
32
30
uint256 targetCount = _tokensToBind.length ;
33
31
uint256 check = currentCount > targetCount ? currentCount : targetCount;
34
-
35
- for (uint256 i = 0 ; i < check; i += 1 ) {
36
32
37
- if (i < targetCount) {
33
+ for (uint256 i = 0 ; i < check; i += 1 ) {
34
+ if (i < targetCount) {
38
35
bundle[_bundleId].tokens[i] = _tokensToBind[i];
39
36
} else if (i < currentCount) {
40
37
delete bundle[_bundleId].tokens[i];
@@ -45,10 +42,7 @@ abstract contract TokenBundle is ITokenBundle {
45
42
}
46
43
47
44
/// @dev Lets the calling contract add a token to a bundle for a unique bundle id and index.
48
- function _addTokenInBundle (
49
- Token memory _tokenToBind ,
50
- uint256 _bundleId
51
- ) internal {
45
+ function _addTokenInBundle (Token memory _tokenToBind , uint256 _bundleId ) internal {
52
46
uint256 id = bundle[_bundleId].count;
53
47
54
48
bundle[_bundleId].tokens[id] = _tokenToBind;
0 commit comments