ILBRouter

Required interface of LBRouter contract

Version

enum Version{
    V1,
    V2,
    V2_1
}

This enum represents the version of the pair requested:

  • V1: Joe V1 pair

  • V2: LB pair V2. Also called legacyPair

  • V2_1: LB pair V2.1 (current version)

LiquidityParameters

struct LiquidityParameters {
IERC20 tokenX;
    IERC20 tokenY;
    uint256 binStep;
    uint256 amountX;
    uint256 amountY;
    uint256 amountXMin;
    uint256 amountYMin;
    uint256 activeIdDesired;
    uint256 idSlippage;
    int256[] deltaIds;
    uint256[] distributionX;
    uint256[] distributionY;
    address to;
    address refundTo;
    uint256 deadline;
}

The liquidity parameters, such as:

  • tokenX: The address of token X

  • tokenY: The address of token Y

  • binStep: The bin step of the pair

  • amountX: The amount to send of token X

  • amountY: The amount to send of token Y

  • amountXMin: The min amount of token X added to liquidity

  • amountYMin: The min amount of token Y added to liquidity

  • activeIdDesired: The active id that user wants to add liquidity from

  • idSlippage: The number of id that are allowed to slip

  • deltaIds: The list of delta ids to add liquidity (deltaId = activeId - desiredId)

  • distributionX: The distribution of tokenX with sum(distributionX) = 100e18 (100%) or 0 (0%)

  • distributionY: The distribution of tokenY with sum(distributionY) = 100e18 (100%) or 0 (0%)

  • to: The address of the recipient

  • refundTo: The refund address for the X or Y token left

  • deadline: The deadline of the tx

Path

The path parameters, such as:

  • pairBinSteps: The list of bin steps of the pairs to go through

  • versions: The list of versions of the pairs to go through

  • tokenPath: The list of tokens in the path to go through

getFactory

getLegacyFactory

getV1Factory

getLegacyRouter

getWNATIVE

getIdFromPrice

getPriceFromId

getSwapIn

getSwapOut

createLBPair

addLiquidity

addLiquidityNATIVE

removeLiquidity

removeLiquidityNATIVE

swapExactTokensForTokens

swapExactTokensForNATIVE

swapExactNATIVEForTokens

swapTokensForExactTokens

swapTokensForExactNATIVE

Swaps tokens for exact NATIVE while performing safety checks

swapNATIVEForExactTokens

swapExactTokensForTokensSupportingFeeOnTransferTokens

swapExactTokensForNATIVESupportingFeeOnTransferTokens

swapExactNATIVEForTokensSupportingFeeOnTransferTokens

sweep

sweepLBToken

Last updated