Skip to content
Lattice

ERC20

Git Source

Inherits: IERC20

Title: ERC20

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol)

Stateless Diamond facet for the ERC-20 token standard.

All logic lives in ERC20Lib. This contract is a pure delegator. Subclasses (Burnable, Capped, Permit) override virtual methods. ERC20Lib lists every difference from OpenZeppelin. transfer/transferFrom are the movement selectors a movement-replacing extension (ERC20Pausable, ERC20Votes, GovernedVault) replaces; only one of them per diamond (D25, #234).

Notes:

  • lattice-version: 0.1.0
  • lattice-source: OpenZeppelin v5.6.1

Functions

totalSupply

Returns the total token supply.

function totalSupply() public view virtual returns (uint256);

Returns

NameTypeDescription
<none>uint256

balanceOf

Returns the token balance of account.

function balanceOf(address account) public view virtual returns (uint256);

Parameters

NameTypeDescription
accountaddress

Returns

NameTypeDescription
<none>uint256

transfer

Transfers value tokens from the caller to to.

function transfer(address to, uint256 value) public virtual returns (bool);

Parameters

NameTypeDescription
toaddress
valueuint256

Returns

NameTypeDescription
<none>bool

allowance

Returns the remaining number of tokens that spender can spend on behalf of owner.

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

Parameters

NameTypeDescription
owneraddress
spenderaddress

Returns

NameTypeDescription
<none>uint256

approve

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

function approve(address spender, uint256 value) public virtual returns (bool);

Parameters

NameTypeDescription
spenderaddress
valueuint256

Returns

NameTypeDescription
<none>bool

transferFrom

Transfers value tokens from from to to using the caller's allowance.

function transferFrom(address from, address to, uint256 value) public virtual returns (bool);

Parameters

NameTypeDescription
fromaddress
toaddress
valueuint256

Returns

NameTypeDescription
<none>bool

name

Returns the name of the token.

function name() public view virtual returns (string memory);

Returns

NameTypeDescription
<none>string

symbol

Returns the symbol of the token.

function symbol() public view virtual returns (string memory);

Returns

NameTypeDescription
<none>string

decimals

Returns the number of decimals.

function decimals() public view virtual returns (uint8);

Returns

NameTypeDescription
<none>uint8

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect ERC20 methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: allowance(address,address) 0xdd62ed3e approve(address,uint256) 0x095ea7b3 balanceOf(address) 0x70a08231 decimals() 0x313ce567 name() 0x06fdde03 symbol() 0x95d89b41 totalSupply() 0x18160ddd transfer(address,uint256) 0xa9059cbb transferFrom(address,address,uint256) 0x23b872dd

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes