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_reward_manager.gnogno
    1package staker23import (4	bptree "gno.land/p/nt/bptree/v0"5	ufmt "gno.land/p/nt/ufmt/v0"67	u256 "gno.land/p/gnoswap/uint256/v1"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
    10// ProtocolFeeRewardManager distributes protocol fees to stakers.
    11//
    12// Protocol fees arrive in many tokens, so the manager keeps one accumulator per token
    13// instead of a single one. A stake change never touches those accumulators: it advances
    14// the accrual epoch, records the total stake in force from that epoch, and appends one
    15// event for an ordinary add/remove. Redelegate performs a remove plus an add and
    16// therefore appends two events. The per-token work happens when a token is collected,
    17// so stake-change cost does not depend on how many tokens ever collected a fee.
    18type ProtocolFeeRewardManager struct {
    19 // rewardStates maps a reward ID to the ProtocolFeeRewardState tracking that staker
    20 rewardStates *bptree.BPTree // rewardID -> *ProtocolFeeRewardState
    21 // tokenAccumulators maps a token path to its ProtocolFeeTokenAccumulator
    22 tokenAccumulators *bptree.BPTree // tokenPath -> *ProtocolFeeTokenAccumulator
    23 // currentEpoch is the accrual epoch in force, mirrored from protocol_fee
    24 currentEpoch int64
    25 // totalStakedAmount is the total amount currently staked
    26 totalStakedAmount int64
    27 // totalStakedHistory records the total staked amount in force from each epoch
    28 totalStakedHistory *UintTree // epoch -> int64
    29 // accumulatedTimestamp is the last timestamp at which the accrual state moved: a fold or a stake change
    30 accumulatedTimestamp int64
    31}
    32
    33// NewProtocolFeeRewardManager creates a new instance of ProtocolFeeRewardManager.
    34//
    35// Returns:
    36// - *ProtocolFeeRewardManager: new protocol fee reward manager instance
    37func NewProtocolFeeRewardManager() *ProtocolFeeRewardManager {
    38 totalStakedHistory := NewUintTree()
    39 totalStakedHistory.Set(0, int64(0))
    40
    41 return &ProtocolFeeRewardManager{
    42 rewardStates: bptree.NewBPTreeN(16),
    43 tokenAccumulators: bptree.NewBPTreeN(16),
    44 currentEpoch: 0,
    45 totalStakedAmount: 0,
    46 totalStakedHistory: totalStakedHistory,
    47 accumulatedTimestamp: 0,
    48 }
    49}
    50
    51/* Getters */
    52
    53// GetRewardState retrieves the reward state identified by rewardID.
    54// Missing IDs return nil and false; a stored value of the wrong type returns
    55// an error.
    56//
    57// Parameters:
    58// - rewardID: identifier of the staker reward state to retrieve
    59//
    60// Returns:
    61// - *ProtocolFeeRewardState: stored reward state, or nil when rewardID is absent or invalid
    62// - bool: true when a correctly typed reward state was found
    63// - error: nil when absent or found; a cast error when the stored value has the wrong type
    64func (p *ProtocolFeeRewardManager) GetRewardState(rewardID string) (*ProtocolFeeRewardState, bool, error) {
    65 ri := p.rewardStates.Get(rewardID)
    66 if ri == nil {
    67 return nil, false, nil
    68 }
    69 rs, castOk := ri.(*ProtocolFeeRewardState)
    70 if !castOk {
    71 return nil, false, ufmt.Errorf(errFailedToCastRewardState, ri)
    72 }
    73 return rs, true, nil
    74}
    75
    76// GetTokenAccumulator returns the accumulator of tokenPath, or false when the token
    77// never had a fee folded in.
    78//
    79// Parameters:
    80// - tokenPath: token package path whose protocol-fee accumulator is requested
    81//
    82// Returns:
    83// - *ProtocolFeeTokenAccumulator: accumulator for tokenPath, or nil when none exists
    84// - bool: true when tokenPath has a folded-fee accumulator
    85func (p *ProtocolFeeRewardManager) GetTokenAccumulator(tokenPath string) (*ProtocolFeeTokenAccumulator, bool) {
    86 ai := p.tokenAccumulators.Get(tokenPath)
    87 if ai == nil {
    88 return nil, false
    89 }
    90 accumulator, castOk := ai.(*ProtocolFeeTokenAccumulator)
    91 if !castOk {
    92 panic(ufmt.Sprintf("failed to cast token accumulator: %T", ai))
    93 }
    94 return accumulator, true
    95}
    96
    97// GetTokenPaths returns every token path that had a fee folded in, in key order.
    98//
    99// Returns:
    100// - []string: token paths present in the accumulator tree, ordered by tree key
    101func (p *ProtocolFeeRewardManager) GetTokenPaths() []string {
    102 tokenPaths := make([]string, 0, p.tokenAccumulators.Size())
    103 p.tokenAccumulators.Iterate("", "", func(key string, _ any) bool {
    104 tokenPaths = append(tokenPaths, key)
    105 return false
    106 })
    107 return tokenPaths
    108}
    109
    110// GetAccumulatedProtocolFeeX128PerStake returns the accumulated fee per stake of tokenPath
    111// (scaled by 2^128), or nil when the token never had a fee folded in.
    112//
    113// Parameters:
    114// - tokenPath: token package path whose accumulated per-stake fee is requested
    115//
    116// Returns:
    117// - *u256.Uint: accumulated fee per stake scaled by 2^128, or nil when tokenPath has no accumulator
    118func (p *ProtocolFeeRewardManager) GetAccumulatedProtocolFeeX128PerStake(tokenPath string) *u256.Uint {
    119 accumulator, ok := p.GetTokenAccumulator(tokenPath)
    120 if !ok {
    121 return nil
    122 }
    123 return accumulator.GetAccumulatedX128PerStake()
    124}
    125
    126// GetProtocolFeeAmount returns the total fee amount folded in for tokenPath.
    127//
    128// Parameters:
    129// - tokenPath: token package path whose folded protocol-fee amount is requested
    130//
    131// Returns:
    132// - int64: total fee amount folded for tokenPath, or zero when no accumulator exists
    133func (p *ProtocolFeeRewardManager) GetProtocolFeeAmount(tokenPath string) int64 {
    134 accumulator, ok := p.GetTokenAccumulator(tokenPath)
    135 if !ok {
    136 return 0
    137 }
    138 return accumulator.GetProtocolFeeAmount()
    139}
    140
    141// GetCurrentEpoch returns the accrual epoch currently in force.
    142//
    143// Returns:
    144// - int64: current protocol-fee accrual epoch
    145func (p *ProtocolFeeRewardManager) GetCurrentEpoch() int64 {
    146 return p.currentEpoch
    147}
    148
    149// GetTotalStakedAmount returns the total amount currently staked.
    150//
    151// Returns:
    152// - int64: current total staked amount
    153func (p *ProtocolFeeRewardManager) GetTotalStakedAmount() int64 {
    154 return p.totalStakedAmount
    155}
    156
    157// GetTotalStakedAmountAt returns the total staked amount in force during epoch,
    158// using the latest recorded stake amount at or before that epoch.
    159//
    160// Parameters:
    161// - epoch: accrual epoch whose effective total stake is requested
    162//
    163// Returns:
    164// - int64: total stake recorded at or before epoch, or zero for a negative epoch
    165func (p *ProtocolFeeRewardManager) GetTotalStakedAmountAt(epoch int64) int64 {
    166 if epoch < 0 {
    167 return 0
    168 }
    169
    170 totalStakedAmount := int64(0)
    171 p.totalStakedHistory.ReverseIterate(0, epoch, func(_ int64, value any) bool {
    172 amount, castOk := value.(int64)
    173 if !castOk {
    174 panic(ufmt.Sprintf("failed to cast total staked amount: %T", value))
    175 }
    176 totalStakedAmount = amount
    177 return true
    178 })
    179
    180 return totalStakedAmount
    181}
    182
    183// GetAccumulatedTimestamp returns the last timestamp at which fee accrual
    184// state moved through a fold or stake change.
    185//
    186// Returns:
    187// - int64: last accumulated-state update timestamp
    188func (p *ProtocolFeeRewardManager) GetAccumulatedTimestamp() int64 {
    189 return p.accumulatedTimestamp
    190}
    191
    192/* Setters */
    193
    194// SetRewardState stores rewardState under rewardID.
    195//
    196// Parameters:
    197// - rewardID: identifier under which the staker reward state is stored
    198// - rewardState: reward state to associate with rewardID
    199func (p *ProtocolFeeRewardManager) SetRewardState(rewardID string, rewardState *ProtocolFeeRewardState) {
    200 p.rewardStates.Set(rewardID, rewardState)
    201}
    202
    203// SetTokenAccumulator stores accumulator under tokenPath.
    204//
    205// Parameters:
    206// - tokenPath: token package path used as the accumulator key
    207// - accumulator: protocol-fee accumulator to store for tokenPath
    208func (p *ProtocolFeeRewardManager) SetTokenAccumulator(tokenPath string, accumulator *ProtocolFeeTokenAccumulator) {
    209 p.tokenAccumulators.Set(tokenPath, accumulator)
    210}
    211
    212// SetCurrentEpoch records the accrual epoch currently in force.
    213//
    214// Parameters:
    215// - epoch: new current protocol-fee accrual epoch
    216func (p *ProtocolFeeRewardManager) SetCurrentEpoch(epoch int64) {
    217 p.currentEpoch = epoch
    218}
    219
    220// SetTotalStakedAmount records the total amount currently staked.
    221//
    222// Parameters:
    223// - totalStakedAmount: new total staked amount
    224func (p *ProtocolFeeRewardManager) SetTotalStakedAmount(totalStakedAmount int64) {
    225 p.totalStakedAmount = totalStakedAmount
    226}
    227
    228// SetTotalStakedAmountAt records the total staked amount in force from epoch on.
    229//
    230// Parameters:
    231// - epoch: first accrual epoch at which totalStakedAmount is in force
    232// - totalStakedAmount: total stake amount to record from epoch onward
    233func (p *ProtocolFeeRewardManager) SetTotalStakedAmountAt(epoch int64, totalStakedAmount int64) {
    234 p.totalStakedHistory.Set(epoch, totalStakedAmount)
    235}
    236
    237// SetAccumulatedTimestamp records the timestamp at which accrual state last moved.
    238//
    239// Parameters:
    240// - accumulatedTimestamp: timestamp to record for the latest fold or stake change
    241func (p *ProtocolFeeRewardManager) SetAccumulatedTimestamp(accumulatedTimestamp int64) {
    242 p.accumulatedTimestamp = accumulatedTimestamp
    243}
    244