Skip to main content

CloneERC20

Git Source

Inherits: Clone

Authors: Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol), Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)

Modern and gas efficient ERC20 implementation.

Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.

State Variables

totalSupply

uint256 public totalSupply;

balanceOf

mapping(address => uint256) public balanceOf;

allowance

mapping(address => mapping(address => uint256)) public allowance;

Functions

name

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

symbol

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

decimals

function decimals() external pure returns (uint8);

approve

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

increaseAllowance

function increaseAllowance(address spender, uint256 amount) public virtual returns (bool);

decreaseAllowance

function decreaseAllowance(address spender, uint256 amount) public virtual returns (bool);

transfer

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

transferFrom

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

_mint

function _mint(address to, uint256 amount) internal virtual;

_burn

function _burn(address from, uint256 amount) internal virtual;

Events

Transfer

event Transfer(address indexed from, address indexed to, uint256 amount);

Approval

event Approval(address indexed owner, address indexed spender, uint256 amount);