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
370e6a88
Commit
370e6a88
authored
Jan 19, 2018
by
Santiago Palladino
Committed by
Francisco Giordano
Jan 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERC20 totalSupply changed from public property to a function (#666)
Fixes OpenZeppelin/zeppelin-solidity#434
parent
9cc55ef2
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
27 additions
and
10 deletions
+27
-10
SimpleToken.sol
contracts/examples/SimpleToken.sol
+1
-1
BasicTokenMock.sol
contracts/mocks/BasicTokenMock.sol
+1
-1
BurnableTokenMock.sol
contracts/mocks/BurnableTokenMock.sol
+1
-1
ERC223TokenMock.sol
contracts/mocks/ERC223TokenMock.sol
+1
-1
ERC827TokenMock.sol
contracts/mocks/ERC827TokenMock.sol
+1
-1
SafeERC20Helper.sol
contracts/mocks/SafeERC20Helper.sol
+8
-0
StandardTokenMock.sol
contracts/mocks/StandardTokenMock.sol
+1
-1
BasicToken.sol
contracts/token/BasicToken.sol
+9
-0
BurnableToken.sol
contracts/token/BurnableToken.sol
+1
-1
CappedToken.sol
contracts/token/CappedToken.sol
+1
-1
ERC20Basic.sol
contracts/token/ERC20/ERC20Basic.sol
+1
-1
MintableToken.sol
contracts/token/MintableToken.sol
+1
-1
No files found.
contracts/examples/SimpleToken.sol
View file @
370e6a88
...
...
@@ -22,7 +22,7 @@ contract SimpleToken is StandardToken {
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function SimpleToken() public {
totalSupply = INITIAL_SUPPLY;
totalSupply
_
= INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
...
...
contracts/mocks/BasicTokenMock.sol
View file @
370e6a88
...
...
@@ -9,7 +9,7 @@ contract BasicTokenMock is BasicToken {
function BasicTokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply = initialBalance;
totalSupply
_
= initialBalance;
}
}
contracts/mocks/BurnableTokenMock.sol
View file @
370e6a88
...
...
@@ -7,7 +7,7 @@ contract BurnableTokenMock is BurnableToken {
function BurnableTokenMock(address initialAccount, uint initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply = initialBalance;
totalSupply
_
= initialBalance;
}
}
contracts/mocks/ERC223TokenMock.sol
View file @
370e6a88
...
...
@@ -12,7 +12,7 @@ contract ERC223TokenMock is BasicToken {
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply = initialBalance;
totalSupply
_
= initialBalance;
}
// ERC223 compatible transfer function (except the name)
...
...
contracts/mocks/ERC827TokenMock.sol
View file @
370e6a88
...
...
@@ -9,7 +9,7 @@ contract ERC827TokenMock is ERC827Token {
function ERC827TokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply = initialBalance;
totalSupply
_
= initialBalance;
}
}
contracts/mocks/SafeERC20Helper.sol
View file @
370e6a88
...
...
@@ -5,6 +5,10 @@ import "../token/ERC20/SafeERC20.sol";
contract ERC20FailingMock is ERC20 {
function totalSupply() public view returns (uint256) {
return 0;
}
function transfer(address, uint256) public returns (bool) {
return false;
}
...
...
@@ -28,6 +32,10 @@ contract ERC20FailingMock is ERC20 {
contract ERC20SucceedingMock is ERC20 {
function totalSupply() public view returns (uint256) {
return 0;
}
function transfer(address, uint256) public returns (bool) {
return true;
}
...
...
contracts/mocks/StandardTokenMock.sol
View file @
370e6a88
...
...
@@ -9,7 +9,7 @@ contract StandardTokenMock is StandardToken {
function StandardTokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply = initialBalance;
totalSupply
_
= initialBalance;
}
}
contracts/token/BasicToken.sol
View file @
370e6a88
...
...
@@ -14,6 +14,15 @@ contract BasicToken is ERC20Basic {
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
...
...
contracts/token/BurnableToken.sol
View file @
370e6a88
...
...
@@ -22,7 +22,7 @@ contract BurnableToken is BasicToken {
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply
= totalSupply
.sub(_value);
totalSupply
_ = totalSupply_
.sub(_value);
Burn(burner, _value);
}
}
contracts/token/CappedToken.sol
View file @
370e6a88
...
...
@@ -24,7 +24,7 @@ contract CappedToken is MintableToken {
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply.add(_amount) <= cap);
require(totalSupply
_
.add(_amount) <= cap);
return super.mint(_to, _amount);
}
...
...
contracts/token/ERC20/ERC20Basic.sol
View file @
370e6a88
...
...
@@ -7,7 +7,7 @@ pragma solidity ^0.4.18;
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply
;
function totalSupply() public view returns (uint256)
;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
...
...
contracts/token/MintableToken.sol
View file @
370e6a88
...
...
@@ -32,7 +32,7 @@ contract MintableToken is StandardToken, Ownable {
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply
= totalSupply
.add(_amount);
totalSupply
_ = totalSupply_
.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
...
...
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