Standard ERC20 token
Last updated
Was this helpful?
Last updated
Was this helpful?
(ERC20.sol)
View Source:
↗ Extends: ↘ Derived Contracts:
ERC20
Implementation of the basic standard token. Originally based on code by FirstBlood:
This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
all accounts just by listening to said events. Note that this isn't required by the specification, and other
compliant implementations may not do it.
Constants & Variables
Total number of tokens in existence
Arguments
Name
Type
Description
Gets the balance of the specified address.
Returns
A uint256 representing the amount owned by the passed address.
Arguments
Name
Type
Description
owner
address
The address to query the balance of.
Function to check the amount of tokens that an owner allowed to a spender.
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.
Transfer token to a specified address
Arguments
Name
Type
Description
to
address
The address to transfer to.
value
uint256
The amount to be transferred.
Arguments
Name
Type
Description
spender
address
The address which will spend the funds.
value
uint256
The amount of tokens to be spent.
Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event.
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
Increase the amount of tokens that an owner allowed to a spender. approve should be called when _allowed[msg.sender][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 Emits an Approval event.
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[msg.sender][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 Emits an Approval event.
Arguments
Name
Type
Description
spender
address
The address which will spend the funds.
subtractedValue
uint256
The amount of tokens to decrease the allowance by.
Transfer token for a specified addresses
Arguments
Name
Type
Description
from
address
The address to transfer from.
to
address
The address to transfer to.
value
uint256
The amount to be transferred.
Internal function that mints an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted.
Arguments
Name
Type
Description
account
address
The account that will receive the created tokens.
value
uint256
The amount that will be created.
Internal function that burns an amount of the token of a given account.
Arguments
Name
Type
Description
account
address
The account whose tokens will be burnt.
value
uint256
The amount that will be burnt.
Approve an address to spend another addresses' tokens.
Arguments
Name
Type
Description
owner
address
The address that owns the tokens.
spender
address
The address that will spend the tokens.
value
uint256
The number of tokens that can be spent.
Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. Emits an Approval event (reflecting the reduced allowance).
Arguments
Name
Type
Description
account
address
The account whose tokens will be burnt.
value
uint256
The amount that will be burnt.
⤾ overrides
⤾ overrides
⤾ overrides
⤾ overrides
⤿ Overridden Implementation(s):
⤾ overrides
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:
⤾ overrides
⤿ Overridden Implementation(s):