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

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.

source

Methods

AccumulatedRewardAmount

AccumulatedRewardAmount returns the legacy accumulated reward field.

Return Values

Name
Type
Description

amount

int64

legacy reward amount in token base units; v1 accounting normally leaves it at zero unless explicitly set.

source

AccumulatedTime

AccumulatedTime returns the last timestamp recorded for reward accumulation.

Return Values

Name
Type
Description

time

int64

last accumulated timestamp in Unix seconds, or zero before one is recorded.

source

ClaimableTime

ClaimableTime returns the earliest Unix timestamp at which this reward may be claimed.

Return Values

Name
Type
Description

claimableTime

int64

claimability timestamp in Unix seconds.

source

ClaimedAmount

ClaimedAmount returns the reward amount already claimed for this deposit.

Return Values

Name
Type
Description

amount

int64

claimed reward amount in token base units.

source

Clone

Clone returns an independent copy of this reward state, including a cloned Q128 price debt value.

Return Values

Name
Type
Description

rewardState

*RewardState

deep copy of the reward state that can be modified without changing the source.

source

DepositAmount

DepositAmount returns the GNS principal represented by this reward state.

Return Values

Name
Type
Description

amount

int64

staked GNS amount in base units used for reward allocation.

source

DistributeEndTime

DistributeEndTime returns the Unix timestamp when this deposit stops accruing rewards.

Return Values

Name
Type
Description

endTime

int64

reward accrual end timestamp in Unix seconds.

source

DistributeStartTime

DistributeStartTime returns the Unix timestamp when this deposit starts accruing rewards.

Return Values

Name
Type
Description

startTime

int64

reward accrual start timestamp in Unix seconds.

source

PriceDebtX128

PriceDebtX128 returns the deposit's initial reward index debt in Q128 fixed-point units.

Return Values

Name
Type
Description

debt

*u256.Uint

stored price debt used to subtract rewards accrued before this deposit joined.

source

SetAccumulatedRewardAmount

SetAccumulatedRewardAmount sets the legacy accumulated reward field.

Parameters

Name
Type
Description

amount

int64

legacy reward amount in token base units; v1 accounting does not update this field.

source

SetAccumulatedTime

SetAccumulatedTime sets the last timestamp recorded for reward accumulation.

Parameters

Name
Type
Description

time

int64

last accumulated timestamp in Unix seconds.

source

SetClaimableTime

SetClaimableTime sets the earliest Unix timestamp at which this reward may be claimed.

Parameters

Name
Type
Description

time

int64

claimability timestamp in Unix seconds.

source

SetClaimedAmount

SetClaimedAmount replaces the reward amount already claimed for this deposit.

Parameters

Name
Type
Description

amount

int64

claimed reward amount in token base units.

source

SetDepositAmount

SetDepositAmount replaces the GNS principal represented by this reward state.

Parameters

Name
Type
Description

amount

int64

staked GNS amount in base units used for reward allocation.

source

SetDistributeEndTime

SetDistributeEndTime sets the Unix timestamp when this deposit stops accruing rewards.

Parameters

Name
Type
Description

time

int64

reward accrual end timestamp in Unix seconds.

source

SetDistributeStartTime

SetDistributeStartTime sets the Unix timestamp when this deposit starts accruing rewards.

Parameters

Name
Type
Description

time

int64

reward accrual start timestamp in Unix seconds.

source

SetPriceDebtX128

SetPriceDebtX128 replaces the deposit's initial reward index debt.

Parameters

Name
Type
Description

debt

*u256.Uint

new price debt in Q128 fixed-point units; the value is copied into the state.

source

Constructors

  • func GetRewardState(projectTierId string, depositId string) (*RewardState, error) (source)

  • func NewRewardState(accumulatedRewardPerDepositX128 *u256.Uint, depositAmount int64, distributeStartTime int64, distributeEndTime int64, claimableTime int64) *RewardState (source)

Last updated