PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/gnoswap/gov/staker

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
staker
Namespace
gnoswap / gov
Files
24 (README)(gnomod.toml)
Exported functions
57
Module
gno.land/r/gnoswap/gov/staker
gno
0.9

Files (24)

  • README.mdmarkdown
  • gnomod.tomltoml
  • counter.gnogno
  • delegation_manager.gnogno
  • delegation_withdraw.gnogno
  • delegation.gnogno
  • doc.gnogno
  • emission_reward_manager.gnogno
  • emission_reward_state.gnogno
  • errors.gnogno
  • getter_utils.gnogno
  • getters.gnogno
  • launchpad_project_deposits.gnogno
  • protocol_fee_reward_manager.gnogno
  • protocol_fee_reward_state.gnogno
  • protocol_fee_token_accumulator.gnogno
  • proxy.gnogno
  • render.gnogno
  • state.gnogno
  • store.gnogno
  • tree.gnogno
  • types.gnogno
  • upgrade.gnogno
  • util.gnogno
  • tree.gnogno
    1package staker23import (4	"gno.land/p/gnoswap/gnsmath/v1"5	"gno.land/p/gnoswap/utils/v1"6	bptree "gno.land/p/nt/bptree/v0"7	ufmt "gno.land/p/nt/ufmt/v0"

    Functions

    • CleanStakerDelegationSnapshotByAdmin(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, threshold int64, target string)

    • CollectEmissionReward(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})

    • CollectEmissionRewardFromLaunchPad(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, to string)

    • CollectProtocolFeeReward(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, tokenPath string)

    • CollectProtocolFeeRewardFromLaunchPad(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, to string, tokenPath string)

    • CollectReward(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})

    • CollectRewardFromLaunchPad(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, to string)

    • CollectUndelegatedGns(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) int64

    • Delegate(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, to string, amount int64, referrer string) int64

    • ExistsDelegation(delegationID int64) bool

    • GetClaimableRewardByAddress(addr string) (int64, map[string]int64, interface {Error func() string})

    • GetClaimableRewardByLaunchpad(addr string) (int64, map[string]int64, interface {Error func() string})

    • GetClaimableRewardByRewardID(rewardID string) (int64, map[string]int64, interface {Error func() string})

    • GetCollectableWithdrawAmount(delegationID int64) int64

    • GetDelegations() *gno.land/p/nt/bptree/rotree/v0.ReadOnlyTree

    • GetDelegationWithdrawCount(delegationID int64) int

    • GetDelegationWithdraws(delegationID int64, offset int, count int) ([]gno.land/r/gnoswap/gov/staker.DelegationWithdraw, interface {Error func() string})

    • GetDelegatorDelegations(delegator string) *gno.land/p/nt/bptree/rotree/v0.ReadOnlyTree

    • GetEmissionAccumulatedTimestamp() int64

    • GetEmissionAccumulatedX128PerStake() *gno.land/p/gnoswap/uint256/v1.Uint

    • GetEmissionDistributedAmount() int64

    • GetImplementationPackagePath() string

    • GetLaunchpadProjectDeposit(projectAddr string) (int64, bool)

    • GetProtocolFeeAccumulatedTimestamp() int64

    • GetProtocolFeeAccumulatedX128PerStake(tokenPath string) *gno.land/p/gnoswap/uint256/v1.Uint

    • GetProtocolFeeAmount(tokenPath string) int64

    • GetTotalDelegated() int64

    • GetTotalDelegationAmountAtSnapshot(snapshotTime int64) (int64, bool)

    • GetTotalLockedAmount() int64

    • GetTotalxGnsSupply() int64

    • GetUnDelegationLockupPeriod() int64

    • GetUserDelegationAmountAtSnapshot(userAddr string, snapshotTime int64) (int64, bool)

    • GetUserDelegationIDs(delegator string, delegatee string) []int64

    • HasDelegationSnapshotsKey() bool

    • NewCounter() *gno.land/r/gnoswap/gov/staker.Counter

    • NewDelegation(id int64, delegateFrom string, delegateTo string, delegateAmount int64, createdHeight int64, createdAt int64) *gno.land/r/gnoswap/gov/staker.Delegation

    • NewDelegationManager() *gno.land/r/gnoswap/gov/staker.DelegationManager

    • NewDelegationTree() *gno.land/p/nt/bptree/v0.BPTree

    • NewDelegationWithdraw(delegationID int64, unDelegateAmount int64, createdHeight int64, createdAt int64, unDelegationLockupPeriod int64) struct{delegationID int64; unDelegateAmount int64; unDelegatedHeight int64; unDelegatedAt int64; collectedAmount int64; collectableTime int64; collectedAt int64; collected bool}

    • NewDelegationWithdrawWithoutLockup(delegationID int64, unDelegateAmount int64, createdHeight int64, createdAt int64) struct{delegationID int64; unDelegateAmount int64; unDelegatedHeight int64; unDelegatedAt int64; collectedAmount int64; collectableTime int64; collectedAt int64; collected bool}

    • NewEmissionRewardManager() *gno.land/r/gnoswap/gov/staker.EmissionRewardManager

    • NewEmissionRewardState(accumulatedRewardX128PerStake *gno.land/p/gnoswap/uint256/v1.Uint) *gno.land/r/gnoswap/gov/staker.EmissionRewardState

    • NewGovStakerStore(kvStore interface {AddAuthorizedCaller func(int, .uverse.realm, .uverse.address, gno.land/p/gnoswap/store/v1.Permission) .uverse.error; Delete func(int, .uverse.realm, string) .uverse.error; Get func(string) (interface {}, .uverse.error); GetAddress func(string) (.uverse.address, .uverse.error); GetAllKeys func() ([]string, .uverse.error); GetAuthorizedCallers func() (map[.uverse.address]gno.land/p/gnoswap/store/v1.Permission, .uverse.error); GetBPTree func(string) (*gno.land/p/nt/bptree/v0.BPTree, .uverse.error); GetBool func(string) (bool, .uverse.error); GetDomainAddress func() .uverse.address; GetInt64 func(string) (int64, .uverse.error); GetString func(string) (string, .uverse.error); GetUint64 func(string) (uint64, .uverse.error); Has func(string) bool; IsWriteAuthorized func(.uverse.address) bool; RemoveAuthorizedCaller func(int, .uverse.realm, .uverse.address) .uverse.error; Set func(int, .uverse.realm, string, interface {}) .uverse.error; UpdateAuthorizedCaller func(int, .uverse.realm, .uverse.address, gno.land/p/gnoswap/store/v1.Permission) .uverse.error}) interface {GetAllDelegations func() *gno.land/p/nt/bptree/v0.BPTree; GetDelegation func(int64) (*gno.land/r/gnoswap/gov/staker.Delegation, bool); GetDelegationCounter func() *gno.land/r/gnoswap/gov/staker.Counter; GetDelegationManager func() *gno.land/r/gnoswap/gov/staker.DelegationManager; GetEmissionRewardManager func() *gno.land/r/gnoswap/gov/staker.EmissionRewardManager; GetLaunchpadProjectDeposits func() *gno.land/r/gnoswap/gov/staker.LaunchpadProjectDeposits; GetProtocolFeeRewardManager func() *gno.land/r/gnoswap/gov/staker.ProtocolFeeRewardManager; GetTotalDelegatedAmount func() int64; GetTotalDelegationHistory func() *gno.land/r/gnoswap/gov/staker.UintTree; GetTotalLockedAmount func() int64; GetUnDelegationLockupPeriod func() int64; GetUserDelegationHistory func() *gno.land/p/nt/bptree/v0.BPTree; HasDelegation func(int64) bool; HasDelegationCounterStoreKey func() bool; HasDelegationManagerStoreKey func() bool; HasDelegationsStoreKey func() bool; HasEmissionRewardManagerStoreKey func() bool; HasLaunchpadProjectDepositsStoreKey func() bool; HasProtocolFeeRewardManagerStoreKey func() bool; HasTotalDelegatedAmountStoreKey func() bool; HasTotalDelegationHistoryStoreKey func() bool; HasTotalLockedAmountStoreKey func() bool; HasUnDelegationLockupPeriodStoreKey func() bool; HasUserDelegationHistoryStoreKey func() bool; RemoveDelegation func(int, .uverse.realm, int64) .uverse.error; SetDelegation func(int, .uverse.realm, int64, *gno.land/r/gnoswap/gov/staker.Delegation) .uverse.error; SetDelegationCounter func(int, .uverse.realm, *gno.land/r/gnoswap/gov/staker.Counter) .uverse.error; SetDelegationManager func(int, .uverse.realm, *gno.land/r/gnoswap/gov/staker.DelegationManager) .uverse.error; SetDelegations func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetEmissionRewardManager func(int, .uverse.realm, *gno.land/r/gnoswap/gov/staker.EmissionRewardManager) .uverse.error; SetLaunchpadProjectDeposits func(int, .uverse.realm, *gno.land/r/gnoswap/gov/staker.LaunchpadProjectDeposits) .uverse.error; SetProtocolFeeRewardManager func(int, .uverse.realm, *gno.land/r/gnoswap/gov/staker.ProtocolFeeRewardManager) .uverse.error; SetTotalDelegatedAmount func(int, .uverse.realm, int64) .uverse.error; SetTotalDelegationHistory func(int, .uverse.realm, *gno.land/r/gnoswap/gov/staker.UintTree) .uverse.error; SetTotalLockedAmount func(int, .uverse.realm, int64) .uverse.error; SetUnDelegationLockupPeriod func(int, .uverse.realm, int64) .uverse.error; SetUserDelegationHistory func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error}

    • NewLaunchpadProjectDeposits() *gno.land/r/gnoswap/gov/staker.LaunchpadProjectDeposits

    • NewProtocolFeeRewardManager() *gno.land/r/gnoswap/gov/staker.ProtocolFeeRewardManager

    • NewProtocolFeeRewardState() *gno.land/r/gnoswap/gov/staker.ProtocolFeeRewardState

    • NewProtocolFeeTokenAccumulator() *gno.land/r/gnoswap/gov/staker.ProtocolFeeTokenAccumulator

    • NewProtocolFeeTokenRewardState(eventCursor int64, segmentStakedAmount int64, segmentStartX128 *gno.land/p/gnoswap/uint256/v1.Uint) *gno.land/r/gnoswap/gov/staker.ProtocolFeeTokenRewardState

    • NewUintTree() *gno.land/r/gnoswap/gov/staker.UintTree

    • NewUserDelegationTree() *gno.land/p/nt/bptree/v0.BPTree

    • Redelegate(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, delegatee string, newDelegatee string, amount int64) int64

    • RegisterInitializer(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, initializer func(int, .uverse.realm, gno.land/r/gnoswap/gov/staker.IGovStakerStore) gno.land/r/gnoswap/gov/staker.IGovStaker)

    • Render(path string) string

    • SetAmountByProjectWallet(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, addr string, amount int64, add bool)

    • SetUnDelegationLockupPeriodByAdmin(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, period int64)

    • Undelegate(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, from string, amount int64) int64

    • UpgradeImpl(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, packagePath string)

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

    Rendered

    RenderedRawgnoweb ↗

    vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.

    8
    )
    9
    10// UintTree is a wrapper around a BPTree for storing non-negative int64 keys as
    11// ordered strings. Depending on the caller, keys represent Unix timestamps,
    12// accrual epochs, or stake-event indexes.
    13//
    14// Since keys are int64 values, they are converted to uint64-compatible strings.
    15//
    16// Methods:
    17// - Get: Retrieves a value associated with a non-negative int64 key.
    18// - set: Stores a value with a non-negative int64 key.
    19// - Has: Checks if a non-negative int64 key exists in the tree.
    20// - remove: Removes a non-negative int64 key and its associated value.
    21// - Iterate: Iterates over keys and values in a range.
    22// - ReverseIterate: Iterates in reverse order over keys and values in a range.
    23type UintTree struct {
    24 tree *bptree.BPTree // non-negative int64 key -> any
    25}
    26
    27// NewUintTree creates a new UintTree instance.
    28//
    29// Returns:
    30// - *UintTree: new tree backed by an empty ordered BPTree
    31func NewUintTree() *UintTree {
    32 return &UintTree{
    33 tree: bptree.NewBPTreeN(64),
    34 }
    35}
    36
    37// Get looks up a value by its non-negative int64 key.
    38//
    39// Parameters:
    40// - key: non-negative int64 key encoded for the ordered tree lookup; a negative key panics
    41//
    42// Returns:
    43// - any: value stored at key, or nil when no entry exists
    44// - bool: true when key has an entry; false when absent
    45func (self *UintTree) Get(key int64) (any, bool) {
    46 v := self.tree.Get(encodeInt64(key))
    47 if v == nil {
    48 return nil, false
    49 }
    50 return v, true
    51}
    52
    53// Set associates a value with a non-negative int64 key, replacing any existing
    54// value at that key.
    55//
    56// Parameters:
    57// - key: non-negative int64 key to encode and store; a negative key panics
    58// - value: value to associate with key
    59func (self *UintTree) Set(key int64, value any) {
    60 self.tree.Set(encodeInt64(key), value)
    61}
    62
    63// Has checks whether a non-negative int64 key is present in the tree.
    64//
    65// Parameters:
    66// - key: non-negative int64 key to encode and test; a negative key panics
    67//
    68// Returns:
    69// - bool: true when key is present; false when no entry is stored at key
    70func (self *UintTree) Has(key int64) bool {
    71 return self.tree.Has(encodeInt64(key))
    72}
    73
    74// Remove deletes the entry associated with a non-negative int64 key, if one
    75// exists.
    76//
    77// Parameters:
    78// - key: non-negative int64 key to encode and remove; a negative key panics
    79func (self *UintTree) Remove(key int64) {
    80 self.tree.Remove(encodeInt64(key))
    81}
    82
    83// Iterate visits entries in the half-open [start, end) key range in ascending
    84// order.
    85//
    86// Parameters:
    87// - start: non-negative lower-bound key for the iteration range; a negative bound panics
    88// - end: non-negative upper-bound key for the iteration range; a negative bound panics
    89// - fn: callback receiving each decoded key and value; return true to stop iteration, or false to continue
    90func (self *UintTree) Iterate(start, end int64, fn func(key int64, value any) bool) {
    91 self.tree.Iterate(encodeInt64(start), encodeInt64(end), func(key string, value any) bool {
    92 return fn(decodeInt64(key), value)
    93 })
    94}
    95
    96// ReverseIterate visits entries in descending order over the half-open
    97// [start, end) key range.
    98//
    99// Parameters:
    100// - start: non-negative lower-bound key for the iteration range; a negative bound panics
    101// - end: non-negative upper-bound key for the iteration range; a negative bound panics
    102// - fn: callback receiving each decoded key and value; return true to stop iteration, or false to continue
    103func (self *UintTree) ReverseIterate(start, end int64, fn func(key int64, value any) bool) {
    104 self.tree.ReverseIterate(encodeInt64(start), encodeInt64(end), func(key string, value any) bool {
    105 return fn(decodeInt64(key), value)
    106 })
    107}
    108
    109// Size returns the number of entries in the tree.
    110//
    111// Returns:
    112// - int: number of key-value entries currently stored in the tree
    113func (self *UintTree) Size() int {
    114 return self.tree.Size()
    115}
    116
    117func encodeInt64(num int64) string {
    118 if num < 0 {
    119 panic(ufmt.Sprintf("negative value not supported: %d", num))
    120 }
    121 return utils.EncodeUint64(uint64(num))
    122}
    123
    124func decodeInt64(s string) int64 {
    125 return gnsmath.SafeUint64ToInt64(utils.DecodeUint64(s))
    126}
    127