Skip to main content

ERC-20

This standard provides basic functionality to transfer tokens, as well as allow tokens to be approved so they can be spent by another on-chain third party.

eip-20

Functions

FunctionNotes
totalSupply()
balanceOf(account)
allowance(owner, spender)
approve(spender, amount)
transfer(to, amount)
transferFrom(from, to, amount)

Transfer

Some ERC20 contracts were created before the EIP-20 standard was published correctly. Therefore it is necessary to take extra precautions to confirm that a transfer to another ERC20 contract is valid.

danger

It is necessary to take extra precautions to confirm that a transfer to another ERC20 contract is valid.

    function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}

Events

Transfer(from, to, value)

Approval(owner, spender, value)

Checklists

Use these checklists to confirm best practices have been followed and no security issues exist.