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
#
ParametersName | Type | Description |
---|---|---|
tokenA | Token | one of the tokens in the pool |
tokenB | Token | the other token in the pool |
fee | FeeAmount | the fee in hundredths of a bips of the input amount of every swap that is collected by the pool |
sqrtRatioX96 | BigintIsh | the sqrt of the current ratio of amounts of token1 to token0 |
liquidity | BigintIsh | the current value of in range liquidity |
tickCurrent | number | the current tick of the pool |
ticks | TickDataProvider | (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
#
ParametersName | Type | Description |
---|---|---|
outputAmount | CurrencyAmount<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
#
ParametersName | Type | Description |
---|---|---|
inputAmount | CurrencyAmount<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
#
ParametersName | Type | Description |
---|---|---|
token | Token | to 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.
#
ParametersName | Type | Description |
---|---|---|
token | Token | token to return price of |
Returns: Price<Token, Token>
Defined in: entities/pool.ts:127
#
getAddress▸ Static
getAddress(tokenA
: Token, tokenB
: Token, fee
: FeeAmount): string
#
ParametersName | Type |
---|---|
tokenA | Token |
tokenB | Token |
fee | FeeAmount |
Returns: string
Defined in: entities/pool.ts:44