For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

source

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

Name
Type
Description

tokenPath

string

token package path whose accumulated per-stake fee is requested

Return Values

Name
Type
Description

*u256.Uint

*u256.Uint

accumulated fee per stake scaled by 2^128, or nil when tokenPath has no accumulator

source

GetAccumulatedTimestamp

GetAccumulatedTimestamp returns the last timestamp at which fee accrual state moved through a fold or stake change.

Return Values

Name
Type
Description

int64

int64

last accumulated-state update timestamp

source

GetCurrentEpoch

GetCurrentEpoch returns the accrual epoch currently in force.

Return Values

Name
Type
Description

int64

int64

current protocol-fee accrual epoch

source

GetProtocolFeeAmount

GetProtocolFeeAmount returns the total fee amount folded in for tokenPath.

Parameters

Name
Type
Description

tokenPath

string

token package path whose folded protocol-fee amount is requested

Return Values

Name
Type
Description

int64

int64

total fee amount folded for tokenPath, or zero when no accumulator exists

source

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

Name
Type
Description

rewardID

string

identifier of the staker reward state to retrieve

Return Values

Name
Type
Description

*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

source

GetTokenAccumulator

GetTokenAccumulator returns the accumulator of tokenPath, or false when the token never had a fee folded in.

Parameters

Name
Type
Description

tokenPath

string

token package path whose protocol-fee accumulator is requested

Return Values

Name
Type
Description

*ProtocolFeeTokenAccumulator

*ProtocolFeeTokenAccumulator

accumulator for tokenPath, or nil when none exists

bool

bool

true when tokenPath has a folded-fee accumulator

source

GetTokenPaths

GetTokenPaths returns every token path that had a fee folded in, in key order.

Return Values

Name
Type
Description

[]string

[]string

token paths present in the accumulator tree, ordered by tree key

source

GetTotalStakedAmount

GetTotalStakedAmount returns the total amount currently staked.

Return Values

Name
Type
Description

int64

int64

current total staked amount

source

GetTotalStakedAmountAt

GetTotalStakedAmountAt returns the total staked amount in force during epoch, using the latest recorded stake amount at or before that epoch.

Parameters

Name
Type
Description

epoch

int64

accrual epoch whose effective total stake is requested

Return Values

Name
Type
Description

int64

int64

total stake recorded at or before epoch, or zero for a negative epoch

source

SetAccumulatedTimestamp

SetAccumulatedTimestamp records the timestamp at which accrual state last moved.

Parameters

Name
Type
Description

accumulatedTimestamp

int64

timestamp to record for the latest fold or stake change

source

SetCurrentEpoch

SetCurrentEpoch records the accrual epoch currently in force.

Parameters

Name
Type
Description

epoch

int64

new current protocol-fee accrual epoch

source

SetRewardState

SetRewardState stores rewardState under rewardID.

Parameters

Name
Type
Description

rewardID

string

identifier under which the staker reward state is stored

rewardState

*ProtocolFeeRewardState

reward state to associate with rewardID

source

SetTokenAccumulator

SetTokenAccumulator stores accumulator under tokenPath.

Parameters

Name
Type
Description

tokenPath

string

token package path used as the accumulator key

accumulator

*ProtocolFeeTokenAccumulator

protocol-fee accumulator to store for tokenPath

source

SetTotalStakedAmount

SetTotalStakedAmount records the total amount currently staked.

Parameters

Name
Type
Description

totalStakedAmount

int64

new total staked amount

source

SetTotalStakedAmountAt

SetTotalStakedAmountAt records the total staked amount in force from epoch on.

Parameters

Name
Type
Description

epoch

int64

first accrual epoch at which totalStakedAmount is in force

totalStakedAmount

int64

total stake amount to record from epoch onward

source

Constructors

  • func NewProtocolFeeRewardManager() *ProtocolFeeRewardManager (source)

Last updated