Skip to main content
Version: 3.0.0

Pool

Represents a V3 pool

Constructors#

constructor#

+ new Pool(tokenA: Token, tokenB: Token, fee: FeeAmount, sqrtRatioX96: BigintIsh, liquidity: BigintIsh, tickCurrent: number, ticks?: TickDataProvider | (Tick | TickConstructorArgs)[]): Pool

Construct a pool

Parameters#

NameTypeDescription
tokenATokenone of the tokens in the pool
tokenBTokenthe other token in the pool
feeFeeAmountthe fee in hundredths of a bips of the input amount of every swap that is collected by the pool
sqrtRatioX96BigintIshthe sqrt of the current ratio of amounts of token1 to token0
liquidityBigintIshthe current value of in range liquidity
tickCurrentnumberthe current tick of the pool
ticksTickDataProvider | (Tick | TickConstructorArgs)[]the current state of the pool ticks or a data provider that can return tick data

Returns: Pool

Defined in: entities/pool.ts:46

Properties#

fee#

Readonly fee: FeeAmount

Defined in: entities/pool.ts:35


liquidity#

Readonly liquidity: default

Defined in: entities/pool.ts:37


sqrtRatioX96#

Readonly sqrtRatioX96: default

Defined in: entities/pool.ts:36


tickCurrent#

Readonly tickCurrent: number

Defined in: entities/pool.ts:38


tickDataProvider#

Readonly tickDataProvider: TickDataProvider

Defined in: entities/pool.ts:39


token0#

Readonly token0: Token

Defined in: entities/pool.ts:33


token1#

Readonly token1: Token

Defined in: entities/pool.ts:34

Accessors#

chainId#

• get chainId(): number

Returns the chain ID of the tokens in the pool.

Returns: number

Defined in: entities/pool.ts:135


tickSpacing#

• get tickSpacing(): number

Returns: number

Defined in: entities/pool.ts:287


token0Price#

• get token0Price(): Price<Token, Token>

Returns the current mid price of the pool in terms of token0, i.e. the ratio of token1 over token0

Returns: Price<Token, Token>

Defined in: entities/pool.ts:96


token1Price#

• get token1Price(): Price<Token, Token>

Returns the current mid price of the pool in terms of token1, i.e. the ratio of token0 over token1

Returns: Price<Token, Token>

Defined in: entities/pool.ts:111

Methods#

getInputAmount#

getInputAmount(outputAmount: CurrencyAmount<Token>, sqrtPriceLimitX96?: default): Promise<[CurrencyAmount<Token>, Pool]>

Given a desired output amount of a token, return the computed input amount and a pool with state updated after the trade

Parameters#

NameTypeDescription
outputAmountCurrencyAmount<Token>the output amount for which to quote the input amount
sqrtPriceLimitX96?default-

Returns: Promise<[CurrencyAmount<Token>, Pool]>

Defined in: entities/pool.ts:167


getOutputAmount#

getOutputAmount(inputAmount: CurrencyAmount<Token>, sqrtPriceLimitX96?: default): Promise<[CurrencyAmount<Token>, Pool]>

Given an input amount of a token, return the computed output amount and a pool with state updated after the trade

Parameters#

NameTypeDescription
inputAmountCurrencyAmount<Token>the input amount for which to quote the output amount
sqrtPriceLimitX96?default-

Returns: Promise<[CurrencyAmount<Token>, Pool]>

Defined in: entities/pool.ts:143


involvesToken#

involvesToken(token: Token): boolean

Returns true if the token is either token0 or token1

Parameters#

NameTypeDescription
tokenTokento check

Returns: boolean

Defined in: entities/pool.ts:89


priceOf#

priceOf(token: Token): Price<Token, Token>

Return the price of the given token in terms of the other token in the pool.

Parameters#

NameTypeDescription
tokenTokentoken to return price of

Returns: Price<Token, Token>

Defined in: entities/pool.ts:127


getAddress#

Static getAddress(tokenA: Token, tokenB: Token, fee: FeeAmount): string

Parameters#

NameType
tokenAToken
tokenBToken
feeFeeAmount

Returns: string

Defined in: entities/pool.ts:44