Class ConcentratedLiquidityPool

Represents a liquidity pool that uses concentrated liquidity (e.g. Uniswap V3).

Hierarchy

  • ConcentratedLiquidityPool

Constructors

Properties

feeRate: number

The amount of fees taken from each transaction with the pool.

positions: Map<string, ConcentratedLiquidityPosition> = ...

Holds a map of all active positions in the liquidity pool.

sqrtPrice: number

The internal representation of the price. The square root is tracked for easier math.

Accessors

  • get price(): number
  • Current price of X as expressed in Y (i.e. amount of Y tokens needed to buy 1 token of X).

    Returns number

Methods

  • Parameters

    • __namedParameters: {
          direction: Direction;
          feesToSplit: number;
          token: "x" | "y";
          totalLiquidity: number;
      }
      • direction: Direction
      • feesToSplit: number
      • token: "x" | "y"
      • totalLiquidity: number

    Returns void

  • When you enter a position, you start providing liquidity to the pool. The position will gain rewards when a trade occurs inside the range in which it is active.

    Parameters

    • params: {
          balance?: undefined;
          liquidity: number;
          range: Range;
      } | {
          balance: Balance;
          liquidity?: undefined;
          range: Range;
      }

    Returns ConcentratedLiquidityPosition

  • Exit all tokens of a position and the rewards that were acrued.

    Parameters

    • id: string

    Returns {
        x: number;
        y: number;
    }

    • x: number
    • y: number
  • Consider all positions whose range includes the current price and find the narrowest range that is contained by all the ranges of the matched positions. Within this range, the liquidity stays constant during price movements.

    Returns

    The current active range.

    Parameters

    • dir: Direction = Direction.UP

      The direction of price movement to consider. This becomes relevant when you're at a point exactly in between two possible ranges, each of which could have a different virtual liquidity

    Returns Range

  • Returns

    The amount of virtual liquidity that is available in the current active range.

    Parameters

    • dir: Direction

      The direction of price movement to consider. This becomes relevant when you're at a point exactly in between two possible ranges, each of which could have a different virtual liquidity

    Returns number

  • Make a trade that moves the price to the target.

    Returns

    The balance delta required to make this trade. Negative values are paid to the pool, positive values are received in return.

    Parameters

    • targetPrice: number

    Returns {
        delta: Balance;
    }

Generated using TypeDoc