Flat LP Calls

Simple LP operations should use flat calls for gas efficiency. Supported flat operations are:

  • Mint ambient liquidity

  • Mint concentrated liquidity

  • Burn ambient liquidity

  • Burn concentrated liquidity

  • Harvest accumulated fees in concentrated liquidity

Flat LP calls use callpath index 2:

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 call code specifies the type of LP action according to the following codes:

  • Mint concentrated liquidity:

    • 1 - Fixed in liquidity units

    • 11 - Fixed in base tokens

    • 12 - Fixed in quote tokens

  • Burn concentrated liquidity:

    • 2 - Fixed in liquidity units

    • 21 - Fixed in base tokens

    • 22 - Fixed in quote tokens

  • Mint ambient liquidity

    • 3 - Fixed in liquidity units

    • 31 - Fixed in base tokens

    • 32 - Fixed in quote tokens

  • Burn ambient liquidity

    • 4 - Fixed in liquidity units

    • 41 - Fixed in base tokens

    • 42 - Fixed in quote tokens

  • 5 - Harvest accumulated fees (concentrated liquidity)

The remaining parameters are

  • base - The address of the base token or virtual token

  • quote - The address of the quote token or virtual token

  • poolIdx - The arbitrary index of the pool type the user is swapping on.

  • bidTick - The tick index of the lower range of the LP position (ignored for ambient liquidity operations)

  • askTick - The tick index of the lower range of the LP position (ignored for ambient liquidity operations)

  • qty - The size of the liquidity being added or removed. Fixed in terms of liquidity units, base token deposit or quote token deposit. Ignored for harvest calls.

  • limitLower - The minimum acceptable curve price. If the price of the pool is below this threshold the transaction will revert.

  • limitUpper - The maximum acceptable curve price. If the price of the pool is above this threshold the transaction will revert.

  • settleFlags - Flag indicating how the user wants to settle the traded tokens for this swap (seeType Conventions)

  • lpConduit - The address of the tracker the liquidity is deposited at. E.g. the LP token tracken if the user is creating ERC20 LP tokens. If LP position is stored natively at the exhange this should be to address(0)

Last updated