contract StandardToken is ERC20, BasicToken
StandardToken
Implementation of the basic standard token. ethereum/EIPs#20 Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
Constants & Variables
mapping(address => mapping(address => uint256)) internal allowed;
🔺 overrides ERC20.transferFrom
Transfer tokens from one address to another
function transferFrom(address _from, address _to, uint256 _value) public
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_from | address | address The address which you want to send tokens from |
_to | address | address The address which you want to transfer to |
_value | uint256 | uint256 the amount of tokens to be transferred |
🔺 overrides ERC20.approve
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: ethereum/EIPs#20 (comment)
function approve(address _spender, uint256 _value) public
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_spender | address | The address which will spend the funds. |
_value | uint256 | The amount of tokens to be spent. |
🔺 overrides ERC20.allowance
Function to check the amount of tokens that an owner allowed to a spender.
function allowance(address _owner, address _spender) public view
returns(uint256)
Returns
A uint256 specifying the amount of tokens still available for the spender.
Arguments
Name | Type | Description |
---|---|---|
_owner | address | address The address which owns the funds. |
_spender | address | address The address which will spend the funds. |
Increase the amount of tokens that an owner allowed to a 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, uint256 _addedValue) public
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_spender | address | The address which will spend the funds. |
_addedValue | uint256 | The amount of tokens to increase the allowance by. |
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement 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 decreaseApproval(address _spender, uint256 _subtractedValue) public
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_spender | address | The address which will spend the funds. |
_subtractedValue | uint256 | The amount of tokens to decrease the allowance by. |