Skip to main content
Version: V2

Pool

This documentation covers KyberSwap-specific functionality. For ERC-20 functionality, see Pair (ERC-20).

Code

DMMPool.sol

Address

See Pool Addresses.

Events

Mint

event Mint(address indexed sender, uint256 amount0, uint256 amount1);

Emitted each time liquidity tokens are created via mint.

Burn

event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);

Emitted each time liquidity tokens are destroyed via burn.

Swap

event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to,
uint256 feeInPrecision
);

Emitted each time a swap occurs via swap.

Sync

event Sync(uint256 vReserve0, uint256 vReserve1, uint256 reserve0, uint256 reserve1);

Emitted each time reserves are updated via mint, burn, swap, or sync.

Read-Only Functions

MINIMUM_LIQUIDITY

function MINIMUM_LIQUIDITY() external pure returns (uint);

Returns 1000 for all pairs.

factory

function factory() external view returns (address);

Returns the factory address.

token0

function token0() external view returns (address);

Returns the address of the pair token with the lower sort order.

token1

function token1() external view returns (address);

Returns the address of the pair token with the higher sort order.

getReserves

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.

getTradeInfo

function getTradeInfo() external virtual override view returns (
uint112 _reserve0, uint112 _reserve1, uint112 _vReserve0, uint112 _vReserve1, uint256 feeInPrecision)

Returns the actual and virtual balances of token0 and token1 used to price trades and distirbute liquidity. Also returns the dynamic trade fee being charged to the trader.

kLast

function kLast() external view returns (uint256);

Returns the product of the reserves as of the most recent liquidity event. See Protocol Fee.

State-Changing Functions

mint

function mint(address to) external returns (uint256 liquidity);

Creates pool tokens, which are sent to the to address.

burn

function burn(address to) external returns (uint amount0, uint amount1);

Destroys pool tokens.

swap

function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata callbackData) external;

Swaps tokens.

skim

function skim(address to) external;

Gets actual token balances to match the reserve accounted balances reserve0 and reserve1.

sync

function sync() external;

Syncs virtual and actual reserve accounted balances with actual token balances.

Interface

import '@dynamic-amm/smart-contracts/contracts/interfaces/IDMMPool.sol';
pragma solidity 0.6.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "./IDMMFactory.sol";

interface IDMMPool {
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 sync() external;

function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);

function getTradeInfo()
external
view
returns (
uint112 _vReserve0,
uint112 _vReserve1,
uint112 reserve0,
uint112 reserve1,
uint256 feeInPrecision
);

function token0() external view returns (IERC20);

function token1() external view returns (IERC20);

function ampBps() external view returns (uint32);

function factory() external view returns (IDMMFactory);

function kLast() external view returns (uint256);
}

ABI

import IDMMPool from '@dynamic-amm/smart-contracts/artifacts/contracts/interfaces/IDMMPool.sol/IDMMPool.json';

https://unpkg.com/@dynamic-amm/smart-contracts/artifacts/contracts/interfaces/IDMMPool.sol/IDMMPool.json