This documentation covers Materia-specific functionality. For ERC-20 functionality, see Pair (ERC-20).
See Pair Addresses.
event Mint(address indexed sender, uint amount0, uint amount1);
Emitted each time liquidity tokens (MPs) are created via mint.
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
Emitted each time liquidity tokens (MPs) are destroyed via burn.
event Swap(address indexed sender,uint amount0In,uint amount1In,uint amount0Out,uint amount1Out,address indexed to);
Emitted each time a swap occurs via swap.
event Sync(uint112 reserve0, uint112 reserve1);
Emitted each time reserves are updated via mint, burn, swap, or sync.
function MINIMUM_LIQUIDITY() external pure returns (uint);
Returns 1000
for all pairs. See Minimum Liquidity.
function factory() external view returns (address);
Returns the factory address.
function owner() external view returns (address);
Returns the owner address, that is the factory.
function token0() external view returns (address);
Returns the address of the pair token with the lower sort order.
function token1() external view returns (address);
Returns the address of the pair token with the higher sort order.
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
Returns the reserves of token0 and token1 used to price trades and distribute liquidity. See Pricing. Also returns the block.timestamp
(mod 2**32
) of the last block during which an interaction occured for the pair.
function price0CumulativeLast() external view returns (uint);
See Oracles.
function price1CumulativeLast() external view returns (uint);
See Oracles.
function kLast() external view returns (uint);
Returns the product of the reserves as of the most recent liquidity event. See Protocol Charge Calculation.
function mint(address to) external returns (uint liquidity);
Creates pool tokens.
function burn(address to) external returns (uint amount0, uint amount1);
Destroys pool tokens.
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
Swaps tokens. For regular swaps, data.length
must be 0
. Also see Flash Swaps.
function skim(address to) external;
See the whitepaper.
function sync() external;
See the whitepaper.
function setMateriFee(uint materiaFee) external;
Set the Materia fee, must be called by the owner, that is the factory.
function sync() external;
Set the swap fee, must be called by the owner, that is the factory.
pragma solidity >=0.5.0;interface IMateriaPair {event Approval(address indexed owner, address indexed spender, uint256 value);event Transfer(address indexed from, address indexed to, uint256 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 (uint256);function balanceOf(address owner) external view returns (uint256);function allowance(address owner, address spender) external view returns (uint256);function approve(address spender, uint256 value) external returns (bool);function transfer(address to, uint256 value) external returns (bool);function transferFrom(address from,address to,uint256 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 (uint256);function permit(address owner,address spender,uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) external;event Mint(address indexed sender, uint256 amount0, uint256 amount1);event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);event Swap(address indexed sender,uint256 amount0In,uint256 amount1In,uint256 amount0Out,uint256 amount1Out,address indexed to);event Sync(uint112 reserve0, uint112 reserve1);function MINIMUM_LIQUIDITY() external pure returns (uint256);function factory() external view returns (address);function token0() external view returns (address);function token1() external view returns (address);function getReserves()externalviewreturns (uint112 reserve0,uint112 reserve1,uint32 blockTimestampLast);function price0CumulativeLast() external view returns (uint256);function price1CumulativeLast() external view returns (uint256);function kLast() external view returns (uint256);function mint(address to) external returns (uint256 liquidity);function burn(address to) external returns (uint256 amount0, uint256 amount1);function swap(uint256 amount0Out,uint256 amount1Out,address to,bytes calldata data) external;function skim(address to) external;function sync() external;function initialize(address,address,uint256,uint256) external;function setMateriaFee(uint256 _materiaFee) external;function setSwapFee(uint256 _swapFee) external;function materiaFee() external view returns (uint256);function swapFee() external view returns (uint256);function owner() external view returns (address);function renounceOwnership() external;function transferOwnership(address newOwner) external;}
import IMateriaPair from '@materia/materia-contracts-core/build/IMateriaPair.json'