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
81297fac
Commit
81297fac
authored
Jul 13, 2017
by
Francisco Giordano
Committed by
GitHub
Jul 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #308 from frangio/fix/erc20
Make ERC20 and token contracts conform to standard
parents
f8790c1e
6331dd12
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 @
81297fac
...
...
@@ -19,10 +19,11 @@ contract BasicToken is ERC20Basic {
* @param _to The address to transfer to.
* @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[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
...
...
contracts/token/ERC20.sol
View file @
81297fac
...
...
@@ -10,7 +10,7 @@ import './ERC20Basic.sol';
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value);
function approve(address spender, uint256 value);
function transferFrom(address from, address to, uint256 value)
returns (bool)
;
function approve(address spender, uint256 value)
returns (bool)
;
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contracts/token/ERC20Basic.sol
View file @
81297fac
...
...
@@ -4,11 +4,11 @@ pragma solidity ^0.4.11;
/**
* @title ERC20Basic
* @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 {
uint256 public totalSupply;
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);
}
contracts/token/LimitedTransferToken.sol
View file @
81297fac
...
...
@@ -32,8 +32,8 @@ contract LimitedTransferToken is ERC20 {
* @param _to The address that will recieve the tokens.
* @param _value The amount of tokens to be transferred.
*/
function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) {
super.transfer(_to, _value);
function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value)
returns (bool)
{
return
super.transfer(_to, _value);
}
/**
...
...
@@ -42,8 +42,8 @@ contract LimitedTransferToken is ERC20 {
* @param _to The address that will recieve the tokens.
* @param _value The amount of tokens to be transferred.
*/
function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) {
super.transferFrom(_from, _to, _value);
function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value)
returns (bool)
{
return
super.transferFrom(_from, _to, _value);
}
/**
...
...
contracts/token/PausableToken.sol
View file @
81297fac
...
...
@@ -11,11 +11,11 @@ import '../lifecycle/Pausable.sol';
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint _value) whenNotPaused {
super.transfer(_to, _value);
function transfer(address _to, uint _value) whenNotPaused
returns (bool)
{
return
super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) whenNotPaused {
super.transferFrom(_from, _to, _value);
function transferFrom(address _from, address _to, uint _value) whenNotPaused
returns (bool)
{
return
super.transferFrom(_from, _to, _value);
}
}
contracts/token/StandardToken.sol
View file @
81297fac
...
...
@@ -23,7 +23,7 @@ contract StandardToken is ERC20, BasicToken {
* @param _to address The address which you want to transfer to
* @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];
// 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 {
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
...
...
@@ -40,7 +41,7 @@ contract StandardToken is ERC20, BasicToken {
* @param _spender The address which will spend the funds.
* @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`
// allowance to zero by calling `approve(_spender, 0)` if it is not
...
...
@@ -50,6 +51,7 @@ contract StandardToken is ERC20, BasicToken {
allowed[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