position.gno
CollectFee
CollectFee collects accumulated fees from a position.
Halt check: reverts while the Withdraw halt scope is active.
Parameters
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
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
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
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
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
IncreaseLiquidity
IncreaseLiquidity adds liquidity to an existing position.
Halt check: reverts while the Position halt scope is active.
Parameters
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
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
Mint
Mint creates a new liquidity position NFT.
Halt check: reverts while the Position halt scope is active.
Parameters
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
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
NewPositionsTree
NewPositionsTree allocates an empty BP-tree for position entries under the position realm context.
Return Values
positionsTree
*bptree.BPTree
empty position BP-tree allocated with fanout 16
SetPositionOperator
SetPositionOperator sets an operator for a position.
Parameters
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
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.
Methods
Burned
Burned reports the position's empty-position marker.
Return Values
burned
bool
true when the position is marked empty after its balances clear; the position NFT itself is not burned
FeeGrowthInside0LastX128
FeeGrowthInside0LastX128 returns the token0 fee-growth checkpoint.
Return Values
feeGrowthInside0LastX128
string
decimal-encoded Q128 fee growth inside the position's range at its last update
FeeGrowthInside1LastX128
FeeGrowthInside1LastX128 returns the token1 fee-growth checkpoint.
Return Values
feeGrowthInside1LastX128
string
decimal-encoded Q128 fee growth inside the position's range at its last update
IsClear
IsClear reports whether liquidity and tokens owed are all zero; it does not describe the burned marker.
Return Values
clear
bool
true when stored liquidity and both token-owed counters are zero, regardless of the burned marker
Liquidity
Liquidity returns the position's stored liquidity amount.
Return Values
liquidity
string
decimal-encoded liquidity currently held by the position
Operator
Operator returns the address approved to operate on the position.
Return Values
operator
address
approved operator address, or the empty address when no operator is set
PoolKey
PoolKey returns the pool identifier associated with the position.
Return Values
poolKey
string
pool key encoding the position's token pair and fee tier
SetBurned
SetBurned stores the position's empty-position marker.
Parameters
burned
bool
marker indicating whether the position is considered empty
SetFeeGrowthInside0LastX128
SetFeeGrowthInside0LastX128 stores the token0 fee-growth checkpoint.
Parameters
feeGrowthInside0LastX128
string
decimal-encoded Q128 fee growth inside the position's range
SetFeeGrowthInside1LastX128
SetFeeGrowthInside1LastX128 stores the token1 fee-growth checkpoint.
Parameters
feeGrowthInside1LastX128
string
decimal-encoded Q128 fee growth inside the position's range
SetLiquidity
SetLiquidity stores the position's liquidity amount.
Parameters
liquidity
string
decimal string representing the position's liquidity
SetOperator
SetOperator stores the address approved to operate on the position.
Parameters
operator
address
approved operator address; the empty address removes the operator
SetPoolKey
SetPoolKey stores the pool identifier associated with the position.
Parameters
poolKey
string
pool key encoding the position's token pair and fee tier
SetTickLower
SetTickLower stores the lower tick boundary of the position's range.
Parameters
tickLower
int32
lower tick boundary used for the position's range
SetTickUpper
SetTickUpper stores the upper tick boundary of the position's range.
Parameters
tickUpper
int32
upper tick boundary used for the position's range
SetTokensOwed0
SetTokensOwed0 stores the amount of token0 owed to the position.
Parameters
tokensOwed0
int64
accrued token0 amount awaiting collection, in token units
SetTokensOwed1
SetTokensOwed1 stores the amount of token1 owed to the position.
Parameters
tokensOwed1
int64
accrued token1 amount awaiting collection, in token units
TickLower
TickLower returns the lower tick boundary of the position's range.
Return Values
tickLower
int32
lower tick boundary, inclusive in range checks
TickUpper
TickUpper returns the upper tick boundary of the position's range.
Return Values
tickUpper
int32
upper tick boundary, used as the exclusive end in range checks
TokensOwed0
TokensOwed0 returns the stored amount of token0 owed to the position.
Return Values
tokensOwed0
int64
accrued token0 amount awaiting collection, in token units
TokensOwed1
TokensOwed1 returns the stored amount of token1 owed to the position.
Return Values
tokensOwed1
int64
accrued token1 amount awaiting collection, in token units
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