Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
6331dd12
Commit
6331dd12
authored
Jul 13, 2017
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ERC20 to conform to standard
parent
f8790c1e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
15 deletions
+18
-15
BasicToken.sol
contracts/token/BasicToken.sol
+2
-1
ERC20.sol
contracts/token/ERC20.sol
+2
-2
ERC20Basic.sol
contracts/token/ERC20Basic.sol
+2
-2
LimitedTransferToken.sol
contracts/token/LimitedTransferToken.sol
+4
-4
PausableToken.sol
contracts/token/PausableToken.sol
+4
-4
StandardToken.sol
contracts/token/StandardToken.sol
+4
-2
No files found.
contracts/token/BasicToken.sol
View file @
6331dd12
...
@@ -19,10 +19,11 @@ contract BasicToken is ERC20Basic {
...
@@ -19,10 +19,11 @@ contract BasicToken is ERC20Basic {
* @param _to The address to transfer to.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _value The amount to be transferred.
*/
*/
function transfer(address _to, uint256 _value) {
function transfer(address _to, uint256 _value)
returns (bool)
{
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value);
return true;
}
}
/**
/**
...
...
contracts/token/ERC20.sol
View file @
6331dd12
...
@@ -10,7 +10,7 @@ import './ERC20Basic.sol';
...
@@ -10,7 +10,7 @@ import './ERC20Basic.sol';
*/
*/
contract ERC20 is ERC20Basic {
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value);
function transferFrom(address from, address to, uint256 value)
returns (bool)
;
function approve(address spender, uint256 value);
function approve(address spender, uint256 value)
returns (bool)
;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
}
contracts/token/ERC20Basic.sol
View file @
6331dd12
...
@@ -4,11 +4,11 @@ pragma solidity ^0.4.11;
...
@@ -4,11 +4,11 @@ pragma solidity ^0.4.11;
/**
/**
* @title ERC20Basic
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/
20
* @dev see https://github.com/ethereum/EIPs/issues/
179
*/
*/
contract ERC20Basic {
contract ERC20Basic {
uint256 public totalSupply;
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value);
function transfer(address to, uint256 value)
returns (bool)
;
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
}
contracts/token/LimitedTransferToken.sol
View file @
6331dd12
...
@@ -32,8 +32,8 @@ contract LimitedTransferToken is ERC20 {
...
@@ -32,8 +32,8 @@ contract LimitedTransferToken is ERC20 {
* @param _to The address that will recieve the tokens.
* @param _to The address that will recieve the tokens.
* @param _value The amount of tokens to be transferred.
* @param _value The amount of tokens to be transferred.
*/
*/
function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) {
function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value)
returns (bool)
{
super.transfer(_to, _value);
return
super.transfer(_to, _value);
}
}
/**
/**
...
@@ -42,8 +42,8 @@ contract LimitedTransferToken is ERC20 {
...
@@ -42,8 +42,8 @@ contract LimitedTransferToken is ERC20 {
* @param _to The address that will recieve the tokens.
* @param _to The address that will recieve the tokens.
* @param _value The amount of tokens to be transferred.
* @param _value The amount of tokens to be transferred.
*/
*/
function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) {
function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value)
returns (bool)
{
super.transferFrom(_from, _to, _value);
return
super.transferFrom(_from, _to, _value);
}
}
/**
/**
...
...
contracts/token/PausableToken.sol
View file @
6331dd12
...
@@ -11,11 +11,11 @@ import '../lifecycle/Pausable.sol';
...
@@ -11,11 +11,11 @@ import '../lifecycle/Pausable.sol';
contract PausableToken is StandardToken, Pausable {
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint _value) whenNotPaused {
function transfer(address _to, uint _value) whenNotPaused
returns (bool)
{
super.transfer(_to, _value);
return
super.transfer(_to, _value);
}
}
function transferFrom(address _from, address _to, uint _value) whenNotPaused {
function transferFrom(address _from, address _to, uint _value) whenNotPaused
returns (bool)
{
super.transferFrom(_from, _to, _value);
return
super.transferFrom(_from, _to, _value);
}
}
}
}
contracts/token/StandardToken.sol
View file @
6331dd12
...
@@ -23,7 +23,7 @@ contract StandardToken is ERC20, BasicToken {
...
@@ -23,7 +23,7 @@ contract StandardToken is ERC20, BasicToken {
* @param _to address The address which you want to transfer to
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
* @param _value uint256 the amout of tokens to be transfered
*/
*/
function transferFrom(address _from, address _to, uint256 _value) {
function transferFrom(address _from, address _to, uint256 _value)
returns (bool)
{
var _allowance = allowed[_from][msg.sender];
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
...
@@ -33,6 +33,7 @@ contract StandardToken is ERC20, BasicToken {
...
@@ -33,6 +33,7 @@ contract StandardToken is ERC20, BasicToken {
balances[_from] = balances[_from].sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
Transfer(_from, _to, _value);
return true;
}
}
/**
/**
...
@@ -40,7 +41,7 @@ contract StandardToken is ERC20, BasicToken {
...
@@ -40,7 +41,7 @@ contract StandardToken is ERC20, BasicToken {
* @param _spender The address which will spend the funds.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
* @param _value The amount of tokens to be spent.
*/
*/
function approve(address _spender, uint256 _value) {
function approve(address _spender, uint256 _value)
returns (bool)
{
// To change the approve amount you first have to reduce the addresses`
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// allowance to zero by calling `approve(_spender, 0)` if it is not
...
@@ -50,6 +51,7 @@ contract StandardToken is ERC20, BasicToken {
...
@@ -50,6 +51,7 @@ contract StandardToken is ERC20, BasicToken {
allowed[msg.sender][_spender] = _value;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
Approval(msg.sender, _spender, _value);
return true;
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment