Skip to main content

ERC20Coin

ERC20Coin

The ERC20 contract for a Iota coin.

Approval

event Approval(address tokenOwner, address spender, uint256 tokens)

Emitted when the allowance of a spender for an owner is set.

Parameters

NameTypeDescription
tokenOwneraddressThe owner of the tokens.
spenderaddressThe address allowed to spend the tokens.
tokensuint256The amount of tokens allowed to be spent.

Transfer

event Transfer(address from, address to, uint256 tokens)

Emitted when tokens are transferred from one address to another.

Parameters

NameTypeDescription
fromaddressThe address tokens are transferred from.
toaddressThe address tokens are transferred to.
tokensuint256The amount of tokens transferred.

name

function name() public view returns (string)

Returns the name of the native token.

Return Values

NameTypeDescription
[0]stringThe name of the token.

symbol

function symbol() public view returns (string)

Returns the ticker symbol of the native token.

Return Values

NameTypeDescription
[0]stringThe ticker symbol of the token.

decimals

function decimals() public view returns (uint8)

Returns the number of decimals used for the native token.

Return Values

NameTypeDescription
[0]uint8The number of decimals.

totalSupply

function totalSupply() public view virtual returns (uint256)

Returns the total supply of the native token.

Return Values

NameTypeDescription
[0]uint256The total supply of the token.

balanceOf

function balanceOf(address tokenOwner) public view returns (uint256)

Returns the balance of a token owner.

Parameters

NameTypeDescription
tokenOwneraddressThe address of the token owner.

Return Values

NameTypeDescription
[0]uint256The balance of the token owner.

transfer

function transfer(address receiver, uint256 numTokens) public returns (bool)

Transfers tokens from the sender's address to the receiver's address.

Parameters

NameTypeDescription
receiveraddressThe address to transfer tokens to.
numTokensuint256The amount of tokens to transfer.

Return Values

NameTypeDescription
[0]booltrue.

approve

function approve(address delegate, uint256 numTokens) public returns (bool)

Sets the allowance of a spender to spend tokens on behalf of the owner.

Parameters

NameTypeDescription
delegateaddressThe address allowed to spend the tokens.
numTokensuint256The amount of tokens allowed to be spent.

Return Values

NameTypeDescription
[0]booltrue.

allowance

function allowance(address owner, address delegate) public view returns (uint256)

Returns the amount of tokens that the spender is allowed to spend on behalf of the owner.

Parameters

NameTypeDescription
owneraddressThe address of the token owner.
delegateaddressThe address of the spender.

Return Values

NameTypeDescription
[0]uint256The amount of tokens the spender is allowed to spend.

transferFrom

function transferFrom(address owner, address buyer, uint256 numTokens) public returns (bool)

Transfers tokens from one address to another on behalf of a token owner.

Parameters

NameTypeDescription
owneraddressThe address from which tokens are transferred.
buyeraddressThe address to which tokens are transferred.
numTokensuint256The amount of tokens to transfer.

Return Values

NameTypeDescription
[0]boolA boolean indicating whether the transfer was successful or not.