Skip to main content
Version: v1.3

ERC20NativeTokens

ERC20NativeTokens

The ERC20 contract native tokens (on-chain foundry).

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.

foundrySerialNumber

function foundrySerialNumber() internal view returns (uint32)

Returns the foundry serial number of the native token.

Return Values

NameTypeDescription
[0]uint32The foundry serial number.

nativeTokenID

function nativeTokenID() public view virtual returns (struct NativeTokenID)

Returns the native token ID of the native token.

Return Values

NameTypeDescription
[0]struct NativeTokenIDThe native token ID.

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.

bytesEqual

function bytesEqual(bytes a, bytes b) internal pure returns (bool)

Compares two byte arrays for equality.

Parameters

NameTypeDescription
abytesThe first byte array.
bbytesThe second byte array.

Return Values

NameTypeDescription
[0]boolA boolean indicating whether the byte arrays are equal or not.

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.