diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-07-27 07:30:07 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-08-17 08:31:21 +0800 |
commit | bb3c34589130c6453f4a7ec5a96c75f729b24a67 (patch) | |
tree | 72da54e3a4e344c8125c9a9944b81c4d29aa8485 /packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol | |
parent | 0f3201d72a181c3dc7bafba9a82c141f91463ce9 (diff) | |
download | dexon-sol-tools-bb3c34589130c6453f4a7ec5a96c75f729b24a67.tar dexon-sol-tools-bb3c34589130c6453f4a7ec5a96c75f729b24a67.tar.gz dexon-sol-tools-bb3c34589130c6453f4a7ec5a96c75f729b24a67.tar.bz2 dexon-sol-tools-bb3c34589130c6453f4a7ec5a96c75f729b24a67.tar.lz dexon-sol-tools-bb3c34589130c6453f4a7ec5a96c75f729b24a67.tar.xz dexon-sol-tools-bb3c34589130c6453f4a7ec5a96c75f729b24a67.tar.zst dexon-sol-tools-bb3c34589130c6453f4a7ec5a96c75f729b24a67.zip |
Update ERC20Token
Diffstat (limited to 'packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol')
-rw-r--r-- | packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol b/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol index 9feb5c914..07b85ddf4 100644 --- a/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol +++ b/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol @@ -21,7 +21,9 @@ pragma solidity 0.4.24; import "../ERC20Token/ERC20Token.sol"; -contract UnlimitedAllowanceToken is ERC20Token { +contract UnlimitedAllowanceToken is + ERC20Token +{ uint256 constant internal MAX_UINT = 2**256 - 1; @@ -30,8 +32,12 @@ contract UnlimitedAllowanceToken is ERC20Token { /// @param _to Address to transfer to. /// @param _value Amount to transfer. /// @return Success of transfer. - function transferFrom(address _from, address _to, uint256 _value) - public + function transferFrom( + address _from, + address _to, + uint256 _value + ) + external returns (bool) { uint256 allowance = allowed[_from][msg.sender]; @@ -45,14 +51,18 @@ contract UnlimitedAllowanceToken is ERC20Token { ); require( balances[_to] + _value >= balances[_to], - "OVERFLOW" + "UINT256_OVERFLOW" ); balances[_to] += _value; balances[_from] -= _value; if (allowance < MAX_UINT) { allowed[_from][msg.sender] -= _value; } - emit Transfer(_from, _to, _value); + emit Transfer( + _from, + _to, + _value + ); return true; } } |