diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-07-27 08:18:43 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-08-17 08:31:21 +0800 |
commit | f5459164d283c4b55a0514faf3213334c45fea50 (patch) | |
tree | c1b2bd707553004f87a959d93c9f15b3f09fd292 /packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol | |
parent | 2743eee044edfd3dafc012e31f60ecf4ee0ce30f (diff) | |
download | dexon-0x-contracts-f5459164d283c4b55a0514faf3213334c45fea50.tar dexon-0x-contracts-f5459164d283c4b55a0514faf3213334c45fea50.tar.gz dexon-0x-contracts-f5459164d283c4b55a0514faf3213334c45fea50.tar.bz2 dexon-0x-contracts-f5459164d283c4b55a0514faf3213334c45fea50.tar.lz dexon-0x-contracts-f5459164d283c4b55a0514faf3213334c45fea50.tar.xz dexon-0x-contracts-f5459164d283c4b55a0514faf3213334c45fea50.tar.zst dexon-0x-contracts-f5459164d283c4b55a0514faf3213334c45fea50.zip |
Restructure directories
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 | 68 |
1 files changed, 0 insertions, 68 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 deleted file mode 100644 index 07b85ddf4..000000000 --- a/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol +++ /dev/null @@ -1,68 +0,0 @@ -/* - - Copyright 2018 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity 0.4.24; - -import "../ERC20Token/ERC20Token.sol"; - - -contract UnlimitedAllowanceToken is - ERC20Token -{ - - uint256 constant internal MAX_UINT = 2**256 - 1; - - /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717 - /// @param _from Address to transfer from. - /// @param _to Address to transfer to. - /// @param _value Amount to transfer. - /// @return Success of transfer. - function transferFrom( - address _from, - address _to, - uint256 _value - ) - external - returns (bool) - { - uint256 allowance = allowed[_from][msg.sender]; - require( - balances[_from] >= _value, - "ERC20_INSUFFICIENT_BALANCE" - ); - require( - allowance >= _value, - "ERC20_INSUFFICIENT_ALLOWANCE" - ); - require( - balances[_to] + _value >= balances[_to], - "UINT256_OVERFLOW" - ); - balances[_to] += _value; - balances[_from] -= _value; - if (allowance < MAX_UINT) { - allowed[_from][msg.sender] -= _value; - } - emit Transfer( - _from, - _to, - _value - ); - return true; - } -} |