Unverified Commit 4e77aaa0 by Matt Condon Committed by GitHub

Merge branch 'master' into fix/reference-of-rbac-usage

parents 96e0d35f 370e6a88
...@@ -22,14 +22,14 @@ contract CappedCrowdsale is Crowdsale { ...@@ -22,14 +22,14 @@ contract CappedCrowdsale is Crowdsale {
// @return true if crowdsale event has ended // @return true if crowdsale event has ended
function hasEnded() public view returns (bool) { function hasEnded() public view returns (bool) {
bool capReached = weiRaised >= cap; bool capReached = weiRaised >= cap;
return super.hasEnded() || capReached; return capReached || super.hasEnded();
} }
// overriding Crowdsale#validPurchase to add extra cap logic // overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment // @return true if investors can buy at the moment
function validPurchase() internal view returns (bool) { function validPurchase() internal view returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap; bool withinCap = weiRaised.add(msg.value) <= cap;
return super.validPurchase() && withinCap; return withinCap && super.validPurchase();
} }
} }
...@@ -22,7 +22,7 @@ contract SimpleToken is StandardToken { ...@@ -22,7 +22,7 @@ contract SimpleToken is StandardToken {
* @dev Constructor that gives msg.sender all of existing tokens. * @dev Constructor that gives msg.sender all of existing tokens.
*/ */
function SimpleToken() public { function SimpleToken() public {
totalSupply = INITIAL_SUPPLY; totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY); Transfer(0x0, msg.sender, INITIAL_SUPPLY);
} }
......
...@@ -9,7 +9,7 @@ contract BasicTokenMock is BasicToken { ...@@ -9,7 +9,7 @@ contract BasicTokenMock is BasicToken {
function BasicTokenMock(address initialAccount, uint256 initialBalance) public { function BasicTokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance; balances[initialAccount] = initialBalance;
totalSupply = initialBalance; totalSupply_ = initialBalance;
} }
} }
...@@ -7,7 +7,7 @@ contract BurnableTokenMock is BurnableToken { ...@@ -7,7 +7,7 @@ contract BurnableTokenMock is BurnableToken {
function BurnableTokenMock(address initialAccount, uint initialBalance) public { function BurnableTokenMock(address initialAccount, uint initialBalance) public {
balances[initialAccount] = initialBalance; balances[initialAccount] = initialBalance;
totalSupply = initialBalance; totalSupply_ = initialBalance;
} }
} }
...@@ -12,7 +12,7 @@ contract ERC223TokenMock is BasicToken { ...@@ -12,7 +12,7 @@ contract ERC223TokenMock is BasicToken {
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public { function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance; balances[initialAccount] = initialBalance;
totalSupply = initialBalance; totalSupply_ = initialBalance;
} }
// ERC223 compatible transfer function (except the name) // ERC223 compatible transfer function (except the name)
......
...@@ -9,7 +9,7 @@ contract ERC827TokenMock is ERC827Token { ...@@ -9,7 +9,7 @@ contract ERC827TokenMock is ERC827Token {
function ERC827TokenMock(address initialAccount, uint256 initialBalance) public { function ERC827TokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance; balances[initialAccount] = initialBalance;
totalSupply = initialBalance; totalSupply_ = initialBalance;
} }
} }
...@@ -5,6 +5,10 @@ import "../token/ERC20/SafeERC20.sol"; ...@@ -5,6 +5,10 @@ import "../token/ERC20/SafeERC20.sol";
contract ERC20FailingMock is ERC20 { contract ERC20FailingMock is ERC20 {
function totalSupply() public view returns (uint256) {
return 0;
}
function transfer(address, uint256) public returns (bool) { function transfer(address, uint256) public returns (bool) {
return false; return false;
} }
...@@ -28,6 +32,10 @@ contract ERC20FailingMock is ERC20 { ...@@ -28,6 +32,10 @@ contract ERC20FailingMock is ERC20 {
contract ERC20SucceedingMock is ERC20 { contract ERC20SucceedingMock is ERC20 {
function totalSupply() public view returns (uint256) {
return 0;
}
function transfer(address, uint256) public returns (bool) { function transfer(address, uint256) public returns (bool) {
return true; return true;
} }
......
...@@ -9,7 +9,7 @@ contract StandardTokenMock is StandardToken { ...@@ -9,7 +9,7 @@ contract StandardTokenMock is StandardToken {
function StandardTokenMock(address initialAccount, uint256 initialBalance) public { function StandardTokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance; balances[initialAccount] = initialBalance;
totalSupply = initialBalance; totalSupply_ = initialBalance;
} }
} }
...@@ -14,6 +14,15 @@ contract BasicToken is ERC20Basic { ...@@ -14,6 +14,15 @@ contract BasicToken is ERC20Basic {
mapping(address => uint256) balances; 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 * @dev transfer token for a specified address
* @param _to The address to transfer to. * @param _to The address to transfer to.
......
...@@ -22,7 +22,7 @@ contract BurnableToken is BasicToken { ...@@ -22,7 +22,7 @@ contract BurnableToken is BasicToken {
address burner = msg.sender; address burner = msg.sender;
balances[burner] = balances[burner].sub(_value); balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value); totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value); Burn(burner, _value);
} }
} }
...@@ -24,7 +24,7 @@ contract CappedToken is MintableToken { ...@@ -24,7 +24,7 @@ contract CappedToken is MintableToken {
* @return A boolean that indicates if the operation was successful. * @return A boolean that indicates if the operation was successful.
*/ */
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { 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); return super.mint(_to, _amount);
} }
......
...@@ -7,7 +7,7 @@ pragma solidity ^0.4.18; ...@@ -7,7 +7,7 @@ pragma solidity ^0.4.18;
* @dev see https://github.com/ethereum/EIPs/issues/179 * @dev see https://github.com/ethereum/EIPs/issues/179
*/ */
contract ERC20Basic { contract ERC20Basic {
uint256 public totalSupply; function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256); function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool); function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value);
......
...@@ -32,7 +32,7 @@ contract MintableToken is StandardToken, Ownable { ...@@ -32,7 +32,7 @@ contract MintableToken is StandardToken, Ownable {
* @return A boolean that indicates if the operation was successful. * @return A boolean that indicates if the operation was successful.
*/ */
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { 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); balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount); Mint(_to, _amount);
Transfer(address(0), _to, _amount); Transfer(address(0), _to, _amount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment