LFJ Developer Docs
  • Liquidity Book
  • Introduction
  • LB V2.2 Key Changes
  • Guides
    • Swap Tokens
    • Add/Remove Liquidity
    • Tracking Volume
    • Tracking Pool Balances
    • Finding The Best Quote
    • Byte32 Decoding
    • Price From Bin Id
    • Bin Id From Price
    • Finding Liquidity Depth
    • User Balances
  • Concepts
    • Concentrated Liquidity
    • Bin Math
    • Bin Liquidity
    • Swaps
    • Fees
    • Oracle
  • Contracts
    • Interfaces
      • ILBLegacyFactory
      • ILBLegacyToken
      • ILBLegacyPair
      • ILBLegacyRouter
      • ILBFlashLoanCallback
      • IPendingOwnable
      • IJoeFactory
      • IJoePair
      • IJoeRouter01
      • IJoeRouter02
      • IWNATIVE
      • ILBFactory
      • ILBHooks
      • ILBPair
      • ILBRouter
      • ILBToken
    • Libraries
      • Math
        • BitMath
        • Encoded
        • LiquidityConfigurations
        • PackedUint128Math
        • SafeCast
        • SampleMath
        • TreeMath
        • Uint128x128Math
        • Uint256x256Math
      • BinHelper
      • Clone
      • Constants
      • FeeHelper
      • Hooks
      • ImmutableClone
      • JoeLibrary
      • OracleHelper
      • PairParameterHelper
      • PriceHelper
      • ReentrancyGuardUpgradeable
      • TokenHelper
    • LBBaseHooks
    • LBFactory
    • LBPair
    • LBQuoter
    • LBRouter
    • LBToken
  • Deployment Addresses
    • Avalanche C-Chain
    • Fuji Testnet
    • Arbitrum One
    • Binance Smart Chain
    • Binance Smart Chain Testnet
    • Ethereum Mainnet
    • Monad Testnet
  • SDK
    • Introduction
    • Making a Trade
    • Adding Liquidity
    • Removing Liquidity
  • Audits
  • AMM
    • Joe V1 Contracts
    • Joe V1 Audits
  • LFJ DEX API
    • Dex Analytics
    • Pools
    • Rewards
    • User
    • User Lifetime Stats
    • Vaults
    • Models
  • LFJ Aggregator API
    • Default
    • Models
Powered by GitBook
On this page
  • MintArrays
  • DepositedToBins
  • WithdrawnFromBins
  • CompositionFees
  • CollectedProtocolFees
  • Swap
  • StaticFeeParametersSet
  • FlashLoan
  • OracleLengthIncreased
  • ForcedDecay
  • initialize
  • getFactory
  • getTokenX
  • getTokenY
  • getBinStep
  • getReserves
  • getActiveId
  • getBin
  • getNextNonEmptyBin
  • getProtocolFees
  • getStaticFeeParameters
  • getVariableFeeParameters
  • getOracleParameters
  • getOracleSampleAt
  • getPriceFromId
  • getIdFromPrice
  • getSwapIn
  • getSwapOut
  • swap
  • flashLoan
  • mint
  • burn
  • collectProtocolFees
  • increaseOracleLength
  • setStaticFeeParameters
  • forceDecay
  1. Contracts
  2. Interfaces

ILBPair

Required interface of LBPair contract

MintArrays

struct MintArrays {
    uint256[] ids;
    bytes32[] amounts;
    uint256[] liquidityMinted;
}

DepositedToBins

event DepositedToBins(address indexed sender, address indexed to, uint256[] ids, bytes32[] amounts)

WithdrawnFromBins

event WithdrawnFromBins(address indexed sender, address indexed to, uint256[] ids, bytes32[] amounts)

CompositionFees

event CompositionFees(address indexed sender, uint24 id, bytes32 totalFees, bytes32 protocolFees)

CollectedProtocolFees

event CollectedProtocolFees(address indexed feeRecipient, bytes32 protocolFees)

Swap

event Swap(
    address indexed sender,
    address indexed to,
    uint24 id,
    bytes32 amountsIn,
    bytes32 amountsOut,
    uint24 volatilityAccumulator,
    bytes32 totalFees,
    bytes32 protocolFees
    )

StaticFeeParametersSet

event StaticFeeParametersSet(
    address indexed sender,
    uint16 baseFactor,
    uint16 filterPeriod,
    uint16 decayPeriod,
    uint16 reductionFactor,
    uint24 variableFeeControl,
    uint16 protocolShare,
    uint24 maxVolatilityAccumulator
    )

FlashLoan

event FlashLoan(
    address indexed sender,
    ILBFlashLoanCallback indexed receiver,
    uint24 activeId,
    bytes32 amounts,
    bytes32 totalFees,
    bytes32 protocolFees
    )

OracleLengthIncreased

event OracleLengthIncreased(address indexed sender, uint16 oracleLength)

ForcedDecay

event ForcedDecay(address indexed sender, uint24 idReference, uint24 volatilityReference)

initialize

function initialize(
    uint16 baseFactor,
    uint16 filterPeriod,
    uint16 decayPeriod,
    uint16 reductionFactor,
    uint24 variableFeeControl,
    uint16 protocolShare,
    uint24 maxVolatilityAccumulator,
    uint24 activeId
) external override onlyFactory

getFactory

function getFactory() external view override returns (ILBFactory factory)

getTokenX

function getTokenX() external pure override returns (IERC20 tokenX)

getTokenY

function getTokenY() external pure override returns (IERC20 tokenY)

getBinStep

function getBinStep() external pure override returns (uint16)

getReserves

function getReserves() external view override returns (uint128 reserveX, uint128 reserveY)

getActiveId

function getActiveId() external view override returns (uint24 activeId)

getBin

function getBin(uint24 id) external view override returns (uint128 binReserveX, uint128 binReserveY)

getNextNonEmptyBin

function getNextNonEmptyBin(bool swapForY, uint24 id) external view override returns (uint24 nextId)

getProtocolFees

function getProtocolFees() external view returns (uint128 protocolFeeX, uint128 protocolFeeY)

getStaticFeeParameters

function getStaticFeeParameters() external view returns (uint16 baseFactor, uint16 filterPeriod, uint16 decayPeriod, uint16 reductionFactor, uint24 variableFeeControl, uint16 protocolShare, uint24 maxVolatilityAccumulator)

getVariableFeeParameters

function getVariableFeeParameters() external view returns (uint24 volatilityAccumulator, uint24 volatilityReference, uint24 idReference, uint40 timeOfLastUpdate)

getOracleParameters

function getOracleParameters() external view returns (uint8 sampleLifetime, uint16 size, uint16 activeSize, uint40 lastUpdated, uint40 firstTimestamp)

getOracleSampleAt

function getOracleSampleAt(uint40 lookupTimestamp) external view returns (uint64 cumulativeId, uint64 cumulativeVolatility, uint64 cumulativeBinCrossed)

getPriceFromId

function getPriceFromId(uint24 id) external pure returns (uint256 price)

getIdFromPrice

function getIdFromPrice(uint256 price) external pure returns (uint24 id)

getSwapIn

function getSwapIn(uint128 amountOut, bool swapForY) external view returns (uint128 amountIn, uint128 amountOutLeft, uint128 fee)

getSwapOut

function getSwapOut(uint128 amountIn, bool swapForY) external view override returns (uint128 amountInLeft, uint128 amountOut, uint128 fee)

swap

function swap(bool swapForY, address to) external override nonReentrant returns (bytes32 amountsOut)

flashLoan

function flashLoan(ILBFlashLoanCallback receiver, bytes32 amounts, bytes calldata data) external override nonReentrant

mint

function mint(address to, bytes32[] calldata liquidityConfigs, address refundTo) external override nonReentrant returns (bytes32 amountsReceived, bytes32 amountsLeft, uint256[] memory liquidityMinted)

burn

function burn(address from, address to, uint256[] calldata ids, uint256[] calldata amountsToBurn) external override nonReentrant checkApproval(from, msg.sender) returns (bytes32[] memory amounts)

collectProtocolFees

function collectProtocolFees() external override nonReentrant onlyProtocolFeeRecipient returns (bytes32 collectedProtocolFees)

increaseOracleLength

function increaseOracleLength(uint16 newLength) external override

setStaticFeeParameters

function setStaticFeeParameters(
    uint16 baseFactor,
    uint16 filterPeriod,
    uint16 decayPeriod,
    uint16 reductionFactor,
    uint24 variableFeeControl,
    uint16 protocolShare,
    uint24 maxVolatilityAccumulator
) external override onlyFactory

forceDecay

function forceDecay() external override onlyFactory
PreviousILBHooksNextILBRouter

Last updated 8 days ago