ERC20Facet

Git Source

Inherits: IERC20, ERC20Base, Facet

Functions

ERC20_init

function ERC20_init(string memory name_, string memory symbol_, uint8 decimals_) external onlyInitializing;

name

Returns the name of the token.

function name() external view returns (string memory);

symbol

Returns the symbol of the token.

function symbol() external view returns (string memory);

decimals

Returns the decimals places of the token.

function decimals() external view returns (uint8);

transfer

Moves an amount of tokens from the caller's account to another account.

function transfer(address to, uint256 amount) external returns (bool);

Parameters

NameTypeDescription

to

address

The account where the tokens are transferred to.

amount

uint256

The number of tokens transferred.

Returns

NameTypeDescription

<none>

bool

Boolean value indicating whether the operation succeeded.

approve

Sets an amount as the allowance of spender over the caller's tokens.

function approve(address spender, uint256 amount) external returns (bool);

Parameters

NameTypeDescription

spender

address

The account that is allowed to transfer the tokens.

amount

uint256

The number of tokens that are approved.

Returns

NameTypeDescription

<none>

bool

bool value indicating whether the operation succeeded.

transferFrom

Transferrs an amount of tokens from an account to other using the allowance mechanism.

Amount is deducted from the caller's allowance.

function transferFrom(address from, address to, uint256 amount) external returns (bool);

Parameters

NameTypeDescription

from

address

The account where the tokens are transferred from.

to

address

The account where the tokens are transferred to.

amount

uint256

The number of tokens transferred.

Returns

NameTypeDescription

<none>

bool

bool value indicating whether the operation succeeded.

allowance

Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner.

This value changes when {approve} or {transferFrom} are called and is zero by default.

function allowance(address owner, address spender) external view returns (uint256);

Parameters

NameTypeDescription

owner

address

The account that owns the tokens.

spender

address

The account that is allowed to transfer the tokens.

totalSupply

Returns the amount of tokens in existence.

function totalSupply() external view returns (uint256);

balanceOf

Returns the amount of tokens owned by an account.

function balanceOf(address account) external view returns (uint256);

Parameters

NameTypeDescription

account

address

The account to get the balance of.