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

Function

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