package types import ( sdk "github.com/cosmos/cosmos-sdk/types" ) // historical rewards for a validator // TODO add reference counter, ref https://github.com/cosmos/cosmos-sdk/pull/3099#discussion_r245747051 // height is implicit within the store key type ValidatorHistoricalRewards = sdk.DecCoins // current rewards and current period for a validator // kept as a running counter and incremented each block // as long as the validator's tokens remain constant type ValidatorCurrentRewards struct { Rewards sdk.DecCoins `json:"rewards"` // current rewards Period uint64 `json:"period"` // current period } // create a new ValidatorCurrentRewards func NewValidatorCurrentRewards(rewards sdk.DecCoins, period uint64) ValidatorCurrentRewards { return ValidatorCurrentRewards{ Rewards: rewards, Period: period, } } // accumulated commission for a validator // kept as a running counter, can be withdrawn at any time type ValidatorAccumulatedCommission = sdk.DecCoins // return the initial accumulated commission (zero) func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission { return ValidatorAccumulatedCommission{} } // validator slash event // height is implicit within the store key // needed to calculate appropriate amounts of staking token // for delegations which withdraw after a slash has occurred type ValidatorSlashEvent struct { ValidatorPeriod uint64 `json:"validator_period"` // period when the slash occurred Fraction sdk.Dec `json:"fraction"` // slash fraction } // create a new ValidatorSlashEvent func NewValidatorSlashEvent(validatorPeriod uint64, fraction sdk.Dec) ValidatorSlashEvent { return ValidatorSlashEvent{ ValidatorPeriod: validatorPeriod, Fraction: fraction, } }