v0_9

package
v0.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "incentive"
)

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"`
	Denom         string         `json:"denom" yaml:"denom"`
	ClaimPeriodID uint64         `json:"claim_period_id" yaml:"claim_period_id"`
}

Claim stores the rewards that can be claimed by owner

func NewClaim

func NewClaim(owner sdk.AccAddress, reward sdk.Coin, denom string, claimPeriodID uint64) Claim

NewClaim returns a new Claim

func (Claim) String

func (c Claim) String() string

String implements fmt.Stringer

func (Claim) Validate

func (c Claim) Validate() error

Validate performs a basic check of a Claim fields.

type ClaimPeriod

type ClaimPeriod struct {
	Denom    string        `json:"denom" yaml:"denom"`
	ID       uint64        `json:"id" yaml:"id"`
	End      time.Time     `json:"end" yaml:"end"`
	TimeLock time.Duration `json:"time_lock" yaml:"time_lock"`
}

ClaimPeriod stores the state of an ongoing claim period

func NewClaimPeriod

func NewClaimPeriod(denom string, id uint64, end time.Time, timeLock time.Duration) ClaimPeriod

NewClaimPeriod returns a new ClaimPeriod

func (ClaimPeriod) String

func (cp ClaimPeriod) String() string

String implements fmt.Stringer

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 Claims

type Claims []Claim

Claims array of Claim

func (Claims) Validate

func (cs Claims) Validate() error

Validate checks if all the claims are valid and there are no duplicated entries.

type GenesisClaimPeriodID

type GenesisClaimPeriodID struct {
	Denom string `json:"denom" yaml:"denom"`
	ID    uint64 `json:"id" yaml:"id"`
}

GenesisClaimPeriodID stores the next claim id and its corresponding denom

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 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

func NewParams

func NewParams(active bool, rewards Rewards) Params

NewParams returns a new params object

func (Params) String

func (p Params) String() string

String implements fmt.Stringer

func (Params) Validate

func (p Params) Validate() error

Validate checks that the parameters have valid values.

type Reward

type Reward struct {
	Active           bool          `json:"active" yaml:"active"`                       // governance switch to disable a period
	Denom            string        `json:"denom" yaml:"denom"`                         // the collateral denom 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
	TimeLock         time.Duration `json:"time_lock" yaml:"time_lock"`                 // how long rewards for this period are timelocked
	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.

func NewReward

func NewReward(active bool, denom string, reward sdk.Coin, duration time.Duration, timelock time.Duration, claimDuration time.Duration) Reward

NewReward returns a new Reward

func (Reward) String

func (r Reward) String() string

String implements fmt.Stringer

func (Reward) Validate

func (r Reward) Validate() error

Validate performs a basic check of a reward fields.

type RewardPeriod

type RewardPeriod struct {
	Denom         string        `json:"denom" yaml:"denom"`
	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"`
	ClaimTimeLock time.Duration `json:"claim_time_lock" yaml:"claim_time_lock"` // the amount of time rewards are timelocked once they are sent to users
}

RewardPeriod stores the state of an ongoing reward

func NewRewardPeriod

func NewRewardPeriod(denom string, start time.Time, end time.Time, reward sdk.Coin, claimEnd time.Time, claimTimeLock time.Duration) 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) String

func (rp RewardPeriod) String() string

String implements fmt.Stringer

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.

type Rewards

type Rewards []Reward

Rewards array of Reward

func (Rewards) String

func (rs Rewards) String() string

String implements fmt.Stringer

func (Rewards) Validate

func (rs Rewards) Validate() error

Validate checks if all the rewards are valid and there are no duplicated entries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL