This documentation covers Dragonswap-specific functionality. For ERC-20 functionality, see Pair (ERC-20) .
Code
DragonswapPair.sol
Events
Copy event Mint ( address indexed sender, uint amount0, uint amount1);
Emitted each time liquidity tokens are created via mint .
Copy event Burn ( address indexed sender, uint amount0, uint amount1, address indexed to);
Emitted each time liquidity tokens are destroyed via burn .
Copy event Swap (
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
Emitted each time a swap occurs via swap .
Copy event Sync ( uint112 reserve0, uint112 reserve1);
Emitted each time reserves are updated via mint , burn , swap , or sync .
Read-Only Functions
Copy function MINIMUM_LIQUIDITY () external pure returns ( uint );
Returns 1000
for all pairs. See Minimum Liquidity .
Copy function factory () external view returns ( address );
Returns the factory address .
Copy function token0 () external view returns ( address );
Returns the address of the pair token with the lower sort order.
Copy function token1 () external view returns ( address );
Returns the address of the pair token with the higher sort order.
Copy 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. Also returns the block.timestamp
(mod 2**32
) of the last block during which an interaction occured for the pair.
Copy function price0CumulativeLast () external view returns ( uint );
Copy function price1CumulativeLast () external view returns ( uint );
Copy function kLast () external view returns ( uint );
Returns the product of the reserves as of the most recent liquidity event.
State-Changing Functions
Copy function mint ( address to) external returns ( uint liquidity);
Creates pool tokens.
Copy function burn ( address to) external returns ( uint amount0 , uint amount1);
Destroys pool tokens.
Copy function swap ( uint amount0Out , uint amount1Out , address to , bytes calldata data) external ;
Swaps tokens. For regular swaps, data.length
must be 0
.
Copy function skim ( address to) external ;
Copy function sync () external ;
Interface
Copy import '@dragonswap/contracts/interfaces/IDragonswapPair.sol' ;
Copy pragma solidity >=0.5.0;
interface IDragonswapPair {
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 ;
event Mint ( address indexed sender, uint amount0, uint amount1);
event Burn ( address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap (
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync ( uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY () external pure returns ( uint );
function factory () external view returns ( address );
function token0 () external view returns ( address );
function token1 () external view returns ( address );
function getReserves () external view returns ( uint112 reserve0 , uint112 reserve1 , uint32 blockTimestampLast);
function price0CumulativeLast () external view returns ( uint );
function price1CumulativeLast () external view returns ( uint );
function kLast () external view returns ( uint );
function mint ( address to) external returns ( uint liquidity);
function burn ( address to) external returns ( uint amount0 , uint amount1);
function swap ( uint amount0Out , uint amount1Out , address to , bytes calldata data) external ;
function skim ( address to) external ;
function sync () external ;
function initialize ( address , address ) external ;
}
ABI
https://github.com/dragonswap-app/dragonswap-core/blob/7daf58214605f2bcbb2b06d295acc1d891437fc7/deployments/abis.json#L1195
Last updated 3 months ago