Position
@uniswap/v3-sdk / Exports / Position
Class: Position
Represents a position on a Uniswap V3 Pool
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new Position(__namedParameters)
Constructs a position for a given pool with the given liquidity
Parameters
| Name | Type |
|---|---|
__namedParameters | PositionConstructorArgs |
Defined in
Properties
_mintAmounts
• Private _mintAmounts: null | Readonly<{ amount0: default ; amount1: default }> = null
Defined in
_token0Amount
• Private _token0Amount: null | CurrencyAmount<Token> = null
Defined in
_token1Amount
• Private _token1Amount: null | CurrencyAmount<Token> = null
Defined in
liquidity
• Readonly liquidity: default
Defined in
pool
• Readonly pool: Pool
Defined in
tickLower
• Readonly tickLower: number
Defined in
tickUpper
• Readonly tickUpper: number
Defined in
Accessors
amount0
• get amount0(): CurrencyAmount<Token>
Returns the amount of token0 that this position's liquidity could be burned for at the current pool price
Returns
CurrencyAmount<Token>
Defined in
amount1
• get amount1(): CurrencyAmount<Token>
Returns the amount of token1 that this position's liquidity could be burned for at the current pool price
Returns
CurrencyAmount<Token>
Defined in
mintAmounts
• get mintAmounts(): Readonly<{ amount0: default ; amount1: default }>
Returns the minimum amounts that must be sent in order to mint the amount of liquidity held by the position at the current price for the pool
Returns
Readonly<{ amount0: default ; amount1: default }>
Defined in
token0PriceLower
• get token0PriceLower(): Price<Token, Token>
Returns the price of token0 at the lower tick
Returns
Price<Token, Token>
Defined in
token0PriceUpper
• get token0PriceUpper(): Price<Token, Token>
Returns the price of token0 at the upper tick
Returns
Price<Token, Token>
Defined in
Methods
burnAmountsWithSlippage
▸ burnAmountsWithSlippage(slippageTolerance): Readonly<{ amount0: default ; amount1: default }>
Returns the minimum amounts that should be requested in order to safely burn the amount of liquidity held by the position with the given slippage tolerance
Parameters
| Name | Type | Description |
|---|---|---|
slippageTolerance | Percent | tolerance of unfavorable slippage from the current price |
Returns
Readonly<{ amount0: default ; amount1: default }>
The amounts, with slippage
Defined in
mintAmountsWithSlippage
▸ mintAmountsWithSlippage(slippageTolerance): Readonly<{ amount0: default ; amount1: default }>
Returns the minimum amounts that must be sent in order to safely mint the amount of liquidity held by the position with the given slippage tolerance
Parameters
| Name | Type | Description |
|---|---|---|
slippageTolerance | Percent | Tolerance of unfavorable slippage from the current price |
Returns
Readonly<{ amount0: default ; amount1: default }>
The amounts, with slippage
Defined in
ratiosAfterSlippage
▸ Private ratiosAfterSlippage(slippageTolerance): Object
Returns the lower and upper sqrt ratios if the price 'slips' up to slippage tolerance percentage
Parameters
| Name | Type | Description |
|---|---|---|
slippageTolerance | Percent | The amount by which the price can 'slip' before the transaction will revert |
Returns
Object
The sqrt ratios after slippage
| Name | Type |
|---|---|
sqrtRatioX96Lower | default |
sqrtRatioX96Upper | default |
Defined in
fromAmount0
▸ Static fromAmount0(__namedParameters): Position
Computes a position with the maximum amount of liquidity received for a given amount of token0, assuming an unlimited amount of token1
Parameters
| Name | Type |
|---|---|
__namedParameters | Object |
__namedParameters.amount0 | BigintIsh |
__namedParameters.pool | Pool |
__namedParameters.tickLower | number |
__namedParameters.tickUpper | number |
__namedParameters.useFullPrecision | boolean |
Returns
The position
Defined in
fromAmount1
▸ Static fromAmount1(__namedParameters): Position
Computes a position with the maximum amount of liquidity received for a given amount of token1, assuming an unlimited amount of token0
Parameters
| Name | Type |
|---|---|
__namedParameters | Object |
__namedParameters.amount1 | BigintIsh |
__namedParameters.pool | Pool |
__namedParameters.tickLower | number |
__namedParameters.tickUpper | number |
Returns
The position
Defined in
fromAmounts
▸ Static fromAmounts(__namedParameters): Position
Computes the maximum amount of liquidity received for a given amount of token0, token1, and the prices at the tick boundaries.
Parameters
| Name | Type |
|---|---|
__namedParameters | Object |
__namedParameters.amount0 | BigintIsh |
__namedParameters.amount1 | BigintIsh |
__namedParameters.pool | Pool |
__namedParameters.tickLower | number |
__namedParameters.tickUpper | number |
__namedParameters.useFullPrecision | boolean |
Returns
The amount of liquidity for the position