Skip to content

LP Operations

TIP

ERC20 LP tokens are minted and burned during LP operations. The quantity is based on the incremental liquidity deposited to or withdrawn from the pool.

Supported LP operations include:

  • Minting liquidity
  • Burning liquidity

LP operations use callpath index 2:

solidity
userCmd(2, abi.encode(
    code,         // uint8
    base,         // address
    quote,        // address
    poolIdx,      // uint256
    bidTick,      // int24
    askTick,      // int24
    qty,          // uint128
    limitLower,   // uint128
    limitHigher,  // uint128
    settleFlags,  // uint8
    lpConduit     // address
))

The code specifies the type of LP action according to the following codes:

Mint liquidity

  • 3 - Fixed in liquidity units
  • 31 - Fixed in base tokens
  • 32 - Fixed in quote tokens

Burn liquidity

  • 4 - Fixed in liquidity units
  • 41 - Fixed in base tokens
  • 42 - Fixed in quote tokens

The remaining parameters are:

NameTypeDescription
baseaddressThe address of the base token
quoteaddressThe address of the quote token
poolIdxuint256The index of the pool
bidTickint24Will be 0 for full-range liquidity
askTickint24Will be 0 for full-range liquidity
qtyuint128The size of the liquidity being added or removed. Fixed in terms of liquidity units, base token deposit or quote token deposit
limitLoweruint128The minimum acceptable curve price. If the price of the pool is below this threshold the transaction will revert
limitHigheruint128The maximum acceptable curve price. If the price of the pool is above this threshold the transaction will revert
settleFlagsuint8Flag indicating how user wants to settle the tokens (see Type Conventions)
lpConduitaddressThe address of LP token