reward_state.gno
Types
RewardState
RewardState represents the state of a reward for a deposit. It contains the necessary data to manage and distribute rewards for a specific deposit.
Methods
AccumulatedRewardAmount
AccumulatedRewardAmount returns the legacy accumulated reward field.
Return Values
amount
int64
legacy reward amount in token base units; v1 accounting normally leaves it at zero unless explicitly set.
AccumulatedTime
AccumulatedTime returns the last timestamp recorded for reward accumulation.
Return Values
time
int64
last accumulated timestamp in Unix seconds, or zero before one is recorded.
ClaimableTime
ClaimableTime returns the earliest Unix timestamp at which this reward may be claimed.
Return Values
claimableTime
int64
claimability timestamp in Unix seconds.
ClaimedAmount
ClaimedAmount returns the reward amount already claimed for this deposit.
Return Values
amount
int64
claimed reward amount in token base units.
Clone
Clone returns an independent copy of this reward state, including a cloned Q128 price debt value.
Return Values
rewardState
*RewardState
deep copy of the reward state that can be modified without changing the source.
DepositAmount
DepositAmount returns the GNS principal represented by this reward state.
Return Values
amount
int64
staked GNS amount in base units used for reward allocation.
DistributeEndTime
DistributeEndTime returns the Unix timestamp when this deposit stops accruing rewards.
Return Values
endTime
int64
reward accrual end timestamp in Unix seconds.
DistributeStartTime
DistributeStartTime returns the Unix timestamp when this deposit starts accruing rewards.
Return Values
startTime
int64
reward accrual start timestamp in Unix seconds.
PriceDebtX128
PriceDebtX128 returns the deposit's initial reward index debt in Q128 fixed-point units.
Return Values
debt
*u256.Uint
stored price debt used to subtract rewards accrued before this deposit joined.
SetAccumulatedRewardAmount
SetAccumulatedRewardAmount sets the legacy accumulated reward field.
Parameters
amount
int64
legacy reward amount in token base units; v1 accounting does not update this field.
SetAccumulatedTime
SetAccumulatedTime sets the last timestamp recorded for reward accumulation.
Parameters
time
int64
last accumulated timestamp in Unix seconds.
SetClaimableTime
SetClaimableTime sets the earliest Unix timestamp at which this reward may be claimed.
Parameters
time
int64
claimability timestamp in Unix seconds.
SetClaimedAmount
SetClaimedAmount replaces the reward amount already claimed for this deposit.
Parameters
amount
int64
claimed reward amount in token base units.
SetDepositAmount
SetDepositAmount replaces the GNS principal represented by this reward state.
Parameters
amount
int64
staked GNS amount in base units used for reward allocation.
SetDistributeEndTime
SetDistributeEndTime sets the Unix timestamp when this deposit stops accruing rewards.
Parameters
time
int64
reward accrual end timestamp in Unix seconds.
SetDistributeStartTime
SetDistributeStartTime sets the Unix timestamp when this deposit starts accruing rewards.
Parameters
time
int64
reward accrual start timestamp in Unix seconds.
SetPriceDebtX128
SetPriceDebtX128 replaces the deposit's initial reward index debt.
Parameters
debt
*u256.Uint
new price debt in Q128 fixed-point units; the value is copied into the state.
Constructors
Last updated