This documentation covers ERC-20 functionality for denominating pool tokens. For Uniswap-specific functionality, see Pair.
event Approval(address indexed owner, address indexed spender, uint value);
Emitted each time an approval occurs via approve or permit.
event Transfer(address indexed from, address indexed to, uint value);
Emitted each time a transfer occurs via transfer, transferFrom, mint, or burn.
function name() external pure returns (string memory);
Returns Uniswap V2
for all pairs.
function symbol() external pure returns (string memory);
Returns UNI-V2
for all pairs.
function decimals() external pure returns (uint8);
Returns 18
for all pairs.
function totalSupply() external view returns (uint);
Returns the total amount of pool tokens for a pair.
function balanceOf(address owner) external view returns (uint);
Returns the amount of pool tokens owned by an address.
function allowance(address owner, address spender) external view returns (uint);
Returns the amount of liquidity tokens owned by an address that a spender is allowed to transfer via transferFrom.
function DOMAIN_SEPARATOR() external view returns (bytes32);
Returns a domain separator for use in permit.
function PERMIT_TYPEHASH() external view returns (bytes32);
Returns a typehash for use in permit.
function nonces(address owner) external view returns (uint);
Returns the current nonce for an address for use in permit.
function approve(address spender, uint value) external returns (bool);
Lets msg.sender
set their allowance for a spender.
function transfer(address to, uint value) external returns (bool);
Lets msg.sender
send pool tokens to an address.
function transferFrom(address from, address to, uint value) external returns (bool);
Sends pool tokens from one address to another.
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
Sets the allowance for a spender where approval is granted via a signature.
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2ERC20.sol';
pragma solidity >=0.5.0;interface IUniswapV2ERC20 {event Approval(address indexed owner, address indexed spender, uint value);event Transfer(address indexed from, address indexed to, uint value);function name() external pure returns (string memory);function symbol() external pure returns (string memory);function decimals() external pure returns (uint8);function totalSupply() external view returns (uint);function balanceOf(address owner) external view returns (uint);function allowance(address owner, address spender) external view returns (uint);function approve(address spender, uint value) external returns (bool);function transfer(address to, uint value) external returns (bool);function transferFrom(address from, address to, uint value) external returns (bool);function DOMAIN_SEPARATOR() external view returns (bytes32);function PERMIT_TYPEHASH() external pure returns (bytes32);function nonces(address owner) external view returns (uint);function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;}
import IUniswapV2ERC20 from '@uniswap/v2-core/build/IUniswapV2ERC20.json'
https://unpkg.com/@uniswap/[email protected]/build/IUniswapV2ERC20.json