For the complete documentation index, see llms.txt. This page is also available as Markdown.

position.gno

CollectFee

CollectFee collects accumulated fees from a position.

Halt check: reverts while the Withdraw halt scope is active.

Parameters

Name
Type
Description

cur

realm

current realm context; callers use cross(cur) when crossing into this realm

positionId

uint64

position NFT token ID whose fees are collected

Return Values

Name
Type
Description

positionId

uint64

position NFT token ID whose fees were collected

tokensCollected0

string

token0 fees paid out to the caller, net of the withdrawal fee

tokensCollected1

string

token1 fees paid out to the caller, net of the withdrawal fee

poolKey

string

canonical pool key for the position

totalAmount0

string

token0 fees collected before the withdrawal fee

totalAmount1

string

token1 fees collected before the withdrawal fee

source

DecreaseLiquidity

DecreaseLiquidity removes liquidity from a position.

The accrued swap fees are collected first, so the returned fee amounts are net of the withdrawal fee while the returned principal is not subject to it.

Halt check: reverts while the Withdraw halt scope is active.

Parameters

Name
Type
Description

cur

realm

current realm context; callers use cross(cur) when crossing into this realm

positionId

uint64

position NFT token ID to decrease

liquidityStr

string

liquidity amount to remove, represented as a decimal string

amount0MinStr

string

minimum acceptable token0 amount for slippage protection

amount1MinStr

string

minimum acceptable token1 amount for slippage protection

deadline

int64

transaction expiration timestamp

Return Values

Name
Type
Description

positionId

uint64

position NFT token ID that had liquidity removed

liquidity

string

removed liquidity amount, represented as a decimal string

fee0

string

token0 fees collected, net of the withdrawal fee

fee1

string

token1 fees collected, net of the withdrawal fee

amount0

string

principal amount of token0 returned to the caller

amount1

string

principal amount of token1 returned to the caller

poolKey

string

canonical pool key for the position

source

IncreaseLiquidity

IncreaseLiquidity adds liquidity to an existing position.

Halt check: reverts while the Position halt scope is active.

Parameters

Name
Type
Description

cur

realm

current realm context; callers use cross(cur) when crossing into this realm

positionId

uint64

position NFT token ID to increase

amount0DesiredStr

string

desired token0 amount, represented as a decimal string

amount1DesiredStr

string

desired token1 amount, represented as a decimal string

amount0MinStr

string

minimum acceptable token0 amount for slippage protection

amount1MinStr

string

minimum acceptable token1 amount for slippage protection

deadline

int64

transaction expiration timestamp

Return Values

Name
Type
Description

positionId

uint64

position NFT token ID that received the liquidity

liquidity

string

liquidity amount added to the position (the delta), represented as a decimal string

amount0

string

actual token0 amount added, represented as a decimal string

amount1

string

actual token1 amount added, represented as a decimal string

poolKey

string

canonical pool key for the position

source

Mint

Mint creates a new liquidity position NFT.

Halt check: reverts while the Position halt scope is active.

Parameters

Name
Type
Description

cur

realm

current realm context; callers use cross(cur) when crossing into this realm

token0

string

path of the first token in the pool

token1

string

path of the second token in the pool

fee

uint32

pool fee tier used to identify the pool

tickLower

int32

lower tick boundary of the position's price range

tickUpper

int32

upper tick boundary of the position's price range

amount0Desired

string

desired amount of token0 to provide

amount1Desired

string

desired amount of token1 to provide

amount0Min

string

minimum acceptable amount of token0 after price/slippage calculation

amount1Min

string

minimum acceptable amount of token1 after price/slippage calculation

deadline

int64

transaction expiration timestamp

mintTo

address

recipient address of the position NFT

referrer

string

referrer identifier used for reward tracking

Return Values

Name
Type
Description

positionId

uint64

newly minted position NFT token ID

liquidity

string

liquidity minted into the position, represented as a decimal string

amount0

string

actual amount of token0 added to the position, represented as a decimal string

amount1

string

actual amount of token1 added to the position, represented as a decimal string

source

NewPositionsTree

NewPositionsTree allocates an empty BP-tree for position entries under the position realm context.

Return Values

Name
Type
Description

positionsTree

*bptree.BPTree

empty position BP-tree allocated with fanout 16

source

SetPositionOperator

SetPositionOperator sets an operator for a position.

Parameters

Name
Type
Description

cur

realm

current realm context; callers use cross(cur) when crossing into this realm

positionId

uint64

position NFT token ID whose operator is changed

operator

address

operator address to approve; the zero address removes the operator

source

Types

Position

Position represents a liquidity position in a pool. Each position tracks liquidity, fee-growth checkpoints, tokens owed, and a burned marker for the position NFT. All uint256 fields are stored as decimal strings to reduce realm object overhead.

source

Methods

Burned

Burned reports the position's empty-position marker.

Return Values

Name
Type
Description

burned

bool

true when the position is marked empty after its balances clear; the position NFT itself is not burned

source

FeeGrowthInside0LastX128

FeeGrowthInside0LastX128 returns the token0 fee-growth checkpoint.

Return Values

Name
Type
Description

feeGrowthInside0LastX128

string

decimal-encoded Q128 fee growth inside the position's range at its last update

source

FeeGrowthInside1LastX128

FeeGrowthInside1LastX128 returns the token1 fee-growth checkpoint.

Return Values

Name
Type
Description

feeGrowthInside1LastX128

string

decimal-encoded Q128 fee growth inside the position's range at its last update

source

IsClear

IsClear reports whether liquidity and tokens owed are all zero; it does not describe the burned marker.

Return Values

Name
Type
Description

clear

bool

true when stored liquidity and both token-owed counters are zero, regardless of the burned marker

source

Liquidity

Liquidity returns the position's stored liquidity amount.

Return Values

Name
Type
Description

liquidity

string

decimal-encoded liquidity currently held by the position

source

Operator

Operator returns the address approved to operate on the position.

Return Values

Name
Type
Description

operator

address

approved operator address, or the empty address when no operator is set

source

PoolKey

PoolKey returns the pool identifier associated with the position.

Return Values

Name
Type
Description

poolKey

string

pool key encoding the position's token pair and fee tier

source

SetBurned

SetBurned stores the position's empty-position marker.

Parameters

Name
Type
Description

burned

bool

marker indicating whether the position is considered empty

source

SetFeeGrowthInside0LastX128

SetFeeGrowthInside0LastX128 stores the token0 fee-growth checkpoint.

Parameters

Name
Type
Description

feeGrowthInside0LastX128

string

decimal-encoded Q128 fee growth inside the position's range

source

SetFeeGrowthInside1LastX128

SetFeeGrowthInside1LastX128 stores the token1 fee-growth checkpoint.

Parameters

Name
Type
Description

feeGrowthInside1LastX128

string

decimal-encoded Q128 fee growth inside the position's range

source

SetLiquidity

SetLiquidity stores the position's liquidity amount.

Parameters

Name
Type
Description

liquidity

string

decimal string representing the position's liquidity

source

SetOperator

SetOperator stores the address approved to operate on the position.

Parameters

Name
Type
Description

operator

address

approved operator address; the empty address removes the operator

source

SetPoolKey

SetPoolKey stores the pool identifier associated with the position.

Parameters

Name
Type
Description

poolKey

string

pool key encoding the position's token pair and fee tier

source

SetTickLower

SetTickLower stores the lower tick boundary of the position's range.

Parameters

Name
Type
Description

tickLower

int32

lower tick boundary used for the position's range

source

SetTickUpper

SetTickUpper stores the upper tick boundary of the position's range.

Parameters

Name
Type
Description

tickUpper

int32

upper tick boundary used for the position's range

source

SetTokensOwed0

SetTokensOwed0 stores the amount of token0 owed to the position.

Parameters

Name
Type
Description

tokensOwed0

int64

accrued token0 amount awaiting collection, in token units

source

SetTokensOwed1

SetTokensOwed1 stores the amount of token1 owed to the position.

Parameters

Name
Type
Description

tokensOwed1

int64

accrued token1 amount awaiting collection, in token units

source

TickLower

TickLower returns the lower tick boundary of the position's range.

Return Values

Name
Type
Description

tickLower

int32

lower tick boundary, inclusive in range checks

source

TickUpper

TickUpper returns the upper tick boundary of the position's range.

Return Values

Name
Type
Description

tickUpper

int32

upper tick boundary, used as the exclusive end in range checks

source

TokensOwed0

TokensOwed0 returns the stored amount of token0 owed to the position.

Return Values

Name
Type
Description

tokensOwed0

int64

accrued token0 amount awaiting collection, in token units

source

TokensOwed1

TokensOwed1 returns the stored amount of token1 owed to the position.

Return Values

Name
Type
Description

tokensOwed1

int64

accrued token1 amount awaiting collection, in token units

source

Constructors

  • func NewPosition(poolKey string, tickLower int32, tickUpper int32, liquidity string, feeGrowthInside0LastX128 string, feeGrowthInside1LastX128 string, tokensOwed0 int64, tokensOwed1 int64, burned bool, operator address) *Position (source)

Last updated