protocol_fee_token_accumulator.gno
Types
ProtocolFeeTokenAccumulator
ProtocolFeeTokenAccumulator tracks the accumulated protocol fee per stake of one token.
Fees are folded in per accrual epoch, each against the total stake in force during that epoch. The value after folding each epoch is kept in history so that a staker's reward can be settled later against the accumulator as it stood at any epoch.
Methods
GetAccumulatedX128PerStake
GetAccumulatedX128PerStake returns the latest accumulated protocol fee per stake, scaled by 2^128.
Return Values
*u256.Uint
*u256.Uint
latest accumulated fee-per-stake value in Q128 fixed-point form.
GetAccumulatedX128PerStakeAt
GetAccumulatedX128PerStakeAt returns the accumulated value after the fees of the latest folded epoch at or before epoch, or zero when no fee was folded by then.
Parameters
epoch
int64
accrual epoch whose latest post-fold value is requested.
Return Values
*u256.Uint
*u256.Uint
accumulated fee per stake in Q128 fixed-point form, or zero when no fee was folded by epoch.
GetFirstEpoch
GetFirstEpoch returns the first epoch for which a fee was folded.
Return Values
int64
int64
first folded epoch, or -1 when no fee has been folded.
GetFoldedEpoch
GetFoldedEpoch returns the last epoch known to be fully folded.
Return Values
int64
int64
last fully folded epoch, or -1 when no epoch is fully folded.
GetProtocolFeeAmount
GetProtocolFeeAmount returns the total protocol fee amount folded into the accumulator.
Return Values
int64
int64
total fee amount folded for this token.
SetAccumulatedX128PerStakeAt
SetAccumulatedX128PerStakeAt stores value as the accumulated amount after epoch's fees and makes it the latest value.
Parameters
epoch
int64
epoch whose post-fold accumulator value is being stored.
value
*u256.Uint
accumulated fee-per-stake value in Q128 fixed-point form.
SetFoldedEpoch
SetFoldedEpoch records the last epoch whose protocol fees are fully folded.
Parameters
epoch
int64
latest fully folded accrual epoch.
SetProtocolFeeAmount
SetProtocolFeeAmount records the total protocol fee amount folded so far.
Parameters
amount
int64
total folded protocol fee amount for this token.
Constructors
func NewProtocolFeeTokenAccumulator() *ProtocolFeeTokenAccumulator(source)
Last updated