Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

position package

Functions

CollectFee

func CollectFee( cur realm, positionId uint64, ) (uint64, string, string, string, string, string)

CollectFee collects accumulated fees from a position.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • positionId: position NFT token ID whose fees are collected

Returns:

  • positionId: position NFT token ID whose fees were collected
  • tokensCollected0: token0 fees paid out to the caller, net of the withdrawal fee
  • tokensCollected1: token1 fees paid out to the caller, net of the withdrawal fee
  • poolKey: canonical pool key for the position
  • totalAmount0: token0 fees collected before the withdrawal fee
  • totalAmount1: token1 fees collected before the withdrawal fee

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

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "CollectFee" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "CollectFee" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

DecreaseLiquidity

func DecreaseLiquidity( cur realm, positionId uint64, liquidityStr string, amount0MinStr string, amount1MinStr string, deadline int64, ) (uint64, string, string, string, string, string, string)

DecreaseLiquidity removes liquidity from a position.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • positionId: position NFT token ID to decrease
  • liquidityStr: liquidity amount to remove, represented as a decimal string
  • amount0MinStr: minimum acceptable token0 amount for slippage protection
  • amount1MinStr: minimum acceptable token1 amount for slippage protection
  • deadline: transaction expiration timestamp

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.

Returns:

  • positionId: position NFT token ID that had liquidity removed
  • liquidity: removed liquidity amount, represented as a decimal string
  • fee0: token0 fees collected, net of the withdrawal fee
  • fee1: token1 fees collected, net of the withdrawal fee
  • amount0: principal amount of token0 returned to the caller
  • amount1: principal amount of token1 returned to the caller
  • poolKey: canonical pool key for the position

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

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "DecreaseLiquidity" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "DecreaseLiquidity" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

GetImplementationPackagePath

func GetImplementationPackagePath() string

GetImplementationPackagePath returns the package path of the currently active implementation.

Returns:

  • packagePath: package path of the active implementation

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetImplementationPackagePath()"

Result

GetPositionFeeGrowthInside0LastX128

func GetPositionFeeGrowthInside0LastX128(positionId uint64) (string, error)

GetPositionFeeGrowthInside0LastX128 returns the last fee-growth checkpoint inside the position's range for token0.

Parameters:

  • positionId: position NFT token ID whose token0 fee-growth checkpoint is queried

Returns:

  • feeGrowthInside0LastX128: token0 fee-growth checkpoint, represented as a decimal string
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionFeeGrowthInside0LastX128()"

Result

GetPositionFeeGrowthInside1LastX128

func GetPositionFeeGrowthInside1LastX128(positionId uint64) (string, error)

GetPositionFeeGrowthInside1LastX128 returns the last fee-growth checkpoint inside the position's range for token1.

Parameters:

  • positionId: position NFT token ID whose token1 fee-growth checkpoint is queried

Returns:

  • feeGrowthInside1LastX128: token1 fee-growth checkpoint, represented as a decimal string
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionFeeGrowthInside1LastX128()"

Result

GetPositionFeeGrowthInsideLastX128

func GetPositionFeeGrowthInsideLastX128(positionId uint64) (string, string, error)

GetPositionFeeGrowthInsideLastX128 returns the last fee-growth checkpoints inside the position's range for both tokens.

Parameters:

  • positionId: position NFT token ID whose fee-growth checkpoints are queried

Returns:

  • feeGrowthInside0LastX128: token0 fee-growth checkpoint, represented as a decimal string
  • feeGrowthInside1LastX128: token1 fee-growth checkpoint, represented as a decimal string
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionFeeGrowthInsideLastX128()"

Result

GetPositionLiquidity

func GetPositionLiquidity(positionId uint64) (string, error)

GetPositionLiquidity returns the stored liquidity amount of a position.

Parameters:

  • positionId: position NFT token ID whose liquidity is queried

Returns:

  • liquidity: position liquidity, represented as a decimal string
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionLiquidity()"

Result

GetPositionPoolKey

func GetPositionPoolKey(positionId uint64) (string, error)

GetPositionPoolKey returns the pool key associated with a position.

Parameters:

  • positionId: position NFT token ID whose pool association is queried

Returns:

  • poolKey: canonical pool key used by the position
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionPoolKey()"

Result

GetPositionTickLower

func GetPositionTickLower(positionId uint64) (int32, error)

GetPositionTickLower returns the lower tick boundary of a position.

Parameters:

  • positionId: position NFT token ID whose lower tick is queried

Returns:

  • tickLower: lower tick boundary of the position's price range
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionTickLower()"

Result

GetPositionTickUpper

func GetPositionTickUpper(positionId uint64) (int32, error)

GetPositionTickUpper returns the upper tick boundary of a position.

Parameters:

  • positionId: position NFT token ID whose upper tick is queried

Returns:

  • tickUpper: upper tick boundary of the position's price range
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionTickUpper()"

Result

GetPositionTicks

func GetPositionTicks(positionId uint64) (int32, int32, error)

GetPositionTicks returns the lower and upper tick boundaries of a position.

Parameters:

  • positionId: position NFT token ID whose tick range is queried

Returns:

  • tickLower: lower tick boundary of the position's price range
  • tickUpper: upper tick boundary of the position's price range
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionTicks()"

Result

GetPositionToken0Balance

func GetPositionToken0Balance(positionId uint64) (int64, error)

GetPositionToken0Balance returns the token0 balance associated with a position.

Parameters:

  • positionId: position NFT token ID

Returns:

  • balance: token0 balance
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionToken0Balance()"

Result

GetPositionToken1Balance

func GetPositionToken1Balance(positionId uint64) (int64, error)

GetPositionToken1Balance returns the token1 balance associated with a position.

Parameters:

  • positionId: position NFT token ID

Returns:

  • balance: token1 balance
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionToken1Balance()"

Result

GetPositionTokenBalances

func GetPositionTokenBalances(positionId uint64) (int64, int64, error)

GetPositionTokenBalances calculates the current token0/token1 balances for a position from its liquidity, tick range, and pool price.

These are derived balances, not permanently stored token amounts.

Parameters:

  • positionId: position NFT token ID

Returns:

  • balance0: current token0 balance
  • balance1: current token1 balance
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionTokenBalances()"

Result

GetPositionTokensOwed

func GetPositionTokensOwed(positionId uint64) (int64, int64, error)

GetPositionTokensOwed returns the token0 and token1 amounts accrued and owed to a position.

Parameters:

  • positionId: position NFT token ID whose accrued token debt is queried

Returns:

  • tokensOwed0: token0 amount currently owed to the position
  • tokensOwed1: token1 amount currently owed to the position
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionTokensOwed()"

Result

GetPositionTokensOwed0

func GetPositionTokensOwed0(positionId uint64) (int64, error)

GetPositionTokensOwed0 returns the token0 amount accrued and owed to a position.

Parameters:

  • positionId: position NFT token ID whose token0 debt is queried

Returns:

  • tokensOwed0: token0 amount currently owed to the position
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionTokensOwed0()"

Result

GetPositionTokensOwed1

func GetPositionTokensOwed1(positionId uint64) (int64, error)

GetPositionTokensOwed1 returns the token1 amount accrued and owed to a position.

Parameters:

  • positionId: position NFT token ID whose token1 debt is queried

Returns:

  • tokensOwed1: token1 amount currently owed to the position
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositionTokensOwed1()"

Result

GetPositions

func GetPositions() *rotree.ReadOnlyTree

GetPositions returns a read-only view of all positions.

Returns:

  • positions: read-only tree keyed by decimal position ID; callers paginate with IterateByOffset

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetPositions()"

Result

GetUnclaimedFee

func GetUnclaimedFee(positionId uint64) (string, string, error)

GetUnclaimedFee returns the unclaimed fees for both tokens of a position as decimal strings.

Parameters:

  • positionId: position NFT token ID whose unclaimed fees are queried

Returns:

  • fee0: unclaimed token0 fee amount, represented as a decimal string
  • fee1: unclaimed token1 fee amount, represented as a decimal string
  • err: non-nil when positionId or the associated pool fee-growth data cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.GetUnclaimedFee()"

Result

IncreaseLiquidity

func IncreaseLiquidity( cur realm, positionId uint64, amount0DesiredStr string, amount1DesiredStr string, amount0MinStr string, amount1MinStr string, deadline int64, ) (uint64, string, string, string, string)

IncreaseLiquidity adds liquidity to an existing position.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • positionId: position NFT token ID to increase
  • amount0DesiredStr: desired token0 amount, represented as a decimal string
  • amount1DesiredStr: desired token1 amount, represented as a decimal string
  • amount0MinStr: minimum acceptable token0 amount for slippage protection
  • amount1MinStr: minimum acceptable token1 amount for slippage protection
  • deadline: transaction expiration timestamp

Returns:

  • positionId: position NFT token ID that received the liquidity
  • liquidity: liquidity amount added to the position (the delta), represented as a decimal string
  • amount0: actual token0 amount added, represented as a decimal string
  • amount1: actual token1 amount added, represented as a decimal string
  • poolKey: canonical pool key for the position

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

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "IncreaseLiquidity" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "IncreaseLiquidity" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

IsBurned

func IsBurned(positionId uint64) (bool, error)

IsBurned reports whether the position's empty-position marker is set.

Parameters:

  • positionId: position NFT token ID

Returns:

  • burned: whether the position's empty-position marker is set
  • err: non-nil when positionId cannot be resolved

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.IsBurned()"

Result

IsInRange

func IsInRange(positionId uint64) (bool, error)

IsInRange reports whether a position's ticks contain the current pool tick.

Parameters:

  • positionId: position NFT token ID

Returns:

  • inRange: whether the position is currently in range
  • err: non-nil when positionId cannot be resolved or the associated pool tick cannot be read

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.IsInRange()"

Result

Mint

func Mint( cur realm, token0 string, token1 string, fee uint32, tickLower int32, tickUpper int32, amount0Desired string, amount1Desired string, amount0Min string, amount1Min string, deadline int64, mintTo address, referrer string, ) (uint64, string, string, string)

Mint creates a new liquidity position NFT.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • token0: path of the first token in the pool
  • token1: path of the second token in the pool
  • fee: pool fee tier used to identify the pool
  • tickLower: lower tick boundary of the position's price range
  • tickUpper: upper tick boundary of the position's price range
  • amount0Desired: desired amount of token0 to provide
  • amount1Desired: desired amount of token1 to provide
  • amount0Min: minimum acceptable amount of token0 after price/slippage calculation
  • amount1Min: minimum acceptable amount of token1 after price/slippage calculation
  • deadline: transaction expiration timestamp
  • mintTo: recipient address of the position NFT
  • referrer: referrer identifier used for reward tracking

Returns:

  • positionId: newly minted position NFT token ID
  • liquidity: liquidity minted into the position, represented as a decimal string
  • amount0: actual amount of token0 added to the position, represented as a decimal string
  • amount1: actual amount of token1 added to the position, represented as a decimal string

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

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "Mint" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "Mint" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

NewPositionsTree

func NewPositionsTree() *bptree.BPTree

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

Returns:

  • positionsTree: empty position BP-tree allocated with fanout 16

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.NewPositionsTree()"

Result

RegisterInitializer

func RegisterInitializer(cur realm, initializer func(_ int, rlm realm, positionStore IPositionStore) IPosition)

RegisterInitializer registers a new position implementation version. This function is called by each version (v1, v2, etc.) during initialization to register their implementation with the proxy system.

The initializer function creates a new instance of the implementation using the provided positionStore interface.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • initializer: callback that receives the implementation realm context and position store, then returns that version's IPosition implementation

Security: Only contracts within the domain path can register initializers. Each package path can only register once to prevent duplicate registrations.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "RegisterInitializer" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "RegisterInitializer" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

Render

func Render(path string) string

Render delegates web rendering to the active implementation.

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.Render()"

Result

Reposition

func Reposition( cur realm, positionId uint64, tickLower int32, tickUpper int32, amount0DesiredStr string, amount1DesiredStr string, amount0MinStr string, amount1MinStr string, deadline int64, ) (uint64, string, int32, int32, string, string)

Reposition changes the tick range of a position.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • positionId: position NFT token ID to reposition
  • tickLower: new lower tick boundary of the position's price range
  • tickUpper: new upper tick boundary of the position's price range
  • amount0DesiredStr: desired token0 amount for the new range, represented as a decimal string
  • amount1DesiredStr: desired token1 amount for the new range, represented as a decimal string
  • amount0MinStr: minimum acceptable token0 amount for slippage protection
  • amount1MinStr: minimum acceptable token1 amount for slippage protection
  • deadline: transaction expiration timestamp

Returns:

  • positionId: position NFT token ID that was repositioned
  • liquidity: new liquidity amount, represented as a decimal string
  • tickLower: new lower tick boundary
  • tickUpper: new upper tick boundary
  • amount0: actual token0 amount added to the new range, represented as a decimal string
  • amount1: actual token1 amount added to the new range, represented as a decimal string

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

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "Reposition" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "Reposition" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

SetPositionOperator

func SetPositionOperator( cur realm, positionId uint64, operator address, )

SetPositionOperator sets an operator for a position.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • positionId: position NFT token ID whose operator is changed
  • operator: operator address to approve; the zero address removes the operator

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "SetPositionOperator" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "SetPositionOperator" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

UpgradeImpl

func UpgradeImpl(cur realm, packagePath string)

UpgradeImpl switches the active position implementation to a different version. This function allows seamless upgrades from one version to another without data migration or downtime.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • packagePath: fully qualified package path of a previously registered replacement implementation

Security: Only admin or governance can perform upgrades. The new implementation must have been previously registered via RegisterInitializer.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "UpgradeImpl" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/position" -func "UpgradeImpl" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

NewPositionStore

func NewPositionStore(kvStore store.KVStore) IPositionStore

NewPositionStore creates a position store backed by the provided KV store. The upgrade system uses it to construct storage instances for each implementation.

Parameters:

  • kvStore: Domain-owned KV store shared by position implementations.

Returns:

  • IPositionStore: Position storage wrapper backed by the supplied store.

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.NewPositionStore()"

Result

NewPosition

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

NewPosition constructs a position from its persisted pool, range, liquidity, fee-growth, owed-token, marker, and operator values.

Parameters:

  • poolKey: pool key encoding the position's token pair and fee tier
  • tickLower: lower tick boundary of the position's range
  • tickUpper: upper tick boundary of the position's range
  • liquidity: decimal string representing the position's liquidity
  • feeGrowthInside0LastX128: decimal-encoded Q128 token0 fee-growth checkpoint
  • feeGrowthInside1LastX128: decimal-encoded Q128 token1 fee-growth checkpoint
  • tokensOwed0: accrued token0 amount awaiting collection, in token units
  • tokensOwed1: accrued token1 amount awaiting collection, in token units
  • burned: empty-position marker to store
  • operator: approved operator address; the empty address means no operator

Returns:

  • position: pointer to a position initialized with all supplied values

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/position.NewPosition(,,,,,,,,,)"

Result