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.gno
gno
  • 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
  • delegation.gnogno
    1package staker23import bptree "gno.land/p/nt/bptree/v0"45// DelegationType represents the type of delegation operation6type DelegationType string78

    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.

    const (
    9 DelegateType DelegationType = "DELEGATE"
    10 UnDelegateType DelegationType = "UNDELEGATE"
    11)
    12
    13// String returns the textual operation name represented by the delegation type.
    14//
    15// Returns:
    16// - string: "DELEGATE", "UNDELEGATE", or the underlying value for another type.
    17func (d DelegationType) String() string { return string(d) }
    18
    19// IsDelegate reports whether the operation type is DelegateType.
    20//
    21// Returns:
    22// - bool: true only when d represents a delegation operation.
    23func (d DelegationType) IsDelegate() bool { return d == DelegateType }
    24
    25// IsUnDelegate reports whether the operation type is UnDelegateType.
    26//
    27// Returns:
    28// - bool: true only when d represents an undelegation operation.
    29func (d DelegationType) IsUnDelegate() bool { return d == UnDelegateType }
    30
    31// Delegation represents a delegation between two addresses
    32type Delegation struct {
    33 id int64
    34 delegateAmount int64
    35 unDelegateAmount int64
    36 collectedAmount int64
    37 delegateFrom address
    38 delegateTo address
    39 createdHeight int64
    40 createdAt int64
    41 withdraws []DelegationWithdraw
    42}
    43
    44// NewDelegation creates a delegation record with no undelegated or collected amount.
    45//
    46// Parameters:
    47// - id: unique identifier assigned to this delegation record.
    48// - delegateFrom: address whose tokens are delegated.
    49// - delegateTo: address receiving the delegated voting power.
    50// - delegateAmount: initial delegated token amount in the smallest token unit.
    51// - createdHeight: block height at which the delegation was created.
    52// - createdAt: Unix timestamp at which the delegation was created.
    53//
    54// Returns:
    55// - *Delegation: initialized delegation with empty withdrawal history.
    56func NewDelegation(
    57 id int64,
    58 delegateFrom, delegateTo address,
    59 delegateAmount, createdHeight, createdAt int64,
    60) *Delegation {
    61 return &Delegation{
    62 id: id,
    63 delegateFrom: delegateFrom,
    64 delegateTo: delegateTo,
    65 delegateAmount: delegateAmount,
    66 createdHeight: createdHeight,
    67 createdAt: createdAt,
    68 unDelegateAmount: 0,
    69 collectedAmount: 0,
    70 withdraws: make([]DelegationWithdraw, 0),
    71 }
    72}
    73
    74// Basic getters
    75// ID returns the unique identifier of the delegation record.
    76//
    77// Returns:
    78// - int64: delegation identifier assigned at creation.
    79func (d *Delegation) ID() int64 { return d.id }
    80
    81// DelegateFrom returns the address that supplied the delegated tokens.
    82//
    83// Returns:
    84// - address: delegator address recorded on the delegation.
    85func (d *Delegation) DelegateFrom() address { return d.delegateFrom }
    86
    87// DelegateTo returns the address receiving the delegated voting power.
    88//
    89// Returns:
    90// - address: delegatee address recorded on the delegation.
    91func (d *Delegation) DelegateTo() address { return d.delegateTo }
    92
    93// CreatedAt returns the Unix timestamp recorded when the delegation was created.
    94//
    95// Returns:
    96// - int64: creation timestamp in Unix seconds.
    97func (d *Delegation) CreatedAt() int64 { return d.createdAt }
    98
    99// Amount getters
    100// TotalDelegatedAmount returns the current amount still actively delegated.
    101//
    102// Returns:
    103// - int64: active delegated token amount in the smallest token unit.
    104func (d *Delegation) TotalDelegatedAmount() int64 { return d.delegateAmount }
    105
    106// UnDelegatedAmount returns the amount moved into undelegation lockup.
    107//
    108// Returns:
    109// - int64: token amount awaiting collection after its lockup period.
    110func (d *Delegation) UnDelegatedAmount() int64 { return d.unDelegateAmount }
    111
    112// CollectedAmount returns the amount already collected from undelegation.
    113//
    114// Returns:
    115// - int64: token amount released from this delegation.
    116func (d *Delegation) CollectedAmount() int64 { return d.collectedAmount }
    117
    118// Withdraws getters
    119// Withdraws returns the delegation's withdrawal records.
    120//
    121// Returns:
    122// - []DelegationWithdraw: withdrawal entries tracked for this delegation.
    123func (d *Delegation) Withdraws() []DelegationWithdraw { return d.withdraws }
    124
    125// Setters
    126// SetUnDelegateAmount replaces the amount currently in undelegation lockup.
    127//
    128// Parameters:
    129// - amount: token amount awaiting collection in the smallest token unit.
    130func (d *Delegation) SetUnDelegateAmount(amount int64) {
    131 d.unDelegateAmount = amount
    132}
    133
    134// SetCollectedAmount replaces the amount already collected from this delegation.
    135//
    136// Parameters:
    137// - amount: released token amount in the smallest token unit.
    138func (d *Delegation) SetCollectedAmount(amount int64) {
    139 d.collectedAmount = amount
    140}
    141
    142// AddWithdraw appends a withdrawal record to the delegation history.
    143//
    144// Parameters:
    145// - withdraw: withdrawal record to append, including its amount and unlock timing.
    146func (d *Delegation) AddWithdraw(withdraw DelegationWithdraw) {
    147 d.withdraws = append(d.withdraws, withdraw)
    148}
    149
    150// SetWithdraw replaces one withdrawal record at the supplied slice index.
    151//
    152// Parameters:
    153// - index: zero-based index of the withdrawal entry to replace.
    154// - withdraw: replacement withdrawal record.
    155func (d *Delegation) SetWithdraw(index int, withdraw DelegationWithdraw) {
    156 d.withdraws[index] = withdraw
    157}
    158
    159// SetWithdraws replaces the complete withdrawal history.
    160//
    161// Parameters:
    162// - withdraws: withdrawal records to store for this delegation.
    163func (d *Delegation) SetWithdraws(withdraws []DelegationWithdraw) {
    164 d.withdraws = withdraws
    165}
    166
    167// Clone returns a deep copy of the delegation and its withdrawal slice.
    168//
    169// Returns:
    170// - *Delegation: copied delegation, or nil when the receiver is nil.
    171func (d *Delegation) Clone() *Delegation {
    172 if d == nil {
    173 return nil
    174 }
    175
    176 clonedWithdraws := make([]DelegationWithdraw, len(d.withdraws))
    177 copy(clonedWithdraws, d.withdraws)
    178
    179 return &Delegation{
    180 id: d.id,
    181 delegateAmount: d.delegateAmount,
    182 unDelegateAmount: d.unDelegateAmount,
    183 collectedAmount: d.collectedAmount,
    184 delegateFrom: d.delegateFrom,
    185 delegateTo: d.delegateTo,
    186 createdHeight: d.createdHeight,
    187 createdAt: d.createdAt,
    188 withdraws: clonedWithdraws,
    189 }
    190}
    191
    192// NewDelegationTree creates an empty tree for delegatee-to-delegation-ID mappings.
    193//
    194// Returns:
    195// - *bptree.BPTree: empty tree configured for delegation lookup entries.
    196func NewDelegationTree() *bptree.BPTree {
    197 return bptree.NewBPTreeN(16)
    198}
    199
    200// NewUserDelegationTree creates an empty tree for user delegation mappings.
    201// Returns:
    202// - *bptree.BPTree: empty tree configured for user delegation entries.
    203func NewUserDelegationTree() *bptree.BPTree {
    204 return bptree.NewBPTreeN(16)
    205}
    206