@@ -4,7 +4,6 @@ pragma solidity 0.4.21;
4
4
import "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol " ;
5
5
import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol " ;
6
6
import "zeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol " ;
7
- import "zeppelin-solidity/contracts/math/SafeMath.sol " ;
8
7
import "./external/SafeMathUint256.sol " ;
9
8
import "./lib/Set.sol " ;
10
9
@@ -15,10 +14,9 @@ import "./lib/Set.sol";
15
14
* @dev Implementation of the basic {Set} token.
16
15
*/
17
16
contract SetToken is StandardToken , DetailedERC20 ("", "", 18 ), Set {
18
- using SafeMath for uint256 ;
17
+ using SafeMathUint256 for uint256 ;
19
18
20
19
uint256 public totalSupply;
21
-
22
20
address [] public components;
23
21
uint [] public units;
24
22
@@ -76,8 +74,7 @@ contract SetToken is StandardToken, DetailedERC20("", "", 18), Set {
76
74
// Transfer value is defined as the currentUnits (in GWei)
77
75
// multiplied by quantity in Wei divided by the units of gWei.
78
76
// We do this to allow fractional units to be defined
79
- // uint transferValue = currentUnits.mul(quantity).div(10**9);
80
- uint transferValue = SafeMathUint256.fxpMul (currentUnits, quantity, 10 ** 9 );
77
+ uint transferValue = currentUnits.fxpMul (quantity, 10 ** 9 );
81
78
82
79
// Protect against the case that the gWei divisor results in a value that is
83
80
// 0 and the user is able to generate Sets without sending a balance
@@ -120,14 +117,16 @@ contract SetToken is StandardToken, DetailedERC20("", "", 18), Set {
120
117
address currentComponent = components[i];
121
118
uint currentUnits = units[i];
122
119
123
- // The transaction will fail if any of the components fail to transfer
124
- // uint transferValue = currentUnits.mul(quantity).div(10**9);
125
- uint transferValue = SafeMathUint256.fxpMul (currentUnits, quantity, 10 ** 9 );
120
+ // Transfer value is defined as the currentUnits (in GWei)
121
+ // multiplied by quantity in Wei divided by the units of gWei.
122
+ // We do this to allow fractional units to be defined
123
+ uint transferValue = currentUnits.fxpMul (quantity, 10 ** 9 );
126
124
127
125
// Protect against the case that the gWei divisor results in a value that is
128
126
// 0 and the user is able to generate Sets without sending a balance
129
127
assert (transferValue > 0 );
130
128
129
+ // The transaction will fail if any of the components fail to transfer
131
130
assert (ERC20 (currentComponent).transfer (msg .sender , transferValue));
132
131
}
133
132
0 commit comments