Search Apps Documentation Source Content File Folder Download Copy Actions Download

v1 package

Overview

package v1 manages liquidity mining rewards for GnoSwap positions. The staker distributes GNS emissions and external incentives to liquidity providers based on their position size, price range, and staking duration. It supports both internal GNS rewards and external token incentives. Rewards are calculated per-tick and accumulate over time, with automatic compounding and fee collection integration.

Functions

DecodeInt64

func DecodeInt64(s string) int64

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.DecodeInt64()"

Result

DecodeUint

func DecodeUint(s string) uint64

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.DecodeUint()"

Result

EncodeInt64

func EncodeInt64(num int64) string

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.EncodeInt64()"

Result

EncodeUint

func EncodeUint(num uint64) string

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"

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.EncodeUint()"

Result

TierRatioFromCounts

func TierRatioFromCounts(tier1Count, tier2Count, tier3Count uint64) sr.TierRatio

TierRatioFromCounts calculates the ratio distribution for each tier based on pool counts. Parameters: - tier1Count (uint64): Number of pools in tier 1. - tier2Count (uint64): Number of pools in tier 2. - tier3Count (uint64): Number of pools in tier 3. Returns: - TierRatio: The ratio distribution across tier 1, 2, and 3, scaled up by 100.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.TierRatioFromCounts(,,)"

Result

NewDepositResolver

func NewDepositResolver( deposit *sr.Deposit, ) *DepositResolver

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewDepositResolver()"

Result

NewDeposits

func NewDeposits() *Deposits

NewDeposits creates a new Deposits instance.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewDeposits()"

Result

NewExternalIncentiveResolver

func NewExternalIncentiveResolver( externalIncentive *sr.ExternalIncentive, ) *ExternalIncentiveResolver

NewExternalIncentive creates a new external incentive

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewExternalIncentiveResolver()"

Result

NewExternalIncentives

func NewExternalIncentives() *ExternalIncentives

NewExternalIncentives creates a new ExternalIncentives instance.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewExternalIncentives()"

Result

NewIncentivesResolver

func NewIncentivesResolver(incentives *sr.Incentives) *IncentivesResolver

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewIncentivesResolver()"

Result

NewPoolResolver

func NewPoolResolver(pool *sr.Pool) *PoolResolver

NewPool creates a new pool with the given poolPath and currentHeight.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewPoolResolver()"

Result

NewPoolTier

func NewPoolTier(pools *Pools, currentHeight int64, currentTime int64, initialPoolPath string, getEmission func() int64, getHalvingBlocksInRange func(start, end int64) ([]int64, []int64)) *PoolTier

NewPoolTier creates a new PoolTier instance with single initial 1 tier pool. Parameters: - pools: The pool collection. - currentHeight: The current block height. - initialPoolPath: The path of the initial pool. - getEmission: A function that returns the current emission to the staker contract. - getHalvingBlocksInRange: A function that returns a list of halving blocks within the interval \[start, end) in ascending order. Returns: - \*PoolTier: The new PoolTier instance.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewPoolTier(,,,,,)"

Result

NewPoolTierBy

func NewPoolTierBy( membership *avl.Tree, tierRatio sr.TierRatio, counts [AllTierCount]uint64, lastRewardCacheTimestamp int64, lastRewardCacheHeight int64, currentEmission int64, getEmission func() int64, getHalvingBlocksInRange func(start, end int64) ([]int64, []int64), ) *PoolTier

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewPoolTierBy(,,,,,,,)"

Result

NewPools

func NewPools() *Pools

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewPools()"

Result

NewStakers

func NewStakers() *Stakers

NewStakers creates a new Stakers instance.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewStakers()"

Result

NewTickResolver

func NewTickResolver(tick *sr.Tick) *TickResolver

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewTickResolver()"

Result

NewUintTree

func NewUintTree() *UintTree

NewUintTree creates a new UintTree instance.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewUintTree()"

Result

NewStakerV1

func NewStakerV1(stakerStore sr.IStakerStore, poolAccessor sr.PoolAccessor, emissionAccessor sr.EmissionAccessor, nftAccessor sr.NFTAccessor) *stakerV1

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewStakerV1(,,,)"

Result

NewTickCrossEventInfo

func NewTickCrossEventInfo(tickID int32, stakedLiquidityGross *u256.Uint, stakedLiquidityDelta *i256.Int, outsideAccumulation *u256.Uint) *tickCrossEventInfo

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/staker/v1.NewTickCrossEventInfo(,,,)"

Result