Documentation ¶
Index ¶
- Constants
- Variables
- func GetTotalVestingPeriodLength(periods vesting.Periods) int64
- func NewPeriod(amount sdk.Coins, length int64) vesting.Period
- func ParamKeyTable() params.KeyTable
- type Claim
- type Claims
- type DelegatorDistributionSchedule
- type DelegatorDistributionSchedules
- type Deposit
- type DepositType
- type Deposits
- type DistributionSchedule
- type DistributionSchedules
- type GenesisDistributionTime
- type GenesisDistributionTimes
- type GenesisState
- type Multiplier
- type MultiplierName
- type Multipliers
- type Params
Constants ¶
const ( // ModuleName name that will be used throughout the module ModuleName = "harvest" // LPAccount LP distribution module account LPAccount = "harvest_lp_distribution" // DelegatorAccount delegator distribution module account DelegatorAccount = "harvest_delegator_distribution" // ModuleAccountName name of module account used to hold deposits ModuleAccountName = "harvest" )
const ( Small MultiplierName = "small" Medium MultiplierName = "medium" Large MultiplierName = "large" LP DepositType = "lp" Stake DepositType = "stake" )
Valid reward multipliers and reward types
Variables ¶
var ( KeyActive = []byte("Active") KeyLPSchedules = []byte("LPSchedules") KeyDelegatorSchedule = []byte("DelegatorSchedule") DefaultActive = true DefaultGovSchedules = DistributionSchedules{} DefaultLPSchedules = DistributionSchedules{} DefaultDelegatorSchedules = DelegatorDistributionSchedules{} DefaultPreviousBlockTime = tmtime.Canonical(time.Unix(0, 0)) DefaultDistributionTimes = GenesisDistributionTimes{} DefaultDeposits = Deposits{} DefaultClaims = Claims{} GovDenom = cdptypes.DefaultGovDenom )
Parameter keys and default values
var ( DepositTypesDepositQuery = []DepositType{LP} DepositTypesClaimQuery = []DepositType{LP, Stake} )
Queryable deposit types
Functions ¶
func GetTotalVestingPeriodLength ¶
GetTotalVestingPeriodLength returns the summed length of all vesting periods
func ParamKeyTable ¶
ParamKeyTable Key declaration for parameters
Types ¶
type Claim ¶
type Claim struct { Owner sdk.AccAddress `json:"owner" yaml:"owner"` DepositDenom string `json:"deposit_denom" yaml:"deposit_denom"` Amount sdk.Coin `json:"amount" yaml:"amount"` Type DepositType `json:"type" yaml:"type"` }
Claim defines an amount of coins that the owner can claim
func NewClaim ¶
func NewClaim(owner sdk.AccAddress, denom string, amount sdk.Coin, dtype DepositType) Claim
NewClaim returns a new claim
type DelegatorDistributionSchedule ¶
type DelegatorDistributionSchedule struct { DistributionSchedule DistributionSchedule `json:"distribution_schedule" yaml:"distribution_schedule"` DistributionFrequency time.Duration `json:"distribution_frequency" yaml:"distribution_frequency"` }
DelegatorDistributionSchedule distribution schedule for delegators
func NewDelegatorDistributionSchedule ¶
func NewDelegatorDistributionSchedule(ds DistributionSchedule, frequency time.Duration) DelegatorDistributionSchedule
NewDelegatorDistributionSchedule returns a new DelegatorDistributionSchedule
func (DelegatorDistributionSchedule) Validate ¶
func (dds DelegatorDistributionSchedule) Validate() error
Validate performs a basic check of a reward fields.
type DelegatorDistributionSchedules ¶
type DelegatorDistributionSchedules []DelegatorDistributionSchedule
DelegatorDistributionSchedules slice of DelegatorDistributionSchedule
func (DelegatorDistributionSchedules) Validate ¶
func (dds DelegatorDistributionSchedules) Validate() error
Validate checks if all the LiquidityProviderSchedules are valid and there are no duplicated entries.
type Deposit ¶
type Deposit struct { Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` Amount sdk.Coin `json:"amount" yaml:"amount"` Type DepositType `json:"type" yaml:"type"` }
Deposit defines an amount of coins deposited into a harvest module account
func NewDeposit ¶
func NewDeposit(depositor sdk.AccAddress, amount sdk.Coin, dtype DepositType) Deposit
NewDeposit returns a new deposit
type DepositType ¶
type DepositType string
DepositType type for valid deposit type strings
func (DepositType) IsValid ¶
func (dt DepositType) IsValid() error
IsValid checks if the input is one of the expected strings
type DistributionSchedule ¶
type DistributionSchedule struct { Active bool `json:"active" yaml:"active"` DepositDenom string `json:"deposit_denom" yaml:"deposit_denom"` Start time.Time `json:"start" yaml:"start"` End time.Time `json:"end" yaml:"end"` RewardsPerSecond sdk.Coin `json:"rewards_per_second" yaml:"rewards_per_second"` ClaimEnd time.Time `json:"claim_end" yaml:"claim_end"` ClaimMultipliers Multipliers `json:"claim_multipliers" yaml:"claim_multipliers"` }
DistributionSchedule distribution schedule for liquidity providers
func NewDistributionSchedule ¶
func NewDistributionSchedule(active bool, denom string, start, end time.Time, reward sdk.Coin, claimEnd time.Time, multipliers Multipliers) DistributionSchedule
NewDistributionSchedule returns a new DistributionSchedule
func (DistributionSchedule) GetMultiplier ¶
func (ds DistributionSchedule) GetMultiplier(name MultiplierName) (Multiplier, bool)
GetMultiplier returns the named multiplier from the input distribution schedule
func (DistributionSchedule) String ¶
func (ds DistributionSchedule) String() string
String implements fmt.Stringer
func (DistributionSchedule) Validate ¶
func (ds DistributionSchedule) Validate() error
Validate performs a basic check of a distribution schedule.
type DistributionSchedules ¶
type DistributionSchedules []DistributionSchedule
DistributionSchedules slice of DistributionSchedule
func (DistributionSchedules) String ¶
func (dss DistributionSchedules) String() string
String implements fmt.Stringer
func (DistributionSchedules) Validate ¶
func (dss DistributionSchedules) Validate() error
Validate checks if all the LiquidityProviderSchedules are valid and there are no duplicated entries.
type GenesisDistributionTime ¶
type GenesisDistributionTime struct { Denom string `json:"denom" yaml:"denom"` PreviousDistributionTime time.Time `json:"previous_distribution_time" yaml:"previous_distribution_time"` }
GenesisDistributionTime stores the previous distribution time and its corresponding denom
type GenesisDistributionTimes ¶
type GenesisDistributionTimes []GenesisDistributionTime
GenesisDistributionTimes slice of GenesisDistributionTime
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` PreviousBlockTime time.Time `json:"previous_block_time" yaml:"previous_block_time"` PreviousDistributionTimes GenesisDistributionTimes `json:"previous_distribution_times" yaml:"previous_distribution_times"` Deposits Deposits `json:"deposits" yaml:"deposits"` Claims Claims `json:"claims" yaml:"claims"` }
GenesisState is the state that must be provided at genesis.
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default genesis state
func NewGenesisState ¶
func NewGenesisState(params Params, previousBlockTime time.Time, previousDistTimes GenesisDistributionTimes, deposits Deposits, claims Claims) 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
func (MultiplierName) IsValid ¶
func (mn MultiplierName) IsValid() error
IsValid checks if the input is one of the expected strings
type Params ¶
type Params struct { Active bool `json:"active" yaml:"active"` LiquidityProviderSchedules DistributionSchedules `json:"liquidity_provider_schedules" yaml:"liquidity_provider_schedules"` DelegatorDistributionSchedules DelegatorDistributionSchedules `json:"delegator_distribution_schedules" yaml:"delegator_distribution_schedules"` }
Params governance parameters for harvest module
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns default params for harvest module
func NewParams ¶
func NewParams(active bool, lps DistributionSchedules, dds DelegatorDistributionSchedules) Params
NewParams returns a new params object
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs implements the ParamSet interface and returns all the key/value pairs