Documentation ¶
Index ¶
- Constants
- Variables
- func GetTotalVestingPeriodLength(periods vesting.Periods) int64
- func NewPeriod(amount sdk.Coins, length int64) vesting.Period
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- type AccountKeeper
- type BaseClaim
- type BaseMultiClaim
- type CDPHooks
- type CdpKeeper
- type Claim
- type Claims
- type GenesisAccumulationTime
- type GenesisAccumulationTimes
- type GenesisState
- type HARDHooks
- type HardKeeper
- type HardLiquidityProviderClaim
- func (c HardLiquidityProviderClaim) GetOwner() sdk.AccAddress
- func (c HardLiquidityProviderClaim) GetReward() sdk.Coins
- func (c HardLiquidityProviderClaim) GetType() string
- func (c HardLiquidityProviderClaim) HasBorrowRewardIndex(denom string) (int64, bool)
- func (c HardLiquidityProviderClaim) HasDelegatorRewardIndex(collateralType string) (int64, bool)
- func (c HardLiquidityProviderClaim) HasSupplyRewardIndex(denom string) (int64, bool)
- func (c HardLiquidityProviderClaim) String() string
- func (c HardLiquidityProviderClaim) Validate() error
- type HardLiquidityProviderClaims
- type MsgClaimHardReward
- type MsgClaimUSDXMintingReward
- type MultiRewardIndex
- type MultiRewardIndexes
- type MultiRewardPeriod
- type MultiRewardPeriods
- type Multiplier
- type MultiplierName
- type Multipliers
- type Params
- type PostClaimReq
- type QueryHardRewardsParams
- type QueryRewardsParams
- type QueryUSDXMintingRewardsParams
- type RewardIndex
- type RewardIndexes
- type RewardPeriod
- type RewardPeriods
- type StakingKeeper
- type SupplyKeeper
- type USDXMintingClaim
- func (c USDXMintingClaim) GetOwner() sdk.AccAddress
- func (c USDXMintingClaim) GetReward() sdk.Coin
- func (c USDXMintingClaim) GetType() string
- func (c USDXMintingClaim) HasRewardIndex(collateralType string) (int64, bool)
- func (c USDXMintingClaim) String() string
- func (c USDXMintingClaim) Validate() error
- type USDXMintingClaims
Constants ¶
const ( USDXMintingClaimType = "usdx_minting" HardLiquidityProviderClaimType = "hard_liquidity_provider" BondDenom = "ukava" )
const ( EventTypeClaim = "claim_reward" EventTypeRewardPeriod = "new_reward_period" EventTypeClaimPeriod = "new_claim_period" EventTypeClaimPeriodExpiry = "claim_period_expiry" AttributeValueCategory = ModuleName AttributeKeyClaimedBy = "claimed_by" AttributeKeyClaimAmount = "claim_amount" AttributeKeyClaimType = "claim_type" AttributeKeyRewardPeriod = "reward_period" AttributeKeyClaimPeriod = "claim_period" )
Events emitted by the incentive module
const ( // ModuleName The name that will be used throughout the module ModuleName = "incentive" // StoreKey Top level store key where all module items will be stored StoreKey = ModuleName // RouterKey Top level router key RouterKey = ModuleName // DefaultParamspace default name for parameter store DefaultParamspace = ModuleName // QuerierRoute route used for abci queries QuerierRoute = ModuleName )
const ( QueryGetRewards = "rewards" QueryGetHardRewards = "hard-rewards" QueryGetUSDXMintingRewards = "usdx-minting-rewards" QueryGetParams = "parameters" QueryGetRewardPeriods = "reward-periods" QueryGetClaimPeriods = "claim-periods" RestClaimCollateralType = "collateral_type" RestClaimOwner = "owner" RestClaimType = "type" )
Querier routes for the incentive module
Variables ¶
var ( ErrClaimNotFound = sdkerrors.Register(ModuleName, 2, "no claimable rewards found for user") ErrRewardPeriodNotFound = sdkerrors.Register(ModuleName, 3, "no reward period found for collateral type") ErrInvalidAccountType = sdkerrors.Register(ModuleName, 4, "account type not supported") ErrNoClaimsFound = sdkerrors.Register(ModuleName, 5, "no claimable rewards found") ErrInsufficientModAccountBalance = sdkerrors.Register(ModuleName, 6, "module account has insufficient balance to pay claim") ErrAccountNotFound = sdkerrors.Register(ModuleName, 7, "account not found") ErrInvalidMultiplier = sdkerrors.Register(ModuleName, 8, "invalid rewards multiplier") ErrZeroClaim = sdkerrors.Register(ModuleName, 9, "cannot claim - claim amount rounds to zero") ErrClaimExpired = sdkerrors.Register(ModuleName, 10, "claim has expired") ErrInvalidClaimType = sdkerrors.Register(ModuleName, 11, "invalid claim type") ErrInvalidClaimOwner = sdkerrors.Register(ModuleName, 12, "invalid claim owner") )
Incentive module errors
var ( USDXMintingClaimKeyPrefix = []byte{0x01} // prefix for keys that store USDX minting claims USDXMintingRewardFactorKeyPrefix = []byte{0x02} // prefix for key that stores USDX minting reward factors PreviousUSDXMintingRewardAccrualTimeKeyPrefix = []byte{0x03} // prefix for key that stores the blocktime HardLiquidityClaimKeyPrefix = []byte{0x04} // prefix for keys that store Hard liquidity claims HardSupplyRewardIndexesKeyPrefix = []byte{0x05} // prefix for key that stores Hard supply reward factors PreviousHardSupplyRewardAccrualTimeKeyPrefix = []byte{0x06} // prefix for key that stores the previous time Hard supply rewards accrued HardBorrowRewardIndexesKeyPrefix = []byte{0x07} // prefix for key that stores Hard borrow reward factors PreviousHardBorrowRewardAccrualTimeKeyPrefix = []byte{0x08} // prefix for key that stores the previous time Hard borrow rewards accrued HardDelegatorRewardFactorKeyPrefix = []byte{0x09} // prefix for key that stores Hard delegator reward factors PreviousHardDelegatorRewardAccrualTimeKeyPrefix = []byte{0x10} // prefix for key that stores the previous time Hard delegator rewards accrued USDXMintingRewardDenom = "ukava" HardLiquidityRewardDenom = "hard" )
Key Prefixes
var ( KeyUSDXMintingRewardPeriods = []byte("USDXMintingRewardPeriods") KeyHardSupplyRewardPeriods = []byte("HardSupplyRewardPeriods") KeyHardBorrowRewardPeriods = []byte("HardBorrowRewardPeriods") KeyHardDelegatorRewardPeriods = []byte("HardDelegatorRewardPeriods") KeyClaimEnd = []byte("ClaimEnd") KeyMultipliers = []byte("ClaimMultipliers") DefaultActive = false DefaultRewardPeriods = RewardPeriods{} DefaultMultiRewardPeriods = MultiRewardPeriods{} DefaultMultipliers = Multipliers{} DefaultUSDXClaims = USDXMintingClaims{} DefaultHardClaims = HardLiquidityProviderClaims{} DefaultGenesisAccumulationTimes = GenesisAccumulationTimes{} DefaultClaimEnd = tmtime.Canonical(time.Unix(1, 0)) GovDenom = cdptypes.DefaultGovDenom PrincipalDenom = "usdx" IncentiveMacc = kavadistTypes.ModuleName )
Parameter keys and default values
var ModuleCdc *codec.Codec
ModuleCdc generic sealed codec to be used throughout module
Functions ¶
func GetTotalVestingPeriodLength ¶
GetTotalVestingPeriodLength returns the summed length of all vesting periods
func ParamKeyTable ¶
ParamKeyTable Key declaration for parameters
func RegisterCodec ¶
RegisterCodec registers the necessary types for incentive module
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account SetAccount(ctx sdk.Context, acc authexported.Account) }
AccountKeeper defines the expected keeper interface for interacting with account
type BaseClaim ¶ added in v0.13.0
type BaseClaim struct { Owner sdk.AccAddress `json:"owner" yaml:"owner"` Reward sdk.Coin `json:"reward" yaml:"reward"` }
BaseClaim is a common type shared by all Claims
func (BaseClaim) GetOwner ¶ added in v0.13.0
func (c BaseClaim) GetOwner() sdk.AccAddress
GetOwner is a getter for Claim Owner
func (BaseClaim) GetType ¶ added in v0.13.0
GetType returns the claim type, used to identify auctions in event attributes
type BaseMultiClaim ¶ added in v0.13.0
type BaseMultiClaim struct { Owner sdk.AccAddress `json:"owner" yaml:"owner"` Reward sdk.Coins `json:"reward" yaml:"reward"` }
BaseMultiClaim is a common type shared by all Claims with multiple reward denoms
func (BaseMultiClaim) GetOwner ¶ added in v0.13.0
func (c BaseMultiClaim) GetOwner() sdk.AccAddress
GetOwner is a getter for Claim Owner
func (BaseMultiClaim) GetReward ¶ added in v0.13.0
func (c BaseMultiClaim) GetReward() sdk.Coins
GetReward is a getter for Claim Reward
func (BaseMultiClaim) GetType ¶ added in v0.13.0
func (c BaseMultiClaim) GetType() string
GetType returns the claim type, used to identify auctions in event attributes
func (BaseMultiClaim) String ¶ added in v0.13.0
func (c BaseMultiClaim) String() string
String implements fmt.Stringer
func (BaseMultiClaim) Validate ¶ added in v0.13.0
func (c BaseMultiClaim) Validate() error
Validate performs a basic check of a BaseClaim fields
type CDPHooks ¶ added in v0.13.0
type CDPHooks interface { AfterCDPCreated(ctx sdk.Context, cdp cdptypes.CDP) BeforeCDPModified(ctx sdk.Context, cdp cdptypes.CDP) }
CDPHooks event hooks for other keepers to run code in response to CDP modifications
type CdpKeeper ¶
type CdpKeeper interface { GetInterestFactor(ctx sdk.Context, collateralType string) (sdk.Dec, bool) GetTotalPrincipal(ctx sdk.Context, collateralType string, principalDenom string) (total sdk.Int) GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (cdptypes.CDP, bool) GetCollateral(ctx sdk.Context, collateralType string) (cdptypes.CollateralParam, bool) }
CdpKeeper defines the expected cdp keeper for interacting with cdps
type Claim ¶
type Claim interface { GetOwner() sdk.AccAddress GetReward() sdk.Coin GetType() string }
Claim is an interface for handling common claim actions
type GenesisAccumulationTime ¶ added in v0.13.0
type GenesisAccumulationTime struct { CollateralType string `json:"collateral_type" yaml:"collateral_type"` PreviousAccumulationTime time.Time `json:"previous_accumulation_time" yaml:"previous_accumulation_time"` }
GenesisAccumulationTime stores the previous reward distribution time and its corresponding collateral type
func NewGenesisAccumulationTime ¶ added in v0.13.0
func NewGenesisAccumulationTime(ctype string, prevTime time.Time) GenesisAccumulationTime
NewGenesisAccumulationTime returns a new GenesisAccumulationTime
func (GenesisAccumulationTime) Validate ¶ added in v0.13.0
func (gat GenesisAccumulationTime) Validate() error
Validate performs validation of GenesisAccumulationTime
type GenesisAccumulationTimes ¶ added in v0.13.0
type GenesisAccumulationTimes []GenesisAccumulationTime
GenesisAccumulationTimes slice of GenesisAccumulationTime
func (GenesisAccumulationTimes) Validate ¶ added in v0.13.0
func (gats GenesisAccumulationTimes) Validate() error
Validate performs validation of GenesisAccumulationTimes
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` USDXAccumulationTimes GenesisAccumulationTimes `json:"usdx_accumulation_times" yaml:"usdx_accumulation_times"` HardSupplyAccumulationTimes GenesisAccumulationTimes `json:"hard_supply_accumulation_times" yaml:"hard_supply_accumulation_times"` HardBorrowAccumulationTimes GenesisAccumulationTimes `json:"hard_borrow_accumulation_times" yaml:"hard_borrow_accumulation_times"` HardDelegatorAccumulationTimes GenesisAccumulationTimes `json:"hard_delegator_accumulation_times" yaml:"hard_delegator_accumulation_times"` USDXMintingClaims USDXMintingClaims `json:"usdx_minting_claims" yaml:"usdx_minting_claims"` HardLiquidityProviderClaims HardLiquidityProviderClaims `json:"hard_liquidity_provider_claims" yaml:"hard_liquidity_provider_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, usdxAccumTimes, hardSupplyAccumTimes, hardBorrowAccumTimes, hardDelegatorAccumTimes GenesisAccumulationTimes, c USDXMintingClaims, hc HardLiquidityProviderClaims) GenesisState
NewGenesisState returns a new genesis state
func (GenesisState) Equal ¶
func (gs GenesisState) Equal(gs2 GenesisState) bool
Equal checks whether two gov GenesisState structs are equivalent
func (GenesisState) IsEmpty ¶
func (gs GenesisState) IsEmpty() bool
IsEmpty returns true if a GenesisState is empty
func (GenesisState) Validate ¶
func (gs GenesisState) Validate() error
Validate performs basic validation of genesis data returning an error for any failed validation criteria.
type HARDHooks ¶ added in v0.13.0
type HARDHooks interface { AfterDepositCreated(ctx sdk.Context, deposit hardtypes.Deposit) BeforeDepositModified(ctx sdk.Context, deposit hardtypes.Deposit) AfterDepositModified(ctx sdk.Context, deposit hardtypes.Deposit) AfterBorrowCreated(ctx sdk.Context, borrow hardtypes.Borrow) BeforeBorrowModified(ctx sdk.Context, borrow hardtypes.Borrow) AfterBorrowModified(ctx sdk.Context, deposit hardtypes.Deposit) }
HARDHooks event hooks for other keepers to run code in response to HARD modifications
type HardKeeper ¶ added in v0.13.0
type HardKeeper interface { GetDeposit(ctx sdk.Context, depositor sdk.AccAddress) (hardtypes.Deposit, bool) GetBorrow(ctx sdk.Context, borrower sdk.AccAddress) (hardtypes.Borrow, bool) GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) GetBorrowedCoins(ctx sdk.Context) (coins sdk.Coins, found bool) GetSuppliedCoins(ctx sdk.Context) (coins sdk.Coins, found bool) }
HardKeeper defines the expected hard keeper for interacting with Hard protocol
type HardLiquidityProviderClaim ¶ added in v0.13.0
type HardLiquidityProviderClaim struct { BaseMultiClaim `json:"base_claim" yaml:"base_claim"` SupplyRewardIndexes MultiRewardIndexes `json:"supply_reward_indexes" yaml:"supply_reward_indexes"` BorrowRewardIndexes MultiRewardIndexes `json:"borrow_reward_indexes" yaml:"borrow_reward_indexes"` DelegatorRewardIndexes RewardIndexes `json:"delegator_reward_indexes" yaml:"delegator_reward_indexes"` }
HardLiquidityProviderClaim stores the hard liquidity provider rewards that can be claimed by owner
func NewHardLiquidityProviderClaim ¶ added in v0.13.0
func NewHardLiquidityProviderClaim(owner sdk.AccAddress, rewards sdk.Coins, supplyRewardIndexes, borrowRewardIndexes MultiRewardIndexes, delegatorRewardIndexes RewardIndexes) HardLiquidityProviderClaim
NewHardLiquidityProviderClaim returns a new HardLiquidityProviderClaim
func (HardLiquidityProviderClaim) GetOwner ¶ added in v0.13.0
func (c HardLiquidityProviderClaim) GetOwner() sdk.AccAddress
GetOwner returns the claim's owner
func (HardLiquidityProviderClaim) GetReward ¶ added in v0.13.0
func (c HardLiquidityProviderClaim) GetReward() sdk.Coins
GetReward returns the claim's reward coin
func (HardLiquidityProviderClaim) GetType ¶ added in v0.13.0
func (c HardLiquidityProviderClaim) GetType() string
GetType returns the claim's type
func (HardLiquidityProviderClaim) HasBorrowRewardIndex ¶ added in v0.13.0
func (c HardLiquidityProviderClaim) HasBorrowRewardIndex(denom string) (int64, bool)
HasBorrowRewardIndex check if a claim has a borrow reward index for the input collateral type
func (HardLiquidityProviderClaim) HasDelegatorRewardIndex ¶ added in v0.13.0
func (c HardLiquidityProviderClaim) HasDelegatorRewardIndex(collateralType string) (int64, bool)
HasDelegatorRewardIndex check if a claim has a delegator reward index for the input collateral type
func (HardLiquidityProviderClaim) HasSupplyRewardIndex ¶ added in v0.13.0
func (c HardLiquidityProviderClaim) HasSupplyRewardIndex(denom string) (int64, bool)
HasSupplyRewardIndex check if a claim has a supply reward index for the input collateral type
func (HardLiquidityProviderClaim) String ¶ added in v0.13.0
func (c HardLiquidityProviderClaim) String() string
String implements fmt.Stringer
func (HardLiquidityProviderClaim) Validate ¶ added in v0.13.0
func (c HardLiquidityProviderClaim) Validate() error
Validate performs a basic check of a HardLiquidityProviderClaim fields
type HardLiquidityProviderClaims ¶ added in v0.13.0
type HardLiquidityProviderClaims []HardLiquidityProviderClaim
HardLiquidityProviderClaims slice of HardLiquidityProviderClaim
func (HardLiquidityProviderClaims) Validate ¶ added in v0.13.0
func (cs HardLiquidityProviderClaims) Validate() error
Validate checks if all the claims are valid and there are no duplicated entries.
type MsgClaimHardReward ¶ added in v0.14.0
type MsgClaimHardReward struct { Sender sdk.AccAddress `json:"sender" yaml:"sender"` MultiplierName string `json:"multiplier_name" yaml:"multiplier_name"` }
MsgClaimHardReward message type used to claim Hard liquidity provider rewards
func NewMsgClaimHardReward ¶ added in v0.14.0
func NewMsgClaimHardReward(sender sdk.AccAddress, multiplierName string) MsgClaimHardReward
NewMsgClaimHardReward returns a new MsgClaimHardReward.
func (MsgClaimHardReward) GetSignBytes ¶ added in v0.14.0
func (msg MsgClaimHardReward) GetSignBytes() []byte
GetSignBytes gets the canonical byte representation of the Msg.
func (MsgClaimHardReward) GetSigners ¶ added in v0.14.0
func (msg MsgClaimHardReward) GetSigners() []sdk.AccAddress
GetSigners returns the addresses of signers that must sign.
func (MsgClaimHardReward) Route ¶ added in v0.14.0
func (msg MsgClaimHardReward) Route() string
Route return the message type used for routing the message.
func (MsgClaimHardReward) Type ¶ added in v0.14.0
func (msg MsgClaimHardReward) Type() string
Type returns a human-readable string for the message, intended for utilization within tags.
func (MsgClaimHardReward) ValidateBasic ¶ added in v0.14.0
func (msg MsgClaimHardReward) ValidateBasic() error
ValidateBasic does a simple validation check that doesn't require access to state.
type MsgClaimUSDXMintingReward ¶ added in v0.13.0
type MsgClaimUSDXMintingReward struct { Sender sdk.AccAddress `json:"sender" yaml:"sender"` MultiplierName string `json:"multiplier_name" yaml:"multiplier_name"` }
MsgClaimUSDXMintingReward message type used to claim USDX minting rewards
func NewMsgClaimUSDXMintingReward ¶ added in v0.13.0
func NewMsgClaimUSDXMintingReward(sender sdk.AccAddress, multiplierName string) MsgClaimUSDXMintingReward
NewMsgClaimUSDXMintingReward returns a new MsgClaimUSDXMintingReward.
func (MsgClaimUSDXMintingReward) GetSignBytes ¶ added in v0.13.0
func (msg MsgClaimUSDXMintingReward) GetSignBytes() []byte
GetSignBytes gets the canonical byte representation of the Msg.
func (MsgClaimUSDXMintingReward) GetSigners ¶ added in v0.13.0
func (msg MsgClaimUSDXMintingReward) GetSigners() []sdk.AccAddress
GetSigners returns the addresses of signers that must sign.
func (MsgClaimUSDXMintingReward) Route ¶ added in v0.13.0
func (msg MsgClaimUSDXMintingReward) Route() string
Route return the message type used for routing the message.
func (MsgClaimUSDXMintingReward) Type ¶ added in v0.13.0
func (msg MsgClaimUSDXMintingReward) Type() string
Type returns a human-readable string for the message, intended for utilization within tags.
func (MsgClaimUSDXMintingReward) ValidateBasic ¶ added in v0.13.0
func (msg MsgClaimUSDXMintingReward) ValidateBasic() error
ValidateBasic does a simple validation check that doesn't require access to state.
type MultiRewardIndex ¶ added in v0.13.0
type MultiRewardIndex struct { CollateralType string `json:"collateral_type" yaml:"collateral_type"` RewardIndexes RewardIndexes `json:"reward_indexes" yaml:"reward_indexes"` }
MultiRewardIndex stores reward accumulation information on multiple reward types
func NewMultiRewardIndex ¶ added in v0.13.0
func NewMultiRewardIndex(collateralType string, indexes RewardIndexes) MultiRewardIndex
NewMultiRewardIndex returns a new MultiRewardIndex
func (MultiRewardIndex) GetFactorIndex ¶ added in v0.13.0
func (mri MultiRewardIndex) GetFactorIndex(denom string) (int, bool)
GetFactorIndex gets the index of a specific reward index inside the array by its index
func (MultiRewardIndex) String ¶ added in v0.13.0
func (mri MultiRewardIndex) String() string
func (MultiRewardIndex) Validate ¶ added in v0.13.0
func (mri MultiRewardIndex) Validate() error
Validate validates multi-reward index
type MultiRewardIndexes ¶ added in v0.13.0
type MultiRewardIndexes []MultiRewardIndex
MultiRewardIndexes slice of MultiRewardIndex
func (MultiRewardIndexes) GetRewardIndex ¶ added in v0.13.0
func (mris MultiRewardIndexes) GetRewardIndex(denom string) (MultiRewardIndex, bool)
GetRewardIndex fetches a RewardIndex from a MultiRewardIndex by its denom
func (MultiRewardIndexes) GetRewardIndexIndex ¶ added in v0.13.0
func (mris MultiRewardIndexes) GetRewardIndexIndex(denom string) (int, bool)
GetRewardIndexIndex fetches a specific reward index inside the array by its denom
func (MultiRewardIndexes) Validate ¶ added in v0.13.0
func (mris MultiRewardIndexes) Validate() error
Validate validation for reward indexes
type MultiRewardPeriod ¶ added in v0.13.0
type MultiRewardPeriod struct { Active bool `json:"active" yaml:"active"` CollateralType string `json:"collateral_type" yaml:"collateral_type"` Start time.Time `json:"start" yaml:"start"` End time.Time `json:"end" yaml:"end"` RewardsPerSecond sdk.Coins `json:"rewards_per_second" yaml:"rewards_per_second"` // per second reward payouts }
MultiRewardPeriod supports multiple reward types
func NewMultiRewardPeriod ¶ added in v0.13.0
func NewMultiRewardPeriod(active bool, collateralType string, start time.Time, end time.Time, reward sdk.Coins) MultiRewardPeriod
NewMultiRewardPeriod returns a new MultiRewardPeriod
func (MultiRewardPeriod) String ¶ added in v0.13.0
func (mrp MultiRewardPeriod) String() string
String implements fmt.Stringer
func (MultiRewardPeriod) Validate ¶ added in v0.13.0
func (mrp MultiRewardPeriod) Validate() error
Validate performs a basic check of a MultiRewardPeriod.
type MultiRewardPeriods ¶ added in v0.13.0
type MultiRewardPeriods []MultiRewardPeriod
MultiRewardPeriods array of MultiRewardPeriod
func (MultiRewardPeriods) GetMultiRewardPeriod ¶ added in v0.13.0
func (mrps MultiRewardPeriods) GetMultiRewardPeriod(denom string) (MultiRewardPeriod, bool)
GetMultiRewardPeriod fetches a MultiRewardPeriod from an array of MultiRewardPeriods by its denom
func (MultiRewardPeriods) GetMultiRewardPeriodIndex ¶ added in v0.13.0
func (mrps MultiRewardPeriods) GetMultiRewardPeriodIndex(denom string) (int, bool)
GetMultiRewardPeriodIndex returns the index of a MultiRewardPeriod inside array MultiRewardPeriods
func (MultiRewardPeriods) Validate ¶ added in v0.13.0
func (mrps MultiRewardPeriods) Validate() error
Validate checks if all the RewardPeriods are valid and there are no duplicated entries.
type Multiplier ¶ added in v0.11.0
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 ¶ added in v0.11.0
func NewMultiplier(name MultiplierName, lockup int64, factor sdk.Dec) Multiplier
NewMultiplier returns a new Multiplier
func (Multiplier) String ¶ added in v0.11.0
func (m Multiplier) String() string
String implements fmt.Stringer
func (Multiplier) Validate ¶ added in v0.11.0
func (m Multiplier) Validate() error
Validate multiplier param
type MultiplierName ¶ added in v0.11.0
type MultiplierName string
MultiplierName name for valid multiplier
const ( Small MultiplierName = "small" Medium MultiplierName = "medium" Large MultiplierName = "large" )
Valid reward multipliers
func (MultiplierName) IsValid ¶ added in v0.11.0
func (mn MultiplierName) IsValid() error
IsValid checks if the input is one of the expected strings
type Multipliers ¶ added in v0.11.0
type Multipliers []Multiplier
Multipliers slice of Multiplier
func (Multipliers) String ¶ added in v0.11.0
func (ms Multipliers) String() string
String implements fmt.Stringer
func (Multipliers) Validate ¶ added in v0.11.0
func (ms Multipliers) Validate() error
Validate validates each multiplier
type Params ¶
type Params struct { USDXMintingRewardPeriods RewardPeriods `json:"usdx_minting_reward_periods" yaml:"usdx_minting_reward_periods"` HardSupplyRewardPeriods MultiRewardPeriods `json:"hard_supply_reward_periods" yaml:"hard_supply_reward_periods"` HardBorrowRewardPeriods MultiRewardPeriods `json:"hard_borrow_reward_periods" yaml:"hard_borrow_reward_periods"` HardDelegatorRewardPeriods RewardPeriods `json:"hard_delegator_reward_periods" yaml:"hard_delegator_reward_periods"` ClaimMultipliers Multipliers `json:"claim_multipliers" yaml:"claim_multipliers"` ClaimEnd time.Time `json:"claim_end" yaml:"claim_end"` }
Params governance parameters for the incentive module
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns default params for incentive module
func NewParams ¶
func NewParams(usdxMinting RewardPeriods, hardSupply, hardBorrow MultiRewardPeriods, hardDelegator RewardPeriods, multipliers Multipliers, claimEnd time.Time) 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
type PostClaimReq ¶
type PostClaimReq struct { BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` Sender sdk.AccAddress `json:"sender" yaml:"sender"` MultiplierName string `json:"multiplier_name" yaml:"multiplier_name"` }
PostClaimReq defines the properties of claim transaction's request body.
type QueryHardRewardsParams ¶ added in v0.13.0
type QueryHardRewardsParams struct { Page int `json:"page" yaml:"page"` Limit int `json:"limit" yaml:"limit"` Owner sdk.AccAddress }
QueryHardRewardsParams params for query /incentive/rewards type hard
func NewQueryHardRewardsParams ¶ added in v0.13.0
func NewQueryHardRewardsParams(page, limit int, owner sdk.AccAddress) QueryHardRewardsParams
NewQueryHardRewardsParams returns QueryHardRewardsParams
type QueryRewardsParams ¶ added in v0.13.0
type QueryRewardsParams struct { Page int `json:"page" yaml:"page"` Limit int `json:"limit" yaml:"limit"` Owner sdk.AccAddress Type string }
QueryRewardsParams params for query /incentive/rewards
func NewQueryRewardsParams ¶ added in v0.13.0
func NewQueryRewardsParams(page, limit int, owner sdk.AccAddress, rewardType string) QueryRewardsParams
NewQueryRewardsParams returns QueryRewardsParams
type QueryUSDXMintingRewardsParams ¶ added in v0.13.0
type QueryUSDXMintingRewardsParams struct { Page int `json:"page" yaml:"page"` Limit int `json:"limit" yaml:"limit"` Owner sdk.AccAddress }
QueryUSDXMintingRewardsParams params for query /incentive/rewards type usdx-minting
func NewQueryUSDXMintingRewardsParams ¶ added in v0.13.0
func NewQueryUSDXMintingRewardsParams(page, limit int, owner sdk.AccAddress) QueryUSDXMintingRewardsParams
NewQueryUSDXMintingRewardsParams returns QueryUSDXMintingRewardsParams
type RewardIndex ¶ added in v0.13.0
type RewardIndex struct { CollateralType string `json:"collateral_type" yaml:"collateral_type"` RewardFactor sdk.Dec `json:"reward_factor" yaml:"reward_factor"` }
RewardIndex stores reward accumulation information
func NewRewardIndex ¶ added in v0.13.0
func NewRewardIndex(collateralType string, factor sdk.Dec) RewardIndex
NewRewardIndex returns a new RewardIndex
func (RewardIndex) String ¶ added in v0.13.0
func (ri RewardIndex) String() string
func (RewardIndex) Validate ¶ added in v0.13.0
func (ri RewardIndex) Validate() error
Validate validates reward index
type RewardIndexes ¶ added in v0.13.0
type RewardIndexes []RewardIndex
RewardIndexes slice of RewardIndex
func (RewardIndexes) GetFactorIndex ¶ added in v0.13.0
func (ris RewardIndexes) GetFactorIndex(denom string) (int, bool)
GetFactorIndex gets the index of a specific reward index inside the array by its index
func (RewardIndexes) GetRewardIndex ¶ added in v0.13.0
func (ris RewardIndexes) GetRewardIndex(denom string) (RewardIndex, bool)
GetRewardIndex fetches a RewardIndex by its denom
func (RewardIndexes) Validate ¶ added in v0.13.0
func (ris RewardIndexes) Validate() error
Validate validation for reward indexes
type RewardPeriod ¶
type RewardPeriod struct { Active bool `json:"active" yaml:"active"` CollateralType string `json:"collateral_type" yaml:"collateral_type"` 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"` // per second reward payouts }
RewardPeriod stores the state of an ongoing reward
func NewRewardPeriod ¶
func NewRewardPeriod(active bool, collateralType string, start time.Time, end time.Time, reward sdk.Coin) RewardPeriod
NewRewardPeriod returns a new RewardPeriod
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 StakingKeeper ¶ added in v0.13.0
type StakingKeeper interface { GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []stakingtypes.Delegation) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) TotalBondedTokens(ctx sdk.Context) sdk.Int }
StakingKeeper defines the expected staking keeper for module accounts
type SupplyKeeper ¶
type SupplyKeeper interface { GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error }
SupplyKeeper defines the expected supply keeper for module accounts
type USDXMintingClaim ¶ added in v0.13.0
type USDXMintingClaim struct { BaseClaim `json:"base_claim" yaml:"base_claim"` RewardIndexes RewardIndexes `json:"reward_indexes" yaml:"reward_indexes"` }
USDXMintingClaim is for USDX minting rewards
func NewUSDXMintingClaim ¶ added in v0.13.0
func NewUSDXMintingClaim(owner sdk.AccAddress, reward sdk.Coin, rewardIndexes RewardIndexes) USDXMintingClaim
NewUSDXMintingClaim returns a new USDXMintingClaim
func (USDXMintingClaim) GetOwner ¶ added in v0.13.0
func (c USDXMintingClaim) GetOwner() sdk.AccAddress
GetOwner returns the claim's owner
func (USDXMintingClaim) GetReward ¶ added in v0.13.0
func (c USDXMintingClaim) GetReward() sdk.Coin
GetReward returns the claim's reward coin
func (USDXMintingClaim) GetType ¶ added in v0.13.0
func (c USDXMintingClaim) GetType() string
GetType returns the claim's type
func (USDXMintingClaim) HasRewardIndex ¶ added in v0.13.0
func (c USDXMintingClaim) HasRewardIndex(collateralType string) (int64, bool)
HasRewardIndex check if a claim has a reward index for the input collateral type
func (USDXMintingClaim) String ¶ added in v0.13.0
func (c USDXMintingClaim) String() string
String implements fmt.Stringer
func (USDXMintingClaim) Validate ¶ added in v0.13.0
func (c USDXMintingClaim) Validate() error
Validate performs a basic check of a Claim fields
type USDXMintingClaims ¶ added in v0.13.0
type USDXMintingClaims []USDXMintingClaim
USDXMintingClaims slice of USDXMintingClaim
func (USDXMintingClaims) Validate ¶ added in v0.13.0
func (cs USDXMintingClaims) Validate() error
Validate checks if all the claims are valid and there are no duplicated entries.