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

staker/v1 package

Overview

package staker 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.

Reward calculations combine elapsed-time rates with tick/range accumulation, and collection flows are integrated into the staking lifecycle.

Functions

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 "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/staker/v1.TierRatioFromCounts(,,)"

Result

NewDepositResolver

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

NewDepositResolver wraps a deposit with reward-cursor and warmup resolution helpers.

Parameters:

  • deposit: Deposit whose persisted reward state should be resolved.

Returns:

  • resolver: Resolver backed by deposit.

Param

Command

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

Result

NewDeposits

func NewDeposits() *Deposits

NewDeposits creates a new Deposits instance.

Returns:

  • deposits: Empty deposit collection backed by a position-ID tree.

Command

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

Result

NewExternalIncentiveResolver

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

NewExternalIncentiveResolver wraps an external incentive with resolver operations.

Parameters:

  • externalIncentive: External incentive whose timestamps and accounting state the resolver exposes.

Returns:

  • resolver: Resolver backed by externalIncentive.

Param

Command

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

Result

NewExternalIncentives

func NewExternalIncentives() *ExternalIncentives

NewExternalIncentives creates a new ExternalIncentives instance.

Returns:

  • incentives: Empty external-incentive collection backed by an incentive-ID tree.

Command

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

Result

NewIncentivesResolver

func NewIncentivesResolver(incentives *sr.Incentives) *IncentivesResolver

NewIncentivesResolver wraps the persisted external-incentive state for lookup and mutation.

Parameters:

  • incentives: External incentive state containing the incentive tree and unclaimable periods.

Returns:

  • resolver: Resolver backed by incentives.

Param

Command

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

Result

NewPoolResolver

func NewPoolResolver(pool *sr.Pool) *PoolResolver

NewPoolResolver wraps a pool's persisted reward, liquidity, tick, and incentive state for calculations.

Parameters:

  • pool: Pool state to resolve.

Returns:

  • resolver: Pool resolver backed by pool.

Param

Command

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

Result

NewPoolTier

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

NewPoolTier creates a new PoolTier instance with single initial 1 tier pool.

Parameters: - pools: The pool collection. - currentTime: The current block time. - 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 "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/staker/v1.NewPoolTier(,,,,)"

Result

NewPoolTierBy

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

NewPoolTierBy reconstructs a PoolTier from persisted membership, ratios, counts, and callbacks.

Parameters:

  • membership: Persisted pool-path-to-tier mapping.
  • tierRatio: Persisted reward-share ratio for each tier.
  • counts: Persisted number of pools in each tier index.
  • lastRewardCacheTimestamp: Timestamp through which reward caches have been materialized.
  • currentEmission: Emission rate currently used for reward accrual.
  • getEmission: Callback returning the current staker emission rate or an error.
  • getHalvingBlocksInRange: Callback returning halving timestamps and corresponding emissions in [start, end).

Returns:

  • *PoolTier: Reconstructed tier manager using the supplied persisted state and callbacks.

Params

Command

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

Result

NewPools

func NewPools() *Pools

NewPools creates an empty resolver for global pool storage.

Returns:

  • pools: Pools resolver backed by a new B+ tree keyed by pool path.

Command

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

Result

NewTickResolver

func NewTickResolver(tick *sr.Tick) *TickResolver

NewTickResolver wraps a staker tick to expose reward-accumulation updates.

Parameters:

  • tick: Staker tick whose state is resolved.

Returns:

  • *TickResolver: Resolver backed by tick.

Param

Command

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

Result

NewUnstakedPositions

func NewUnstakedPositions() *UnstakedPositions

NewUnstakedPositions creates a new UnstakedPositions instance.

Returns:

  • *UnstakedPositions: Empty exit-checkpoint manager backed by a new B+ tree.

Command

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

Result

NewStakerV1

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

NewStakerV1 constructs a version 1 staker implementation backed by the supplied accessors.

Parameters:

  • stakerStore: Persistent storage accessor for pools, deposits, incentives, tier state, and reward bookkeeping.
  • poolAccessor: Accessor for pool state used while updating and resolving staked positions.
  • emissionAccessor: Accessor for GNS emission data used to calculate rewards.
  • nftAccessor: Accessor for the position NFT ownership and token operations.

Returns:

  • staker: New stakerV1 implementation wired to the supplied store and accessors.

Params

Command

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

Result

NewTickCrossEventInfo

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

NewTickCrossEventInfo captures the values emitted when a swap crosses a tick.

Parameters:

  • tickID: Tick index crossed during the swap.
  • stakedLiquidityGross: Total staked liquidity at the crossed tick.
  • stakedLiquidityDelta: Net staked liquidity change applied at the crossed tick.
  • outsideAccumulation: Reward-ratio accumulation outside the crossed tick.

Returns:

  • info: Event payload containing the supplied tick-cross values.

Params

Command

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

Result