Skip to content

Latest commit

 

History

History
374 lines (213 loc) · 8.76 KB

Position.md

File metadata and controls

374 lines (213 loc) · 8.76 KB

@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

entities/position.ts:40

Properties

_mintAmounts

• Private _mintAmounts: null | Readonly<{ amount0: default ; amount1: default }> = null

Defined in

entities/position.ts:31


_token0Amount

• Private _token0Amount: null | CurrencyAmount<Token> = null

Defined in

entities/position.ts:29


_token1Amount

• Private _token1Amount: null | CurrencyAmount<Token> = null

Defined in

entities/position.ts:30


liquidity

• Readonly liquidity: default

Defined in

entities/position.ts:26


pool

• Readonly pool: Pool

Defined in

entities/position.ts:23


tickLower

• Readonly tickLower: number

Defined in

entities/position.ts:24


tickUpper

• Readonly tickUpper: number

Defined in

entities/position.ts:25

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

entities/position.ts:68


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

entities/position.ts:100


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

entities/position.ts:258


token0PriceLower

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

Returns the price of token0 at the lower tick

Returns

Price<Token, Token>

Defined in

entities/position.ts:54


token0PriceUpper

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

Returns the price of token0 at the upper tick

Returns

Price<Token, Token>

Defined in

entities/position.ts:61

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

entities/position.ts:213


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

entities/position.ts:157


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

entities/position.ts:134


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

Position

The position

Defined in

entities/position.ts:354


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

Position

The position

Defined in

entities/position.ts:378


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

Position

The amount of liquidity for the position

Defined in

entities/position.ts:312