πŸ•ŠοΈ
DoveSwap
  • πŸ‘‹Welcome to DoveSwap
  • πŸ•ŠοΈOverview
  • Concepts
    • πŸ’‘Ecosystem Participants
    • ✨Glossary
    • 🧠Core Concepts
      • Swaps
      • Pools
      • Flash Swaps
      • Oracles
    • πŸ”¬Advanced Concepts
      • Fees
      • Pricing
      • Understanding Returns
  • πŸ“–Guides
    • πŸ“ˆSwapping tokens
    • πŸ’°Adding Liquidity
  • πŸ› οΈTechnical Reference
    • Smart Contracts
      • Factory
      • Pair
      • Pair (ERC-20)
      • Library
      • Router
    • Governance
Powered by GitBook
On this page
  • Events
  • Mint​
  • Burn​
  • Swap​
  • Sync​
  • Read-Only Functions
  • MINIMUM_LIQUIDITY​
  • factory​
  • token0​
  • token1​
  • getReserves​
  • price0CumulativeLast​
  • price1CumulativeLast​
  • kLast​
  • State-Changing Functions
  • mint​
  • burn​
  • swap​
  • skim​
  • sync​
  1. Technical Reference
  2. Smart Contracts

Pair

PreviousFactoryNextPair (ERC-20)

Last updated 2 years ago

This documentation covers DoveSwap-specific functionality. For ERC-20 functionality, see .

Events

Mint

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

Emitted each time liquidity tokens are created via .

Burn

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

Emitted each time liquidity tokens are destroyed via .

Swap

event Swap(
  address indexed sender,
  uint amount0In,
  uint amount1In,
  uint amount0Out,
  uint amount1Out,
  address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);

Read-Only Functions

function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
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);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);

State-Changing Functions

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;
function skim(address to) external;

Functions as a recovery mechanism in case enough tokens are sent to an pair to overflow the two uint112 storage slots for reserves, which could otherwise cause trades to fail. skim() allows a user to withdraw the difference between the current balance of the pair and 2**112βˆ’1 to the caller, if that difference is greater than 0

function sync() external;

Functions as a recovery mechanism in the case that a token asynchronously deflates the balance of a pair. In this case, trades will receive sub-optimal rates, and if no liquidity provider is willing to rectify the situation, the pair is stuck. sync() exists to set the reserves of the contract to the current balances, providing a somewhat graceful recoveryfrom this situation

Emitted each time a swap occurs via .

Sync

Emitted each time reserves are updated via , , , or .

MINIMUM_LIQUIDITY

Returns 1000 for all pairs. See .

factory

Returns the .

token0

token1

getReserves

Returns the reserves of token0 and token1 used to price trades and distribute liquidity. See . Also returns the block.timestamp (mod 2**32) of the last block during which an interaction occured for the pair.

price0CumulativeLast

See .

price1CumulativeLast

See .

kLast

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

mint

Emits , , .

burn

Emits , , .

swap

Swaps tokens. For regular swaps, data.length must be 0. Also see .

Emits , .

skim

sync

Emits .

πŸ› οΈ
​
​
​
​
​
​
Pricing
​
Oracles
​
Oracles
​
Protocol Charge Calculation
​
​
​
Flash Swaps
​
​
Pair (ERC-20)
​
​
​
mint
burn
swap
mint
burn
swap
sync
Minimum Liquidity
Swap
Sync
Sync
Mint
Sync
Burn
Sync
factory address
Transfer
Transfer