Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d57bded
Check transfer destination is not a zero address. Fix issue #400
pash7ka Aug 23, 2017
53ef2db
Fix for solidity compiler warnings, issue #367.
pash7ka Aug 28, 2017
35428c0
Fix compiler warnings. Issue #367
pash7ka Aug 28, 2017
0376f2a
Revert unnmerged commits
pash7ka Aug 28, 2017
c55d3dc
Check transfer destination is not a zero address. Fix issue #400
pash7ka Aug 23, 2017
6cd996d
Fix for solidity compiler warnings, issue #367.
pash7ka Aug 28, 2017
28280b3
Fix compiler warnings. Issue #367
pash7ka Aug 28, 2017
bbf17ff
Revert unnmerged commits
pash7ka Aug 28, 2017
5aa0758
Fix for solidity compiler warnings, issue #367.
pash7ka Aug 28, 2017
36223ff
Fix compiler warnings. Issue #367
pash7ka Aug 28, 2017
a07e3d2
Check transfer destination is not a zero address. Fix issue #400
pash7ka Aug 23, 2017
e995955
Revert unnmerged commits
pash7ka Aug 28, 2017
7bc34e1
Check transfer destination is not a zero address. Fix issue #400
pash7ka Aug 23, 2017
31e5d4b
Fix for solidity compiler warnings, issue #367.
pash7ka Aug 28, 2017
ddecb20
Fix compiler warnings. Issue #367
pash7ka Aug 28, 2017
7f95ead
Revert unnmerged commits
pash7ka Aug 28, 2017
1766c98
Check transfer destination is not a zero address. Fix issue #400
pash7ka Aug 23, 2017
b5747b9
Fix for solidity compiler warnings, issue #367.
pash7ka Aug 28, 2017
5b043fa
Fix compiler warnings. Issue #367
pash7ka Aug 28, 2017
790dec0
Revert unnmerged commits
pash7ka Aug 28, 2017
61fcaaf
Fix for solidity compiler warnings, issue #367.
pash7ka Aug 28, 2017
6f7a7bc
Fix compiler warnings. Issue #367
pash7ka Aug 28, 2017
1797327
Check transfer destination is not a zero address. Fix issue #400
pash7ka Aug 23, 2017
352c08d
Revert unnmerged commits
pash7ka Aug 28, 2017
3e0fc5a
Fix solc 0.4.18 warnings: add "public" modifier and change "constant"…
pash7ka Nov 16, 2017
7793b27
Replace "constant" to "view" where function is not pure.
pash7ka Nov 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert unnmerged commits
  • Loading branch information
pash7ka committed Nov 16, 2017
commit 352c08dc49c617f708d4eccd2b799600b078668a
8 changes: 4 additions & 4 deletions contracts/ownership/HasNoTokens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ contract HasNoTokens is CanReclaimToken {

/**
* @dev Reject all ERC23 compatible tokens
* param from_ address The address that is transferring the tokens
* param value_ uint256 the amount of the specified token
* param data_ Bytes The data passed from the caller.
* @param from_ address The address that is transferring the tokens
* @param value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller.
*/
function tokenFallback(address /*from_*/, uint256 /*value_*/, bytes /*data_*/) external {
function tokenFallback(address from_, uint256 value_, bytes data_) external {
revert();
}

Expand Down
1 change: 0 additions & 1 deletion contracts/token/BasicToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ contract BasicToken is ERC20Basic {
}

}

174 changes: 87 additions & 87 deletions contracts/token/StandardToken.sol
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
pragma solidity ^0.4.11;
import './BasicToken.sol';
import './ERC20.sol';
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
pragma solidity ^0.4.11;


import './BasicToken.sol';
import './ERC20.sol';


/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {

mapping (address => mapping (address => uint256)) internal allowed;


/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);

balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}

/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}

/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}

/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}

function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}

}