CleanStakerDelegationSnapshotByAdmin removes old delegation snapshots. Only callable by admin.
Parameters:
- threshold: timestamp threshold for cleanup
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/gov/staker" -func "CleanStakerDelegationSnapshotByAdmin" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "CleanStakerDelegationSnapshotByAdmin" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
CollectReward
func CollectReward(cur realm)
CollectReward claims accumulated staking rewards.
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/gov/staker" -func "CollectReward" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "CollectReward" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
CollectRewardFromLaunchPad
func CollectRewardFromLaunchPad(cur realm, to address)
CollectRewardFromLaunchPad claims rewards from launchpad projects.
Parameters:
- to: address to collect rewards for
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/gov/staker" -func "CollectRewardFromLaunchPad" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "CollectRewardFromLaunchPad" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
CollectUndelegatedGns
func CollectUndelegatedGns(cur realm) int64
CollectUndelegatedGns collects GNS tokens after the undelegation lockup period.
Returns:
- int64: amount of GNS collected
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/gov/staker" -func "CollectUndelegatedGns" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "CollectUndelegatedGns" -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
DecodeUint converts a zero-padded string back into a uint64 number.
Parameters: - s (string): The zero-padded string.
Returns: - uint64: The decoded number.
Panics: - If the string cannot be parsed into a uint64.
Example: Input: "00000000000000012345" Output: 12345
func Delegate(cur realm, to address, amount int64, referrer string) int64
Delegate stakes GNS tokens to a delegatee address.
Parameters:
- to: address to delegate to
- amount: amount of GNS to delegate
- referrer: referrer address for reward tracking
Returns:
- int64: delegation ID
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/gov/staker" -func "Delegate" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "Delegate" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
EncodeUint converts a uint64 number into a zero-padded 20-character string.
Parameters: - num (uint64): The number to encode.
Returns: - string: A zero-padded string representation of the number.
Example: Input: 12345 Output: "00000000000000012345"
Redelegate moves delegation from one delegatee to another.
Parameters:
- delegatee: current delegatee address
- newDelegatee: new delegatee address
- amount: amount to redelegate
Returns:
- int64: redelegation result code
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/gov/staker" -func "Redelegate" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "Redelegate" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
SetAmountByProjectWallet sets reward amount for a project wallet. Only callable by launchpad contract.
Parameters:
- addr: project wallet address
- amount: reward amount
- add: true to add, false to subtract
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/gov/staker" -func "SetAmountByProjectWallet" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "SetAmountByProjectWallet" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
SetUnDelegationLockupPeriodByAdmin
func SetUnDelegationLockupPeriodByAdmin(cur realm, period int64)
SetUnDelegationLockupPeriodByAdmin sets the undelegation lockup period. Only callable by admin.
Parameters:
- period: lockup period in seconds
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/gov/staker" -func "SetUnDelegationLockupPeriodByAdmin" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "SetUnDelegationLockupPeriodByAdmin" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
Undelegate
func Undelegate(cur realm, from address, amount int64) int64
Undelegate initiates the undelegation process for staked GNS.
Parameters:
- from: delegatee address to undelegate from
- amount: amount of GNS to undelegate
Returns:
- int64: undelegation result code
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/gov/staker" -func "Undelegate" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "Undelegate" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
UpgradeImpl
func UpgradeImpl(cur realm, packagePath string)
UpgradeImpl upgrades the implementation to a new version Only admin or governance can call this function
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/gov/staker" -func "UpgradeImpl" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/staker" -func "UpgradeImpl" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
NewDelegationManager creates a new instance of DelegationManager. This factory function initializes the AVL tree structure for tracking user delegations.
NewDelegationWithdraw creates a new delegation withdrawal with lockup period. The withdrawal will be collectable after the lockup period expires.
Parameters:
- delegationID: unique identifier of the associated delegation
- unDelegateAmount: amount being withdrawn
- createdAt: timestamp when the withdrawal was created
- unDelegationLockupPeriod: duration of the lockup period in seconds
Returns:
- \*DelegationWithdraw: new withdrawal instance with lockup
NewDelegationWithdrawWithoutLockup creates a new delegation withdrawal that is immediately collectable. This is used for special cases like redelegation where no lockup period is required.
Parameters:
- delegationID: unique identifier of the associated delegation
- unDelegateAmount: amount being withdrawn
- createdAt: timestamp when the withdrawal was created
Returns:
- \*DelegationWithdraw: new withdrawal instance that is immediately collected
NewEmissionRewardManager creates a new instance of EmissionRewardManager. This factory function initializes all tracking structures for emission reward management. NewEmissionRewardManager creates new emission reward manager instance.
NewEmissionRewardState creates a new emission reward state for a staker. This factory function initializes the state with the current system reward debt.
Parameters:
- accumulatedRewardX128PerStake: current system-wide accumulated reward per stake
Returns:
- \*EmissionRewardState: new emission reward state instance
NewProtocolFeeRewardManager creates a new instance of ProtocolFeeRewardManager. This factory function initializes all tracking structures for multi-token protocol fee reward management.
Returns:
- \*ProtocolFeeRewardManager: new protocol fee reward manager instance
NewProtocolFeeRewardState creates a new protocol fee reward state for a staker. This factory function initializes the state with the current system reward debt for all tokens.