protocol_fee_reward_manager.gno
Types
ProtocolFeeRewardManager
ProtocolFeeRewardManager distributes protocol fees to stakers.
Protocol fees arrive in many tokens, so the manager keeps one accumulator per token instead of a single one. A stake change never touches those accumulators: it advances the accrual epoch, records the total stake in force from that epoch, and appends one event for an ordinary add/remove. Redelegate performs a remove plus an add and therefore appends two events. The per-token work happens when a token is collected, so stake-change cost does not depend on how many tokens ever collected a fee.
Methods
GetAccumulatedProtocolFeeX128PerStake
GetAccumulatedProtocolFeeX128PerStake returns the accumulated fee per stake of tokenPath (scaled by 2^128), or nil when the token never had a fee folded in.
Parameters
tokenPath
string
token package path whose accumulated per-stake fee is requested
Return Values
*u256.Uint
*u256.Uint
accumulated fee per stake scaled by 2^128, or nil when tokenPath has no accumulator
GetAccumulatedTimestamp
GetAccumulatedTimestamp returns the last timestamp at which fee accrual state moved through a fold or stake change.
Return Values
int64
int64
last accumulated-state update timestamp
GetCurrentEpoch
GetCurrentEpoch returns the accrual epoch currently in force.
Return Values
int64
int64
current protocol-fee accrual epoch
GetProtocolFeeAmount
GetProtocolFeeAmount returns the total fee amount folded in for tokenPath.
Parameters
tokenPath
string
token package path whose folded protocol-fee amount is requested
Return Values
int64
int64
total fee amount folded for tokenPath, or zero when no accumulator exists
GetRewardState
GetRewardState retrieves the reward state identified by rewardID. Missing IDs return nil and false; a stored value of the wrong type returns an error.
Parameters
rewardID
string
identifier of the staker reward state to retrieve
Return Values
*ProtocolFeeRewardState
*ProtocolFeeRewardState
stored reward state, or nil when rewardID is absent or invalid
bool
bool
true when a correctly typed reward state was found
error
error
nil when absent or found; a cast error when the stored value has the wrong type
GetTokenAccumulator
GetTokenAccumulator returns the accumulator of tokenPath, or false when the token never had a fee folded in.
Parameters
tokenPath
string
token package path whose protocol-fee accumulator is requested
Return Values
*ProtocolFeeTokenAccumulator
*ProtocolFeeTokenAccumulator
accumulator for tokenPath, or nil when none exists
bool
bool
true when tokenPath has a folded-fee accumulator
GetTokenPaths
GetTokenPaths returns every token path that had a fee folded in, in key order.
Return Values
[]string
[]string
token paths present in the accumulator tree, ordered by tree key
GetTotalStakedAmount
GetTotalStakedAmount returns the total amount currently staked.
Return Values
int64
int64
current total staked amount
GetTotalStakedAmountAt
GetTotalStakedAmountAt returns the total staked amount in force during epoch, using the latest recorded stake amount at or before that epoch.
Parameters
epoch
int64
accrual epoch whose effective total stake is requested
Return Values
int64
int64
total stake recorded at or before epoch, or zero for a negative epoch
SetAccumulatedTimestamp
SetAccumulatedTimestamp records the timestamp at which accrual state last moved.
Parameters
accumulatedTimestamp
int64
timestamp to record for the latest fold or stake change
SetCurrentEpoch
SetCurrentEpoch records the accrual epoch currently in force.
Parameters
epoch
int64
new current protocol-fee accrual epoch
SetRewardState
SetRewardState stores rewardState under rewardID.
Parameters
rewardID
string
identifier under which the staker reward state is stored
rewardState
*ProtocolFeeRewardState
reward state to associate with rewardID
SetTokenAccumulator
SetTokenAccumulator stores accumulator under tokenPath.
Parameters
tokenPath
string
token package path used as the accumulator key
accumulator
*ProtocolFeeTokenAccumulator
protocol-fee accumulator to store for tokenPath
SetTotalStakedAmount
SetTotalStakedAmount records the total amount currently staked.
Parameters
totalStakedAmount
int64
new total staked amount
SetTotalStakedAmountAt
SetTotalStakedAmountAt records the total staked amount in force from epoch on.
Parameters
epoch
int64
first accrual epoch at which totalStakedAmount is in force
totalStakedAmount
int64
total stake amount to record from epoch onward
Constructors
func NewProtocolFeeRewardManager() *ProtocolFeeRewardManager(source)
Last updated