Rename Token => IERC20Token
This commit is contained in:
@@ -21,7 +21,7 @@ pragma solidity ^0.4.21;
|
||||
import "../IAssetProxy.sol";
|
||||
import "../../../utils/LibBytes/LibBytes.sol";
|
||||
import "../../../utils/Authorizable/Authorizable.sol";
|
||||
import { Token_v1 as ERC20Token } from "../../../../previous/Token/Token_v1.sol";
|
||||
import "../../../tokens/ERC20Token/IERC20Token.sol";
|
||||
|
||||
contract ERC20Proxy is
|
||||
LibBytes,
|
||||
@@ -44,7 +44,7 @@ contract ERC20Proxy is
|
||||
{
|
||||
require(assetMetadata.length == 21);
|
||||
address token = readAddress(assetMetadata, 1);
|
||||
bool success = ERC20Token(token).transferFrom(from, to, amount);
|
||||
bool success = IERC20Token(token).transferFrom(from, to, amount);
|
||||
require(success == true);
|
||||
}
|
||||
}
|
||||
|
@@ -18,22 +18,22 @@
|
||||
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
import "../Token/Token.sol";
|
||||
import "./IERC20Token.sol";
|
||||
|
||||
contract ERC20Token is Token {
|
||||
contract ERC20Token is IERC20Token {
|
||||
|
||||
function transfer(address _to, uint _value)
|
||||
function transfer(address _to, uint256 _value)
|
||||
public
|
||||
returns (bool)
|
||||
{
|
||||
require(balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]);
|
||||
balances[msg.sender] -= _value;
|
||||
balances[_to] += _value;
|
||||
Transfer(msg.sender, _to, _value);
|
||||
emit Transfer(msg.sender, _to, _value);
|
||||
return true;
|
||||
}
|
||||
|
||||
function transferFrom(address _from, address _to, uint _value)
|
||||
function transferFrom(address _from, address _to, uint256 _value)
|
||||
public
|
||||
returns (bool)
|
||||
{
|
||||
@@ -41,23 +41,22 @@ contract ERC20Token is Token {
|
||||
balances[_to] += _value;
|
||||
balances[_from] -= _value;
|
||||
allowed[_from][msg.sender] -= _value;
|
||||
Transfer(_from, _to, _value);
|
||||
emit Transfer(_from, _to, _value);
|
||||
return true;
|
||||
}
|
||||
|
||||
function approve(address _spender, uint _value)
|
||||
function approve(address _spender, uint256 _value)
|
||||
public
|
||||
returns (bool)
|
||||
{
|
||||
allowed[msg.sender][_spender] = _value;
|
||||
Approval(msg.sender, _spender, _value);
|
||||
emit Approval(msg.sender, _spender, _value);
|
||||
return true;
|
||||
}
|
||||
|
||||
function balanceOf(address _owner)
|
||||
public
|
||||
view
|
||||
returns (uint)
|
||||
public view
|
||||
returns (uint256)
|
||||
{
|
||||
return balances[_owner];
|
||||
}
|
||||
@@ -65,12 +64,12 @@ contract ERC20Token is Token {
|
||||
function allowance(address _owner, address _spender)
|
||||
public
|
||||
view
|
||||
returns (uint)
|
||||
returns (uint256)
|
||||
{
|
||||
return allowed[_owner][_spender];
|
||||
}
|
||||
|
||||
mapping (address => uint) balances;
|
||||
mapping (address => mapping (address => uint)) allowed;
|
||||
uint public totalSupply;
|
||||
mapping (address => uint256) balances;
|
||||
mapping (address => mapping (address => uint256)) allowed;
|
||||
uint256 public totalSupply;
|
||||
}
|
||||
|
@@ -18,36 +18,53 @@
|
||||
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
contract Token {
|
||||
contract IERC20Token {
|
||||
|
||||
/// @notice send `_value` token to `_to` from `msg.sender`
|
||||
/// @param _to The address of the recipient
|
||||
/// @param _value The amount of token to be transferred
|
||||
/// @return Whether the transfer was successful or not
|
||||
function transfer(address _to, uint _value) public returns (bool) {}
|
||||
function transfer(address _to, uint256 _value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
|
||||
/// @param _from The address of the sender
|
||||
/// @param _to The address of the recipient
|
||||
/// @param _value The amount of token to be transferred
|
||||
/// @return Whether the transfer was successful or not
|
||||
function transferFrom(address _from, address _to, uint _value) public returns (bool) {}
|
||||
|
||||
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
|
||||
function transferFrom(address _from, address _to, uint256 _value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
|
||||
/// @param _spender The address of the account able to transfer the tokens
|
||||
/// @param _value The amount of wei to be approved for transfer
|
||||
/// @return Whether the approval was successful or not
|
||||
function approve(address _spender, uint _value) public returns (bool) {}
|
||||
function approve(address _spender, uint256 _value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @param _owner The address from which the balance will be retrieved
|
||||
/// @return The balance
|
||||
function balanceOf(address _owner) public view returns (uint) {}
|
||||
function balanceOf(address _owner)
|
||||
public view
|
||||
returns (uint256);
|
||||
|
||||
/// @param _owner The address of the account owning tokens
|
||||
/// @param _spender The address of the account able to transfer the tokens
|
||||
/// @return Amount of remaining tokens allowed to spent
|
||||
function allowance(address _owner, address _spender) public view returns (uint) {}
|
||||
function allowance(address _owner, address _spender)
|
||||
public view
|
||||
returns (uint256);
|
||||
|
||||
event Transfer(address indexed _from, address indexed _to, uint _value);
|
||||
event Approval(address indexed _owner, address indexed _spender, uint _value);
|
||||
event Transfer(
|
||||
address indexed _from,
|
||||
address indexed _to,
|
||||
uint256 _value);
|
||||
|
||||
event Approval(
|
||||
address indexed _owner,
|
||||
address indexed _spender,
|
||||
uint256 _value);
|
||||
}
|
@@ -1,70 +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.18;
|
||||
|
||||
contract IToken {
|
||||
|
||||
/// @notice send `value` token to `to` from `msg.sender`
|
||||
/// @param to The address of the recipient
|
||||
/// @param value The amount of token to be transferred
|
||||
/// @return Whether the transfer was successful or not
|
||||
function transfer(address to, uint value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @notice send `value` token to `to` from `from` on the condition it is approved by `from`
|
||||
/// @param from The address of the sender
|
||||
/// @param to The address of the recipient
|
||||
/// @param value The amount of token to be transferred
|
||||
/// @return Whether the transfer was successful or not
|
||||
function transferFrom(address from, address to, uint value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @notice `msg.sender` approves `addr` to spend `value` tokens
|
||||
/// @param spender The address of the account able to transfer the tokens
|
||||
/// @param value The amount of wei to be approved for transfer
|
||||
/// @return Whether the approval was successful or not
|
||||
function approve(address spender, uint value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @param owner The address from which the balance will be retrieved
|
||||
/// @return The balance
|
||||
function balanceOf(address owner)
|
||||
public view
|
||||
returns (uint);
|
||||
|
||||
/// @param owner The address of the account owning tokens
|
||||
/// @param spender The address of the account able to transfer the tokens
|
||||
/// @return Amount of remaining tokens allowed to spent
|
||||
function allowance(address owner, address spender)
|
||||
public view
|
||||
returns (uint);
|
||||
|
||||
event Transfer(
|
||||
address indexed from,
|
||||
address indexed to,
|
||||
uint value);
|
||||
|
||||
event Approval(
|
||||
address indexed owner,
|
||||
address indexed spender,
|
||||
uint value);
|
||||
}
|
@@ -22,25 +22,25 @@ import { ERC20Token } from "../ERC20Token/ERC20Token.sol";
|
||||
|
||||
contract UnlimitedAllowanceToken is ERC20Token {
|
||||
|
||||
uint constant MAX_UINT = 2**256 - 1;
|
||||
uint256 constant 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, uint _value)
|
||||
function transferFrom(address _from, address _to, uint256 _value)
|
||||
public
|
||||
returns (bool)
|
||||
{
|
||||
uint allowance = allowed[_from][msg.sender];
|
||||
uint256 allowance = allowed[_from][msg.sender];
|
||||
require(balances[_from] >= _value && allowance >= _value && balances[_to] + _value >= balances[_to]);
|
||||
balances[_to] += _value;
|
||||
balances[_from] -= _value;
|
||||
if (allowance < MAX_UINT) {
|
||||
allowed[_from][msg.sender] -= _value;
|
||||
}
|
||||
Transfer(_from, _to, _value);
|
||||
emit Transfer(_from, _to, _value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -1,52 +0,0 @@
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
contract IToken_v1 {
|
||||
|
||||
/// @notice send `value` token to `to` from `msg.sender`
|
||||
/// @param to The address of the recipient
|
||||
/// @param value The amount of token to be transferred
|
||||
/// @return Whether the transfer was successful or not
|
||||
function transfer(address to, uint value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @notice send `value` token to `to` from `from` on the condition it is approved by `from`
|
||||
/// @param from The address of the sender
|
||||
/// @param to The address of the recipient
|
||||
/// @param value The amount of token to be transferred
|
||||
/// @return Whether the transfer was successful or not
|
||||
function transferFrom(address from, address to, uint value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @notice `msg.sender` approves `addr` to spend `value` tokens
|
||||
/// @param spender The address of the account able to transfer the tokens
|
||||
/// @param value The amount of wei to be approved for transfer
|
||||
/// @return Whether the approval was successful or not
|
||||
function approve(address spender, uint value)
|
||||
public
|
||||
returns (bool);
|
||||
|
||||
/// @param owner The address from which the balance will be retrieved
|
||||
/// @return The balance
|
||||
function balanceOf(address owner)
|
||||
public view
|
||||
returns (uint);
|
||||
|
||||
/// @param owner The address of the account owning tokens
|
||||
/// @param spender The address of the account able to transfer the tokens
|
||||
/// @return Amount of remaining tokens allowed to spent
|
||||
function allowance(address owner, address spender)
|
||||
public view
|
||||
returns (uint);
|
||||
|
||||
event Transfer(
|
||||
address indexed from,
|
||||
address indexed to,
|
||||
uint value);
|
||||
|
||||
event Approval(
|
||||
address indexed owner,
|
||||
address indexed spender,
|
||||
uint value);
|
||||
}
|
@@ -2,7 +2,6 @@ import * as DummyERC20TokenArtifact from '../artifacts/DummyERC20Token.json';
|
||||
import * as ExchangeArtifact from '../artifacts/Exchange.json';
|
||||
import * as MultiSigWalletWithTimeLockArtifact from '../artifacts/MultiSigWalletWithTimeLock.json';
|
||||
import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact from '../artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json';
|
||||
import * as TokenArtifact from '../artifacts/Token.json';
|
||||
import * as TokenRegistryArtifact from '../artifacts/TokenRegistry.json';
|
||||
import * as EtherTokenArtifact from '../artifacts/WETH9.json';
|
||||
import * as ZRXArtifact from '../artifacts/ZRXToken.json';
|
||||
@@ -12,7 +11,6 @@ import { Artifact } from './types';
|
||||
export const artifacts = {
|
||||
ZRXArtifact: (ZRXArtifact as any) as Artifact,
|
||||
DummyERC20TokenArtifact: (DummyERC20TokenArtifact as any) as Artifact,
|
||||
TokenArtifact: (TokenArtifact as any) as Artifact,
|
||||
ExchangeArtifact: (ExchangeArtifact as any) as Artifact,
|
||||
EtherTokenArtifact: (EtherTokenArtifact as any) as Artifact,
|
||||
TokenRegistryArtifact: (TokenRegistryArtifact as any) as Artifact,
|
||||
|
Reference in New Issue
Block a user