emission_reward_manager.gno
Types
EmissionRewardManager
EmissionRewardManager manages the distribution of emission rewards to stakers.
Methods
GetAccumulatedRewardX128PerStake
GetAccumulatedRewardX128PerStake returns the accumulated reward per stake with 128-bit precision.
Return Values
*u256.Uint
*u256.Uint
accumulated emission reward per unit of stake in Q128 fixed-point form.
GetAccumulatedTimestamp
GetAccumulatedTimestamp returns the last timestamp when rewards were accumulated.
Return Values
int64
int64
Unix timestamp of the latest emission-reward accumulation.
GetDistributedAmount
GetDistributedAmount returns the total amount of rewards distributed.
Return Values
int64
int64
total emission reward amount marked as distributed.
GetRewardState
GetRewardState retrieves the reward state for addr.
Parameters
addr
string
Address key identifying the staker's emission reward state.
Return Values
*EmissionRewardState
*EmissionRewardState
stored state, or nil when addr has no state.
bool
bool
true when a reward state exists for addr; false when absent.
error
error
nil on success or absence; non-nil when the stored value has the wrong type.
GetTotalStakedAmount
GetTotalStakedAmount returns the total amount of tokens staked in the system.
Return Values
int64
int64
total staked token amount tracked by the manager.
SetAccumulatedRewardX128PerStake
SetAccumulatedRewardX128PerStake stores the accumulated emission reward per stake.
Parameters
accumulatedRewardX128PerStake
*u256.Uint
Q128 fixed-point reward-per-stake accumulator to copy into the manager.
SetAccumulatedTimestamp
SetAccumulatedTimestamp stores the latest emission-reward accumulation timestamp.
Parameters
accumulatedTimestamp
int64
Unix timestamp associated with the current accumulator.
SetDistributedAmount
SetDistributedAmount stores the total emission amount marked as distributed.
Parameters
distributedAmount
int64
Total emission reward amount distributed so far.
SetRewardState
SetRewardState sets the reward state for a specific address SetRewardState stores one staker's emission reward state under address.
Parameters
address
string
Address key for the staker's reward state.
rewardState
*EmissionRewardState
Emission reward state to store for address.
SetRewardStates
SetRewardStates replaces the tree containing per-address emission reward states.
Parameters
rewardStates
*bptree.BPTree
BPTree mapping staker addresses to emission reward states.
SetTotalStakedAmount
SetTotalStakedAmount stores the total amount currently staked.
Parameters
totalStakedAmount
int64
Aggregate token amount participating in emission rewards.
Constructors
func NewEmissionRewardManager() *EmissionRewardManager(source)
Last updated