Documentation ¶
Overview ¶
Package incentive implements a Cosmos SDK module, per ADR 009, that provides governance-controlled, on-chain incentives for users who open cdps and mint stablecoins (USDX).
For the background and motivation of this module, see the governance proposal that was voted on by KAVA token holders: https://ipfs.io/ipfs/QmSYedssC3nyQacDJmNcREtgmTPyaMx2JX7RNkMdAVkdkr/user-growth-fund-proposal.pdf
The 'Reward' parameter is used to control how much incentives are given. For example, the following reward:
Reward{ Active: true, Denom: "bnb", AvailableRewards: sdk.NewCoin("ukava", 1000000000), Duration: time.Hour*7*24, TimeLock: time.Hour*24*365, ClaimDuration: time.Hour*7*24, }
will distribute 1000 KAVA each week (Duration) to users who mint USDX using collateral bnb. That KAVA can be claimed by the user for one week (ClaimDuration) after the reward period expires, and all KAVA rewards will be timelocked for 1 year (TimeLock). If a user does not claim them during the claim duration period, they are forgone.
Rewards are accumulated by users continuously and proportionally - ie. if a user holds a CDP that has minted 10% of all USDX backed by bnb for the entire reward period, they will be eligible to claim 10% of rewards for that period.
Once a reward period ends, but not before, users can claim the rewards they have accumulated. Users claim rewards using a MsgClaimReward transaction. The following msg:
MsgClaimReward { "kava1..." "bnb" }
will claim all outstanding rewards for minting USDX backed by bnb for the input user.
Index ¶
- Constants
- Variables
- func BeginBlocker(ctx sdk.Context, k keeper.Keeper)
- func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState
- func InitGenesis(ctx sdk.Context, k keeper.Keeper, supplyKeeper types.SupplyKeeper, ...)
- func NewHandler(k keeper.Keeper) sdk.Handler
- func ValidateAccumulationTime(previousAccumulationTime, genesisTime time.Time) error
- type AccountKeeper
- type AccumulationTime
- type AccumulationTimes
- type Accumulator
- type AppModule
- func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
- func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
- func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
- func (AppModule) Name() string
- func (am AppModule) NewHandler() sdk.Handler
- func (am AppModule) NewQuerierHandler() sdk.Querier
- func (AppModule) QuerierRoute() string
- func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
- func (AppModule) Route() string
- func (am AppModule) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GenerateGenesisState(simState *module.SimulationState)
- func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent
- func (AppModuleBasic) RandomizedParams(r *rand.Rand) []sim.ParamChange
- func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
- func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)
- func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
- type BaseClaim
- type BaseMultiClaim
- type CDPHooks
- type CdpKeeper
- type Claim
- type Claims
- type DelegatorClaim
- type DelegatorClaims
- type GenesisRewardState
- type GenesisState
- type HARDHooks
- type HardKeeper
- type HardLiquidityProviderClaim
- type HardLiquidityProviderClaims
- type Hooks
- type Keeper
- type MsgClaimDelegatorReward
- type MsgClaimDelegatorRewardVVesting
- type MsgClaimHardReward
- type MsgClaimHardRewardVVesting
- type MsgClaimSwapReward
- type MsgClaimSwapRewardVVesting
- type MsgClaimUSDXMintingReward
- type MsgClaimUSDXMintingRewardVVesting
- type MultiRewardIndex
- type MultiRewardIndexes
- type MultiRewardPeriod
- type MultiRewardPeriods
- type Multiplier
- type MultiplierName
- type Multipliers
- type MultipliersPerDenom
- type ParamSubspace
- type Params
- type QueryGetRewardFactorsResponse
- type QueryRewardsParams
- type RewardIndex
- type RewardIndexes
- type RewardPeriod
- type RewardPeriods
- type Selection
- type Selections
- type StakingKeeper
- type SupplyKeeper
- type SwapClaim
- type SwapClaims
- type SwapKeeper
- type USDXMintingClaim
- type USDXMintingClaims
Constants ¶
const ( BeginningOfMonth = keeper.BeginningOfMonth MidMonth = keeper.MidMonth PaymentHour = keeper.PaymentHour AttributeKeyClaimAmount = types.AttributeKeyClaimAmount AttributeKeyClaimPeriod = types.AttributeKeyClaimPeriod AttributeKeyClaimType = types.AttributeKeyClaimType AttributeKeyClaimedBy = types.AttributeKeyClaimedBy AttributeKeyRewardPeriod = types.AttributeKeyRewardPeriod AttributeValueCategory = types.AttributeValueCategory DefaultParamspace = types.DefaultParamspace DelegatorClaimType = types.DelegatorClaimType EventTypeClaim = types.EventTypeClaim EventTypeClaimPeriod = types.EventTypeClaimPeriod EventTypeClaimPeriodExpiry = types.EventTypeClaimPeriodExpiry EventTypeRewardPeriod = types.EventTypeRewardPeriod HardLiquidityProviderClaimType = types.HardLiquidityProviderClaimType Large = types.Large MaxDenomsToClaim = types.MaxDenomsToClaim Medium = types.Medium ModuleName = types.ModuleName QuerierRoute = types.QuerierRoute QueryGetDelegatorRewards = types.QueryGetDelegatorRewards QueryGetHardRewards = types.QueryGetHardRewards QueryGetParams = types.QueryGetParams QueryGetRewardFactors = types.QueryGetRewardFactors QueryGetSwapRewards = types.QueryGetSwapRewards QueryGetUSDXMintingRewards = types.QueryGetUSDXMintingRewards RestClaimCollateralType = types.RestClaimCollateralType RestClaimOwner = types.RestClaimOwner RestClaimType = types.RestClaimType RestUnsynced = types.RestUnsynced RouterKey = types.RouterKey Small = types.Small StoreKey = types.StoreKey SwapClaimType = types.SwapClaimType USDXMintingClaimType = types.USDXMintingClaimType )
Variables ¶
var ( // function aliases NewKeeper = keeper.NewKeeper NewQuerier = keeper.NewQuerier DefaultGenesisState = types.DefaultGenesisState DefaultParams = types.DefaultParams GetTotalVestingPeriodLength = types.GetTotalVestingPeriodLength NewAccumulationTime = types.NewAccumulationTime NewAccumulator = types.NewAccumulator NewDelegatorClaim = types.NewDelegatorClaim NewGenesisRewardState = types.NewGenesisRewardState NewGenesisState = types.NewGenesisState NewHardLiquidityProviderClaim = types.NewHardLiquidityProviderClaim NewMsgClaimDelegatorReward = types.NewMsgClaimDelegatorReward NewMsgClaimDelegatorRewardVVesting = types.NewMsgClaimDelegatorRewardVVesting NewMsgClaimHardReward = types.NewMsgClaimHardReward NewMsgClaimHardRewardVVesting = types.NewMsgClaimHardRewardVVesting NewMsgClaimSwapReward = types.NewMsgClaimSwapReward NewMsgClaimSwapRewardVVesting = types.NewMsgClaimSwapRewardVVesting NewMsgClaimUSDXMintingReward = types.NewMsgClaimUSDXMintingReward NewMsgClaimUSDXMintingRewardVVesting = types.NewMsgClaimUSDXMintingRewardVVesting NewMultiRewardIndex = types.NewMultiRewardIndex NewMultiRewardPeriod = types.NewMultiRewardPeriod NewMultiRewardPeriodFromRewardPeriod = types.NewMultiRewardPeriodFromRewardPeriod NewMultiplier = types.NewMultiplier NewParams = types.NewParams NewPeriod = types.NewPeriod NewQueryGetRewardFactorsResponse = types.NewQueryGetRewardFactorsResponse NewQueryRewardsParams = types.NewQueryRewardsParams NewRewardIndex = types.NewRewardIndex NewRewardPeriod = types.NewRewardPeriod NewSelection = types.NewSelection NewSelectionsFromMap = types.NewSelectionsFromMap NewSwapClaim = types.NewSwapClaim NewUSDXMintingClaim = types.NewUSDXMintingClaim ParamKeyTable = types.ParamKeyTable ParseMultiplierName = types.ParseMultiplierName RegisterCodec = types.RegisterCodec // variable aliases BondDenom = types.BondDenom DefaultActive = types.DefaultActive DefaultClaimEnd = types.DefaultClaimEnd DefaultDelegatorClaims = types.DefaultDelegatorClaims DefaultGenesisRewardState = types.DefaultGenesisRewardState DefaultHardClaims = types.DefaultHardClaims DefaultMultiRewardPeriods = types.DefaultMultiRewardPeriods DefaultMultipliers = types.DefaultMultipliers DefaultRewardPeriods = types.DefaultRewardPeriods DefaultSwapClaims = types.DefaultSwapClaims DefaultUSDXClaims = types.DefaultUSDXClaims DelegatorClaimKeyPrefix = types.DelegatorClaimKeyPrefix DelegatorRewardIndexesKeyPrefix = types.DelegatorRewardIndexesKeyPrefix ErrAccountNotFound = types.ErrAccountNotFound ErrClaimExpired = types.ErrClaimExpired ErrClaimNotFound = types.ErrClaimNotFound ErrDecreasingRewardFactor = types.ErrDecreasingRewardFactor ErrInsufficientModAccountBalance = types.ErrInsufficientModAccountBalance ErrInvalidAccountType = types.ErrInvalidAccountType ErrInvalidClaimDenoms = types.ErrInvalidClaimDenoms ErrInvalidClaimType = types.ErrInvalidClaimType ErrInvalidMultiplier = types.ErrInvalidMultiplier ErrNoClaimsFound = types.ErrNoClaimsFound ErrRewardPeriodNotFound = types.ErrRewardPeriodNotFound ErrZeroClaim = types.ErrZeroClaim HardBorrowRewardIndexesKeyPrefix = types.HardBorrowRewardIndexesKeyPrefix HardLiquidityClaimKeyPrefix = types.HardLiquidityClaimKeyPrefix HardSupplyRewardIndexesKeyPrefix = types.HardSupplyRewardIndexesKeyPrefix IncentiveMacc = types.IncentiveMacc KeyClaimEnd = types.KeyClaimEnd KeyDelegatorRewardPeriods = types.KeyDelegatorRewardPeriods KeyHardBorrowRewardPeriods = types.KeyHardBorrowRewardPeriods KeyHardSupplyRewardPeriods = types.KeyHardSupplyRewardPeriods KeyMultipliers = types.KeyMultipliers KeySwapRewardPeriods = types.KeySwapRewardPeriods KeyUSDXMintingRewardPeriods = types.KeyUSDXMintingRewardPeriods ModuleCdc = types.ModuleCdc PreviousDelegatorRewardAccrualTimeKeyPrefix = types.PreviousDelegatorRewardAccrualTimeKeyPrefix PreviousHardBorrowRewardAccrualTimeKeyPrefix = types.PreviousHardBorrowRewardAccrualTimeKeyPrefix PreviousHardSupplyRewardAccrualTimeKeyPrefix = types.PreviousHardSupplyRewardAccrualTimeKeyPrefix PreviousSwapRewardAccrualTimeKeyPrefix = types.PreviousSwapRewardAccrualTimeKeyPrefix PreviousUSDXMintingRewardAccrualTimeKeyPrefix = types.PreviousUSDXMintingRewardAccrualTimeKeyPrefix SwapClaimKeyPrefix = types.SwapClaimKeyPrefix SwapRewardIndexesKeyPrefix = types.SwapRewardIndexesKeyPrefix USDXMintingClaimKeyPrefix = types.USDXMintingClaimKeyPrefix USDXMintingRewardDenom = types.USDXMintingRewardDenom USDXMintingRewardFactorKeyPrefix = types.USDXMintingRewardFactorKeyPrefix )
var EarliestValidAccumulationTime time.Duration = year
EarliestValidAccumulationTime is how far behind the genesis time an accumulation time can be for it to be valid. It's a safety check to ensure rewards aren't accidentally accumulated for many years on the first block (eg since Jan 1970).
Functions ¶
func BeginBlocker ¶
BeginBlocker runs at the start of every block
func ExportGenesis ¶
ExportGenesis export genesis state for incentive module
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, k keeper.Keeper, supplyKeeper types.SupplyKeeper, cdpKeeper types.CdpKeeper, gs types.GenesisState)
InitGenesis initializes the store state from a genesis state.
func NewHandler ¶
NewHandler creates an sdk.Handler for incentive module messages
func ValidateAccumulationTime ¶ added in v0.15.0
Types ¶
type AccountKeeper ¶
type AccountKeeper = types.AccountKeeper
type AccumulationTime ¶ added in v0.15.0
type AccumulationTime = types.AccumulationTime
type AccumulationTimes ¶ added in v0.15.0
type AccumulationTimes = types.AccumulationTimes
type Accumulator ¶ added in v0.15.0
type Accumulator = types.Accumulator
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule implements the sdk.AppModule interface.
func NewAppModule ¶
func NewAppModule(keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper SupplyKeeper, cdpKeeper CdpKeeper) AppModule
NewAppModule creates a new AppModule object
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
BeginBlock returns the begin blocker for the incentive module.
func (AppModule) EndBlock ¶
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
EndBlock returns the end blocker for the incentive module. It returns no validator updates.
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
ExportGenesis returns the exported genesis state as raw bytes for the incentive module
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
InitGenesis performs genesis initialization for the incentive module. It returns no validator updates.
func (AppModule) NewHandler ¶
NewHandler returns an sdk.Handler for the incentive module.
func (AppModule) NewQuerierHandler ¶
NewQuerierHandler returns the incentive module sdk.Querier.
func (AppModule) QuerierRoute ¶
QuerierRoute returns the incentive module's querier route name.
func (AppModule) RegisterInvariants ¶
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
RegisterInvariants registers the incentive module invariants.
func (AppModule) WeightedOperations ¶
func (am AppModule) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation
WeightedOperations returns the all the incentive module operations with their respective weights.
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic defines the basic application module used by the incentive module.
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
DefaultGenesis returns default genesis state as raw bytes for the incentive module.
func (AppModuleBasic) GenerateGenesisState ¶
func (AppModuleBasic) GenerateGenesisState(simState *module.SimulationState)
GenerateGenesisState creates a randomized GenState of the incentive module
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
GetQueryCmd returns no root query command for the incentive module.
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
GetTxCmd returns the root tx command for the incentive module.
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
Name returns the incentive module's name.
func (AppModuleBasic) ProposalContents ¶
func (AppModuleBasic) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent
ProposalContents doesn't return any content functions for governance proposals.
func (AppModuleBasic) RandomizedParams ¶
func (AppModuleBasic) RandomizedParams(r *rand.Rand) []sim.ParamChange
RandomizedParams creates randomized incentive param changes for the simulator.
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
RegisterCodec registers the incentive module's types for the given codec.
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
RegisterRESTRoutes registers the REST routes for the incentive module.
func (AppModuleBasic) RegisterStoreDecoder ¶
func (AppModuleBasic) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)
RegisterStoreDecoder registers a decoder for incentive module's types
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
ValidateGenesis performs genesis state validation for the incentive module.
type BaseMultiClaim ¶ added in v0.13.0
type BaseMultiClaim = types.BaseMultiClaim
type DelegatorClaim ¶ added in v0.15.0
type DelegatorClaim = types.DelegatorClaim
type DelegatorClaims ¶ added in v0.15.0
type DelegatorClaims = types.DelegatorClaims
type GenesisRewardState ¶ added in v0.15.0
type GenesisRewardState = types.GenesisRewardState
type GenesisState ¶
type GenesisState = types.GenesisState
type HardKeeper ¶ added in v0.13.0
type HardKeeper = types.HardKeeper
type HardLiquidityProviderClaim ¶ added in v0.13.0
type HardLiquidityProviderClaim = types.HardLiquidityProviderClaim
type HardLiquidityProviderClaims ¶ added in v0.13.0
type HardLiquidityProviderClaims = types.HardLiquidityProviderClaims
type MsgClaimDelegatorReward ¶ added in v0.15.0
type MsgClaimDelegatorReward = types.MsgClaimDelegatorReward
type MsgClaimDelegatorRewardVVesting ¶ added in v0.15.0
type MsgClaimDelegatorRewardVVesting = types.MsgClaimDelegatorRewardVVesting
type MsgClaimHardReward ¶ added in v0.14.0
type MsgClaimHardReward = types.MsgClaimHardReward
type MsgClaimHardRewardVVesting ¶ added in v0.14.2
type MsgClaimHardRewardVVesting = types.MsgClaimHardRewardVVesting
type MsgClaimSwapReward ¶ added in v0.15.0
type MsgClaimSwapReward = types.MsgClaimSwapReward
type MsgClaimSwapRewardVVesting ¶ added in v0.15.0
type MsgClaimSwapRewardVVesting = types.MsgClaimSwapRewardVVesting
type MsgClaimUSDXMintingReward ¶ added in v0.13.0
type MsgClaimUSDXMintingReward = types.MsgClaimUSDXMintingReward
type MsgClaimUSDXMintingRewardVVesting ¶ added in v0.14.2
type MsgClaimUSDXMintingRewardVVesting = types.MsgClaimUSDXMintingRewardVVesting
type MultiRewardIndex ¶ added in v0.13.0
type MultiRewardIndex = types.MultiRewardIndex
type MultiRewardIndexes ¶ added in v0.13.0
type MultiRewardIndexes = types.MultiRewardIndexes
type MultiRewardPeriod ¶ added in v0.13.0
type MultiRewardPeriod = types.MultiRewardPeriod
type MultiRewardPeriods ¶ added in v0.13.0
type MultiRewardPeriods = types.MultiRewardPeriods
type Multiplier ¶ added in v0.11.0
type Multiplier = types.Multiplier
type MultiplierName ¶ added in v0.11.0
type MultiplierName = types.MultiplierName
type Multipliers ¶ added in v0.11.0
type Multipliers = types.Multipliers
type MultipliersPerDenom ¶ added in v0.15.0
type MultipliersPerDenom = types.MultipliersPerDenom
type ParamSubspace ¶ added in v0.15.0
type ParamSubspace = types.ParamSubspace
type QueryGetRewardFactorsResponse ¶ added in v0.15.0
type QueryGetRewardFactorsResponse = types.QueryGetRewardFactorsResponse
type QueryRewardsParams ¶ added in v0.13.0
type QueryRewardsParams = types.QueryRewardsParams
type RewardIndex ¶ added in v0.13.0
type RewardIndex = types.RewardIndex
type RewardIndexes ¶ added in v0.13.0
type RewardIndexes = types.RewardIndexes
type RewardPeriod ¶
type RewardPeriod = types.RewardPeriod
type RewardPeriods ¶
type RewardPeriods = types.RewardPeriods
type Selections ¶ added in v0.15.0
type Selections = types.Selections
type StakingKeeper ¶ added in v0.13.0
type StakingKeeper = types.StakingKeeper
type SupplyKeeper ¶
type SupplyKeeper = types.SupplyKeeper
type SwapClaims ¶ added in v0.15.0
type SwapClaims = types.SwapClaims
type SwapKeeper ¶ added in v0.15.0
type SwapKeeper = types.SwapKeeper
type USDXMintingClaim ¶ added in v0.13.0
type USDXMintingClaim = types.USDXMintingClaim
type USDXMintingClaims ¶ added in v0.13.0
type USDXMintingClaims = types.USDXMintingClaims