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

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.

source

Methods

GetAccumulatedX128PerStake

GetAccumulatedX128PerStake returns the latest accumulated protocol fee per stake, scaled by 2^128.

Return Values

Name
Type
Description

*u256.Uint

*u256.Uint

latest accumulated fee-per-stake value in Q128 fixed-point form.

source

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

Name
Type
Description

epoch

int64

accrual epoch whose latest post-fold value is requested.

Return Values

Name
Type
Description

*u256.Uint

*u256.Uint

accumulated fee per stake in Q128 fixed-point form, or zero when no fee was folded by epoch.

source

GetFirstEpoch

GetFirstEpoch returns the first epoch for which a fee was folded.

Return Values

Name
Type
Description

int64

int64

first folded epoch, or -1 when no fee has been folded.

source

GetFoldedEpoch

GetFoldedEpoch returns the last epoch known to be fully folded.

Return Values

Name
Type
Description

int64

int64

last fully folded epoch, or -1 when no epoch is fully folded.

source

GetProtocolFeeAmount

GetProtocolFeeAmount returns the total protocol fee amount folded into the accumulator.

Return Values

Name
Type
Description

int64

int64

total fee amount folded for this token.

source

SetAccumulatedX128PerStakeAt

SetAccumulatedX128PerStakeAt stores value as the accumulated amount after epoch's fees and makes it the latest value.

Parameters

Name
Type
Description

epoch

int64

epoch whose post-fold accumulator value is being stored.

value

*u256.Uint

accumulated fee-per-stake value in Q128 fixed-point form.

source

SetFoldedEpoch

SetFoldedEpoch records the last epoch whose protocol fees are fully folded.

Parameters

Name
Type
Description

epoch

int64

latest fully folded accrual epoch.

source

SetProtocolFeeAmount

SetProtocolFeeAmount records the total protocol fee amount folded so far.

Parameters

Name
Type
Description

amount

int64

total folded protocol fee amount for this token.

source

Constructors

  • func NewProtocolFeeTokenAccumulator() *ProtocolFeeTokenAccumulator (source)

Last updated