Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claim ¶
type Claim struct { Owner sdk.AccAddress `json:"owner" yaml:"owner"` Reward sdk.Coin `json:"reward" yaml:"reward"` CollateralType string `json:"collateral_type" yaml:"collateral_type"` ClaimPeriodID uint64 `json:"claim_period_id" yaml:"claim_period_id"` }
Claim stores the rewards that can be claimed by owner
type ClaimPeriod ¶
type ClaimPeriod struct { CollateralType string `json:"collateral_type" yaml:"collateral_type"` ID uint64 `json:"id" yaml:"id"` End time.Time `json:"end" yaml:"end"` ClaimMultipliers Multipliers `json:"claim_multipliers" yaml:"claim_multipliers"` }
ClaimPeriod stores the state of an ongoing claim period
func NewClaimPeriod ¶
func NewClaimPeriod(collateralType string, id uint64, end time.Time, multipliers Multipliers) ClaimPeriod
NewClaimPeriod returns a new ClaimPeriod
func (ClaimPeriod) GetMultiplier ¶
func (cp ClaimPeriod) GetMultiplier(name MultiplierName) (Multiplier, bool)
GetMultiplier returns the named multiplier from the input claim period
func (ClaimPeriod) Validate ¶
func (cp ClaimPeriod) Validate() error
Validate performs a basic check of a ClaimPeriod fields.
type ClaimPeriods ¶
type ClaimPeriods []ClaimPeriod
ClaimPeriods array of ClaimPeriod
func (ClaimPeriods) Validate ¶
func (cps ClaimPeriods) Validate() error
Validate checks if all the ClaimPeriods are valid and there are no duplicated entries.
type GenesisClaimPeriodID ¶
type GenesisClaimPeriodID struct { CollateralType string `json:"collateral_type" yaml:"collateral_type"` ID uint64 `json:"id" yaml:"id"` }
GenesisClaimPeriodID stores the next claim id and its corresponding collateral type
func (GenesisClaimPeriodID) Validate ¶
func (gcp GenesisClaimPeriodID) Validate() error
Validate performs a basic check of a GenesisClaimPeriodID fields.
type GenesisClaimPeriodIDs ¶
type GenesisClaimPeriodIDs []GenesisClaimPeriodID
GenesisClaimPeriodIDs array of GenesisClaimPeriodID
func (GenesisClaimPeriodIDs) Validate ¶
func (gcps GenesisClaimPeriodIDs) Validate() error
Validate checks if all the GenesisClaimPeriodIDs are valid and there are no duplicated entries.
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` PreviousBlockTime time.Time `json:"previous_block_time" yaml:"previous_block_time"` RewardPeriods RewardPeriods `json:"reward_periods" yaml:"reward_periods"` ClaimPeriods ClaimPeriods `json:"claim_periods" yaml:"claim_periods"` Claims Claims `json:"claims" yaml:"claims"` NextClaimPeriodIDs GenesisClaimPeriodIDs `json:"next_claim_period_ids" yaml:"next_claim_period_ids"` }
GenesisState is the state that must be provided at genesis.
func NewGenesisState ¶
func NewGenesisState(params Params, previousBlockTime time.Time, rp RewardPeriods, cp ClaimPeriods, c Claims, ids GenesisClaimPeriodIDs) GenesisState
NewGenesisState returns a new genesis state
func (GenesisState) Validate ¶
func (gs GenesisState) Validate() error
Validate performs basic validation of genesis data returning an error for any failed validation criteria.
type Multiplier ¶
type Multiplier struct { Name MultiplierName `json:"name" yaml:"name"` MonthsLockup int64 `json:"months_lockup" yaml:"months_lockup"` Factor sdk.Dec `json:"factor" yaml:"factor"` }
Multiplier amount the claim rewards get increased by, along with how long the claim rewards are locked
func NewMultiplier ¶
func NewMultiplier(name MultiplierName, lockup int64, factor sdk.Dec) Multiplier
NewMultiplier returns a new Multiplier
type MultiplierName ¶
type MultiplierName string
MultiplierName name for valid multiplier
const ( Small MultiplierName = "small" Medium MultiplierName = "medium" Large MultiplierName = "large" )
Valid reward multipliers
func (MultiplierName) IsValid ¶
func (mn MultiplierName) IsValid() error
IsValid checks if the input is one of the expected strings
type Multipliers ¶
type Multipliers []Multiplier
Multipliers slice of Multiplier
func (Multipliers) Validate ¶
func (ms Multipliers) Validate() error
Validate validates each multiplier
type Params ¶
type Params struct { Active bool `json:"active" yaml:"active"` // top level governance switch to disable all rewards Rewards Rewards `json:"rewards" yaml:"rewards"` }
Params governance parameters for the incentive module
type Reward ¶
type Reward struct { Active bool `json:"active" yaml:"active"` // governance switch to disable a period CollateralType string `json:"collateral_type" yaml:"collateral_type"` // the collateral type rewards apply to, must be found in the cdp collaterals AvailableRewards sdk.Coin `json:"available_rewards" yaml:"available_rewards"` // the total amount of coins distributed per period Duration time.Duration `json:"duration" yaml:"duration"` // the duration of the period ClaimMultipliers Multipliers `json:"claim_multipliers" yaml:"claim_multipliers"` // the reward multiplier and timelock schedule - applied at the time users claim rewards ClaimDuration time.Duration `json:"claim_duration" yaml:"claim_duration"` // how long users have after the period ends to claim their rewards }
Reward stores the specified state for a single reward period.
type RewardPeriod ¶
type RewardPeriod struct { CollateralType string `json:"collateral_type" yaml:"collateral_type"` Start time.Time `json:"start" yaml:"start"` End time.Time `json:"end" yaml:"end"` Reward sdk.Coin `json:"reward" yaml:"reward"` // per second reward payouts ClaimEnd time.Time `json:"claim_end" yaml:"claim_end"` ClaimMultipliers Multipliers `json:"claim_multipliers" yaml:"claim_multipliers"` // the reward multiplier and timelock schedule - applied at the time users claim rewards }
RewardPeriod stores the state of an ongoing reward
func NewRewardPeriod ¶
func NewRewardPeriod(collateralType string, start time.Time, end time.Time, reward sdk.Coin, claimEnd time.Time, claimMultipliers Multipliers) RewardPeriod
NewRewardPeriod returns a new RewardPeriod
func NewRewardPeriodFromReward ¶
func NewRewardPeriodFromReward(reward Reward, blockTime time.Time) RewardPeriod
NewRewardPeriodFromReward returns a new reward period from the input reward and block time
func (RewardPeriod) Validate ¶
func (rp RewardPeriod) Validate() error
Validate performs a basic check of a RewardPeriod fields.
type RewardPeriods ¶
type RewardPeriods []RewardPeriod
RewardPeriods array of RewardPeriod
func (RewardPeriods) Validate ¶
func (rps RewardPeriods) Validate() error
Validate checks if all the RewardPeriods are valid and there are no duplicated entries.