ERC20
Authors: Solmate (https://github.com/transmissions11/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 + EIP-2612 implementation.
Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
State Variables
name
string public name;
symbol
string public symbol;
decimals
uint8 public immutable decimals;
totalSupply
uint256 public totalSupply;
balanceOf
mapping(address => uint256) public balanceOf;
allowance
mapping(address => mapping(address => uint256)) public allowance;
INITIAL_CHAIN_ID
uint256 internal immutable INITIAL_CHAIN_ID;
INITIAL_DOMAIN_SEPARATOR
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
nonces
mapping(address => uint256) public nonces;
Functions
constructor
constructor(string memory _name, string memory _symbol, uint8 _decimals);
approve
function approve(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);
permit
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
public
virtual;
DOMAIN_SEPARATOR
function DOMAIN_SEPARATOR() public view virtual returns (bytes32);
computeDomainSeparator
function computeDomainSeparator() internal view virtual returns (bytes32);
_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);