File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -40,17 +40,15 @@ contract StandardToken is ERC20, BasicToken {
4040
4141 /**
4242 * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
43+ *
44+ * Beware that changing an allowance with this method brings the risk that someone may use both the old
45+ * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
46+ * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
47+ * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
4348 * @param _spender The address which will spend the funds.
4449 * @param _value The amount of tokens to be spent.
4550 */
4651 function approve (address _spender , uint256 _value ) public returns (bool ) {
47-
48- // To change the approve amount you first have to reduce the addresses`
49- // allowance to zero by calling `approve(_spender, 0)` if it is not
50- // already 0 to mitigate the race condition described here:
51- // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
52- // require((_value == 0) || (allowed[msg.sender][_spender] == 0));
53-
5452 allowed[msg .sender ][_spender] = _value;
5553 Approval (msg .sender , _spender, _value);
5654 return true ;
You can’t perform that action at this time.
0 commit comments