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
  • protocol_fee_token_accumulator.gnogno
    1package staker23import (4	ufmt "gno.land/p/nt/ufmt/v0"56	u256 "gno.land/p/gnoswap/uint256/v1"7)8

    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.

    9// ProtocolFeeTokenAccumulator tracks the accumulated protocol fee per stake of one token.
    10//
    11// Fees are folded in per accrual epoch, each against the total stake in force during
    12// that epoch. The value after folding each epoch is kept in history so that a staker's
    13// reward can be settled later against the accumulator as it stood at any epoch.
    14type ProtocolFeeTokenAccumulator struct {
    15 // accumulatedX128PerStake is the latest accumulated fee per stake, scaled by 2^128
    16 accumulatedX128PerStake *u256.Uint
    17 // history maps an epoch to the accumulated value after that epoch's fees were folded
    18 history *UintTree // epoch -> *u256.Uint
    19 // firstEpoch is the first epoch a fee was folded for, or -1 when none was
    20 firstEpoch int64
    21 // foldedEpoch is the last epoch whose fees are known to be fully folded, or -1
    22 foldedEpoch int64
    23 // protocolFeeAmount is the total fee amount folded in
    24 protocolFeeAmount int64
    25}
    26
    27// NewProtocolFeeTokenAccumulator creates an empty accumulator with no folded
    28// epochs or protocol fees recorded.
    29//
    30// Returns:
    31// - *ProtocolFeeTokenAccumulator: accumulator initialized with zero values and
    32// empty epoch history.
    33func NewProtocolFeeTokenAccumulator() *ProtocolFeeTokenAccumulator {
    34 return &ProtocolFeeTokenAccumulator{
    35 accumulatedX128PerStake: u256.Zero(),
    36 history: NewUintTree(),
    37 firstEpoch: -1,
    38 foldedEpoch: -1,
    39 protocolFeeAmount: 0,
    40 }
    41}
    42
    43/* Getters */
    44
    45// GetAccumulatedX128PerStake returns the latest accumulated protocol fee per stake,
    46// scaled by 2^128.
    47//
    48// Returns:
    49// - *u256.Uint: latest accumulated fee-per-stake value in Q128 fixed-point form.
    50func (a *ProtocolFeeTokenAccumulator) GetAccumulatedX128PerStake() *u256.Uint {
    51 return a.accumulatedX128PerStake
    52}
    53
    54// GetAccumulatedX128PerStakeAt returns the accumulated value after the fees of the
    55// latest folded epoch at or before epoch, or zero when no fee was folded by then.
    56//
    57// Parameters:
    58// - epoch: accrual epoch whose latest post-fold value is requested.
    59//
    60// Returns:
    61// - *u256.Uint: accumulated fee per stake in Q128 fixed-point form, or zero
    62// when no fee was folded by epoch.
    63func (a *ProtocolFeeTokenAccumulator) GetAccumulatedX128PerStakeAt(epoch int64) *u256.Uint {
    64 if epoch < 0 {
    65 return u256.Zero()
    66 }
    67
    68 accumulated := u256.Zero()
    69 a.history.ReverseIterate(0, epoch, func(_ int64, value any) bool {
    70 stored, castOk := value.(*u256.Uint)
    71 if !castOk {
    72 panic(ufmt.Sprintf("failed to cast accumulated value: %T", value))
    73 }
    74 accumulated = stored
    75 return true
    76 })
    77
    78 return accumulated
    79}
    80
    81// GetFirstEpoch returns the first epoch for which a fee was folded.
    82//
    83// Returns:
    84// - int64: first folded epoch, or -1 when no fee has been folded.
    85func (a *ProtocolFeeTokenAccumulator) GetFirstEpoch() int64 {
    86 return a.firstEpoch
    87}
    88
    89// GetFoldedEpoch returns the last epoch known to be fully folded.
    90//
    91// Returns:
    92// - int64: last fully folded epoch, or -1 when no epoch is fully folded.
    93func (a *ProtocolFeeTokenAccumulator) GetFoldedEpoch() int64 {
    94 return a.foldedEpoch
    95}
    96
    97// GetProtocolFeeAmount returns the total protocol fee amount folded into the
    98// accumulator.
    99//
    100// Returns:
    101// - int64: total fee amount folded for this token.
    102func (a *ProtocolFeeTokenAccumulator) GetProtocolFeeAmount() int64 {
    103 return a.protocolFeeAmount
    104}
    105
    106/* Setters */
    107
    108// SetAccumulatedX128PerStakeAt stores value as the accumulated amount after epoch's
    109// fees and makes it the latest value.
    110//
    111// Parameters:
    112// - epoch: epoch whose post-fold accumulator value is being stored.
    113// - value: accumulated fee-per-stake value in Q128 fixed-point form.
    114func (a *ProtocolFeeTokenAccumulator) SetAccumulatedX128PerStakeAt(epoch int64, value *u256.Uint) {
    115 stored := u256.Zero().Set(value)
    116 a.accumulatedX128PerStake = stored
    117 a.history.Set(epoch, stored)
    118 if a.firstEpoch < 0 || epoch < a.firstEpoch {
    119 a.firstEpoch = epoch
    120 }
    121}
    122
    123// SetFoldedEpoch records the last epoch whose protocol fees are fully folded.
    124//
    125// Parameters:
    126// - epoch: latest fully folded accrual epoch.
    127func (a *ProtocolFeeTokenAccumulator) SetFoldedEpoch(epoch int64) {
    128 a.foldedEpoch = epoch
    129}
    130
    131// SetProtocolFeeAmount records the total protocol fee amount folded so far.
    132//
    133// Parameters:
    134// - amount: total folded protocol fee amount for this token.
    135func (a *ProtocolFeeTokenAccumulator) SetProtocolFeeAmount(amount int64) {
    136 a.protocolFeeAmount = amount
    137}
    138