keeper

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// BeginningOfMonth harvest rewards that are claimed after the 15th at 14:00UTC of the month always vest on the first of the month
	BeginningOfMonth = 1
	// MidMonth harvest rewards that are claimed before the 15th at 14:00UTC of the month always vest on the 15 of the month
	MidMonth = 15
	// PaymentHour harvest rewards always vest at 14:00UTC
	PaymentHour = 14
)
View Source
const (
	SecondsPerYear = 31536000
)

Variables

This section is empty.

Functions

func GetAPYFromMultiRewardPeriod added in v0.19.0

func GetAPYFromMultiRewardPeriod(
	ctx sdk.Context,
	k Keeper,
	collateralType string,
	rewardPeriod types.MultiRewardPeriod,
	totalSupply sdk.Int,
) (sdk.Dec, error)

GetAPYFromMultiRewardPeriod calculates the APY for a given MultiRewardPeriod

func GetProportionalRewardsPerSecond added in v0.19.0

func GetProportionalRewardsPerSecond(
	rewardPeriod types.MultiRewardPeriod,
	totalBkavaSupply sdk.Int,
	singleBkavaSupply sdk.Int,
) sdk.DecCoins

func GetStakingAPR added in v0.19.0

func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdk.Dec, error)

GetStakingAPR returns the total APR for staking and incentive rewards

func NewMsgServerImpl added in v0.16.0

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the incentive MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries

Types

type Hooks added in v0.13.0

type Hooks struct {
	// contains filtered or unexported fields
}

Hooks wrapper struct for hooks

func (Hooks) AfterBorrowCreated added in v0.13.0

func (h Hooks) AfterBorrowCreated(ctx sdk.Context, borrow hardtypes.Borrow)

AfterBorrowCreated function that runs after a borrow is created

func (Hooks) AfterBorrowModified added in v0.13.0

func (h Hooks) AfterBorrowModified(ctx sdk.Context, borrow hardtypes.Borrow)

AfterBorrowModified function that runs after a borrow is modified

func (Hooks) AfterCDPCreated added in v0.13.0

func (h Hooks) AfterCDPCreated(ctx sdk.Context, cdp cdptypes.CDP)

AfterCDPCreated function that runs after a cdp is created

func (Hooks) AfterDelegationModified added in v0.13.0

func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

AfterDelegationModified runs after a delegation is modified

func (Hooks) AfterDepositCreated added in v0.13.0

func (h Hooks) AfterDepositCreated(ctx sdk.Context, deposit hardtypes.Deposit)

AfterDepositCreated function that runs after a deposit is created

func (Hooks) AfterDepositModified added in v0.13.0

func (h Hooks) AfterDepositModified(ctx sdk.Context, deposit hardtypes.Deposit)

AfterDepositModified function that runs after a deposit is modified

func (Hooks) AfterPoolDepositCreated added in v0.15.0

func (h Hooks) AfterPoolDepositCreated(ctx sdk.Context, poolID string, depositor sdk.AccAddress, _ sdk.Int)

func (Hooks) AfterSavingsDepositCreated added in v0.17.0

func (h Hooks) AfterSavingsDepositCreated(ctx sdk.Context, deposit savingstypes.Deposit)

AfterSavingsDepositCreated function that runs after a deposit is created

func (Hooks) AfterValidatorBeginUnbonding added in v0.13.0

func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorBeginUnbonding is called after a validator begins unbonding Validator status is set to Unbonding prior to hook running

func (Hooks) AfterValidatorBonded added in v0.13.0

func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorBonded is called after a validator is bonded Validator status is set to Bonded prior to hook running

func (Hooks) AfterValidatorCreated added in v0.13.0

func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

AfterValidatorCreated runs after a validator is created

func (Hooks) AfterValidatorRemoved added in v0.13.0

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorRemoved runs after a validator is removed

func (Hooks) AfterVaultDepositCreated added in v0.19.0

func (h Hooks) AfterVaultDepositCreated(
	ctx sdk.Context,
	vaultDenom string,
	depositor sdk.AccAddress,
	_ sdk.Dec,
)

AfterVaultDepositCreated function that runs after a vault deposit is created

func (Hooks) BeforeBorrowModified added in v0.13.0

func (h Hooks) BeforeBorrowModified(ctx sdk.Context, borrow hardtypes.Borrow)

BeforeBorrowModified function that runs before a borrow is modified

func (Hooks) BeforeCDPModified added in v0.13.0

func (h Hooks) BeforeCDPModified(ctx sdk.Context, cdp cdptypes.CDP)

BeforeCDPModified function that runs before a cdp is modified note that this is called immediately after interest is synchronized, and so could potentially be called AfterCDPInterestUpdated or something like that, if we we're to expand the scope of cdp hooks

func (Hooks) BeforeDelegationCreated added in v0.13.0

func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationCreated runs before a delegation is created

func (Hooks) BeforeDelegationRemoved added in v0.13.0

func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationRemoved runs directly before a delegation is deleted. BeforeDelegationSharesModified is run prior to this.

func (Hooks) BeforeDelegationSharesModified added in v0.13.0

func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationSharesModified runs before an existing delegation is modified

func (Hooks) BeforeDepositModified added in v0.13.0

func (h Hooks) BeforeDepositModified(ctx sdk.Context, deposit hardtypes.Deposit)

BeforeDepositModified function that runs before a deposit is modified

func (Hooks) BeforePoolDepositModified added in v0.15.0

func (h Hooks) BeforePoolDepositModified(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdk.Int)

func (Hooks) BeforeSavingsDepositModified added in v0.17.0

func (h Hooks) BeforeSavingsDepositModified(ctx sdk.Context, deposit savingstypes.Deposit, incomingDenoms []string)

BeforeSavingsDepositModified function that runs before a deposit is modified

func (Hooks) BeforeValidatorModified added in v0.13.0

func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

BeforeValidatorModified runs before a validator is modified

func (Hooks) BeforeValidatorSlashed added in v0.13.0

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

BeforeValidatorSlashed is called before a validator is slashed Validator status is not updated when Slash or Jail is called

func (Hooks) BeforeVaultDepositModified added in v0.19.0

func (h Hooks) BeforeVaultDepositModified(
	ctx sdk.Context,
	vaultDenom string,
	depositor sdk.AccAddress,
	sharesOwned sdk.Dec,
)

BeforeVaultDepositModified function that runs before a vault deposit is modified

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper keeper for the incentive module

func (Keeper) AccumulateDelegatorRewards added in v0.15.0

func (k Keeper) AccumulateDelegatorRewards(ctx sdk.Context, rewardPeriod types.MultiRewardPeriod)

AccumulateDelegatorRewards calculates new rewards to distribute this block and updates the global indexes to reflect this. The provided rewardPeriod must be valid to avoid panics in calculating time durations.

func (Keeper) AccumulateEarnRewards added in v0.19.0

func (k Keeper) AccumulateEarnRewards(ctx sdk.Context, rewardPeriod types.MultiRewardPeriod) error

AccumulateEarnRewards calculates new rewards to distribute this block and updates the global indexes to reflect this. The provided rewardPeriod must be valid to avoid panics in calculating time durations.

func (Keeper) AccumulateHardBorrowRewards added in v0.13.0

func (k Keeper) AccumulateHardBorrowRewards(ctx sdk.Context, rewardPeriod types.MultiRewardPeriod)

AccumulateHardBorrowRewards calculates new rewards to distribute this block and updates the global indexes to reflect this. The provided rewardPeriod must be valid to avoid panics in calculating time durations.

func (Keeper) AccumulateHardSupplyRewards added in v0.13.0

func (k Keeper) AccumulateHardSupplyRewards(ctx sdk.Context, rewardPeriod types.MultiRewardPeriod)

AccumulateHardSupplyRewards calculates new rewards to distribute this block and updates the global indexes to reflect this. The provided rewardPeriod must be valid to avoid panics in calculating time durations.

func (Keeper) AccumulateSavingsRewards added in v0.17.0

func (k Keeper) AccumulateSavingsRewards(ctx sdk.Context, rewardPeriod types.MultiRewardPeriod)

AccumulateSavingsRewards calculates new rewards to distribute this block and updates the global indexes

func (Keeper) AccumulateSwapRewards added in v0.15.0

func (k Keeper) AccumulateSwapRewards(ctx sdk.Context, rewardPeriod types.MultiRewardPeriod)

AccumulateSwapRewards calculates new rewards to distribute this block and updates the global indexes to reflect this. The provided rewardPeriod must be valid to avoid panics in calculating time durations.

func (Keeper) AccumulateUSDXMintingRewards added in v0.13.0

func (k Keeper) AccumulateUSDXMintingRewards(ctx sdk.Context, rewardPeriod types.RewardPeriod)

AccumulateUSDXMintingRewards calculates new rewards to distribute this block and updates the global indexes to reflect this. The provided rewardPeriod must be valid to avoid panics in calculating time durations.

func (Keeper) CalculateRewards added in v0.15.0

func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sourceShares sdk.Dec) (sdk.Coins, error)

CalculateRewards computes how much rewards should have accrued to a reward source (eg a user's hard borrowed btc amount) between two index values.

oldIndex is normally the index stored on a claim, newIndex the current global value, and sourceShares a hard borrowed/supplied amount.

It returns an error if newIndexes does not contain all CollateralTypes from oldIndexes, or if any value of oldIndex.RewardFactor > newIndex.RewardFactor. This should never happen, as it would mean that a global reward index has decreased in value, or that a global reward index has been deleted from state.

func (Keeper) CalculateSingleReward added in v0.15.0

func (k Keeper) CalculateSingleReward(oldIndex, newIndex, sourceShares sdk.Dec) (sdk.Int, error)

CalculateSingleReward computes how much rewards should have accrued to a reward source (eg a user's btcb-a cdp principal) between two index values.

oldIndex is normally the index stored on a claim, newIndex the current global value, and sourceShares a cdp principal amount.

Returns an error if oldIndex > newIndex. This should never happen, as it would mean that a global reward index has decreased in value, or that a global reward index has been deleted from state.

func (Keeper) ClaimDelegatorReward added in v0.15.0

func (k Keeper) ClaimDelegatorReward(ctx sdk.Context, owner, receiver sdk.AccAddress, denom string, multiplierName string) error

ClaimDelegatorReward pays out funds from a claim to a receiver account. Rewards are removed from a claim and paid out according to the multiplier, which reduces the reward amount in exchange for shorter vesting times.

func (Keeper) ClaimEarnReward added in v0.19.0

func (k Keeper) ClaimEarnReward(ctx sdk.Context, owner, receiver sdk.AccAddress, denom string, multiplierName string) error

ClaimEarnReward pays out funds from a claim to a receiver account. Rewards are removed from a claim and paid out according to the multiplier, which reduces the reward amount in exchange for shorter vesting times.

func (Keeper) ClaimHardReward added in v0.13.0

func (k Keeper) ClaimHardReward(ctx sdk.Context, owner, receiver sdk.AccAddress, denom string, multiplierName string) error

ClaimHardReward pays out funds from a claim to a receiver account. Rewards are removed from a claim and paid out according to the multiplier, which reduces the reward amount in exchange for shorter vesting times.

func (Keeper) ClaimSavingsReward added in v0.17.0

func (k Keeper) ClaimSavingsReward(ctx sdk.Context, owner, receiver sdk.AccAddress, denom string, multiplierName string) error

ClaimSavingsReward is a stub method for MsgServer interface compliance

func (Keeper) ClaimSwapReward added in v0.15.0

func (k Keeper) ClaimSwapReward(ctx sdk.Context, owner, receiver sdk.AccAddress, denom string, multiplierName string) error

ClaimSwapReward pays out funds from a claim to a receiver account. Rewards are removed from a claim and paid out according to the multiplier, which reduces the reward amount in exchange for shorter vesting times.

func (Keeper) ClaimUSDXMintingReward added in v0.13.0

func (k Keeper) ClaimUSDXMintingReward(ctx sdk.Context, owner, receiver sdk.AccAddress, multiplierName string) error

ClaimUSDXMintingReward pays out funds from a claim to a receiver account. Rewards are removed from a claim and paid out according to the multiplier, which reduces the reward amount in exchange for shorter vesting times.

func (Keeper) DeleteDelegatorClaim added in v0.15.0

func (k Keeper) DeleteDelegatorClaim(ctx sdk.Context, owner sdk.AccAddress)

DeleteDelegatorClaim deletes the claim in the store corresponding to the input address, collateral type, and id

func (Keeper) DeleteEarnClaim added in v0.19.0

func (k Keeper) DeleteEarnClaim(ctx sdk.Context, owner sdk.AccAddress)

DeleteEarnClaim deletes the claim in the store corresponding to the input address.

func (Keeper) DeleteHardLiquidityProviderClaim added in v0.13.0

func (k Keeper) DeleteHardLiquidityProviderClaim(ctx sdk.Context, owner sdk.AccAddress)

DeleteHardLiquidityProviderClaim deletes the claim in the store corresponding to the input address, collateral type, and id

func (Keeper) DeleteSavingsClaim added in v0.17.0

func (k Keeper) DeleteSavingsClaim(ctx sdk.Context, owner sdk.AccAddress)

DeleteSavingsClaim deletes the claim in the store corresponding to the input address.

func (Keeper) DeleteSwapClaim added in v0.15.0

func (k Keeper) DeleteSwapClaim(ctx sdk.Context, owner sdk.AccAddress)

DeleteSwapClaim deletes the claim in the store corresponding to the input address.

func (Keeper) DeleteUSDXMintingClaim added in v0.13.0

func (k Keeper) DeleteUSDXMintingClaim(ctx sdk.Context, owner sdk.AccAddress)

DeleteUSDXMintingClaim deletes the claim in the store corresponding to the input address, collateral type, and id

func (Keeper) GetAllDelegatorClaims added in v0.15.0

func (k Keeper) GetAllDelegatorClaims(ctx sdk.Context) types.DelegatorClaims

GetAllDelegatorClaims returns all DelegatorClaim objects in the store

func (Keeper) GetAllEarnClaims added in v0.19.0

func (k Keeper) GetAllEarnClaims(ctx sdk.Context) types.EarnClaims

GetAllEarnClaims returns all Claim objects in the store

func (Keeper) GetAllHardLiquidityProviderClaims added in v0.13.0

func (k Keeper) GetAllHardLiquidityProviderClaims(ctx sdk.Context) types.HardLiquidityProviderClaims

GetAllHardLiquidityProviderClaims returns all Claim objects in the store

func (Keeper) GetAllSavingsClaims added in v0.17.0

func (k Keeper) GetAllSavingsClaims(ctx sdk.Context) types.SavingsClaims

GetAllSavingsClaims returns all savings claim objects in the store

func (Keeper) GetAllSwapClaims added in v0.15.0

func (k Keeper) GetAllSwapClaims(ctx sdk.Context) types.SwapClaims

GetAllSwapClaims returns all Claim objects in the store

func (Keeper) GetAllUSDXMintingClaims added in v0.13.0

func (k Keeper) GetAllUSDXMintingClaims(ctx sdk.Context) types.USDXMintingClaims

GetAllUSDXMintingClaims returns all Claim objects in the store

func (Keeper) GetClaimEnd added in v0.13.0

func (k Keeper) GetClaimEnd(ctx sdk.Context) time.Time

GetClaimEnd returns the claim end time for the params

func (Keeper) GetDelegatorClaim added in v0.15.0

func (k Keeper) GetDelegatorClaim(ctx sdk.Context, addr sdk.AccAddress) (types.DelegatorClaim, bool)

GetDelegatorClaim returns the claim in the store corresponding the the input address collateral type and id and a boolean for if the claim was found

func (Keeper) GetDelegatorRewardIndexes added in v0.15.0

func (k Keeper) GetDelegatorRewardIndexes(ctx sdk.Context, denom string) (types.RewardIndexes, bool)

GetDelegatorRewardIndexes gets the current reward indexes for an individual denom

func (Keeper) GetDelegatorRewardPeriods added in v0.15.0

func (k Keeper) GetDelegatorRewardPeriods(ctx sdk.Context, denom string) (types.MultiRewardPeriod, bool)

GetDelegatorRewardPeriods returns the reward period with the specified collateral type if it's found in the params

func (Keeper) GetEarnClaim added in v0.19.0

func (k Keeper) GetEarnClaim(ctx sdk.Context, addr sdk.AccAddress) (types.EarnClaim, bool)

GetEarnClaim returns the claim in the store corresponding the the input address.

func (Keeper) GetEarnRewardAccrualTime added in v0.19.0

func (k Keeper) GetEarnRewardAccrualTime(ctx sdk.Context, vaultDenom string) (blockTime time.Time, found bool)

GetEarnRewardAccrualTime fetches the last time rewards were accrued for an earn vault.

func (Keeper) GetEarnRewardIndexes added in v0.19.0

func (k Keeper) GetEarnRewardIndexes(ctx sdk.Context, vaultDenom string) (types.RewardIndexes, bool)

GetEarnRewardIndexes fetches the global reward indexes that track total rewards to a earn vault.

func (Keeper) GetHardBorrowRewardIndexes added in v0.13.0

func (k Keeper) GetHardBorrowRewardIndexes(ctx sdk.Context, denom string) (types.RewardIndexes, bool)

GetHardBorrowRewardIndexes gets the current reward indexes for an individual denom

func (Keeper) GetHardBorrowRewardPeriods added in v0.13.0

func (k Keeper) GetHardBorrowRewardPeriods(ctx sdk.Context, denom string) (types.MultiRewardPeriod, bool)

GetHardBorrowRewardPeriods returns the reward period with the specified collateral type if it's found in the params

func (Keeper) GetHardLiquidityProviderClaim added in v0.13.0

func (k Keeper) GetHardLiquidityProviderClaim(ctx sdk.Context, addr sdk.AccAddress) (types.HardLiquidityProviderClaim, bool)

GetHardLiquidityProviderClaim returns the claim in the store corresponding the the input address collateral type and id and a boolean for if the claim was found

func (Keeper) GetHardSupplyRewardIndexes added in v0.13.0

func (k Keeper) GetHardSupplyRewardIndexes(ctx sdk.Context, denom string) (types.RewardIndexes, bool)

GetHardSupplyRewardIndexes gets the current reward indexes for an individual denom

func (Keeper) GetHardSupplyRewardPeriods added in v0.13.0

func (k Keeper) GetHardSupplyRewardPeriods(ctx sdk.Context, denom string) (types.MultiRewardPeriod, bool)

GetHardSupplyRewardPeriods returns the reward period with the specified collateral type if it's found in the params

func (Keeper) GetMultiplierByDenom added in v0.15.0

func (k Keeper) GetMultiplierByDenom(ctx sdk.Context, denom string, name string) (types.Multiplier, bool)

GetMultiplierByDenom fetches a multiplier from the params matching the denom and name.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams returns the params from the store

func (Keeper) GetPeriodLength added in v0.13.0

func (k Keeper) GetPeriodLength(blockTime time.Time, monthsLockup int64) int64

GetPeriodLength returns the length of the lockup period based on the input blocktime and multiplier lockup. Note that pay dates are always the 1st or 15th of the month at 14:00UTC. Months lockup cannot be negative

func (Keeper) GetPreviousDelegatorRewardAccrualTime added in v0.15.0

func (k Keeper) GetPreviousDelegatorRewardAccrualTime(ctx sdk.Context, denom string) (blockTime time.Time, found bool)

GetPreviousDelegatorRewardAccrualTime returns the last time a denom accrued protocol delegator rewards

func (Keeper) GetPreviousHardBorrowRewardAccrualTime added in v0.13.0

func (k Keeper) GetPreviousHardBorrowRewardAccrualTime(ctx sdk.Context, denom string) (blockTime time.Time, found bool)

GetPreviousHardBorrowRewardAccrualTime returns the last time a denom accrued Hard protocol borrow-side rewards

func (Keeper) GetPreviousHardSupplyRewardAccrualTime added in v0.13.0

func (k Keeper) GetPreviousHardSupplyRewardAccrualTime(ctx sdk.Context, denom string) (blockTime time.Time, found bool)

GetPreviousHardSupplyRewardAccrualTime returns the last time a denom accrued Hard protocol supply-side rewards

func (Keeper) GetPreviousUSDXMintingAccrualTime added in v0.13.0

func (k Keeper) GetPreviousUSDXMintingAccrualTime(ctx sdk.Context, ctype string) (blockTime time.Time, found bool)

GetPreviousUSDXMintingAccrualTime returns the last time a collateral type accrued USDX minting rewards

func (Keeper) GetSavingsClaim added in v0.17.0

func (k Keeper) GetSavingsClaim(ctx sdk.Context, addr sdk.AccAddress) (types.SavingsClaim, bool)

GetSavingsClaim returns the claim in the store corresponding the the input address.

func (Keeper) GetSavingsRewardAccrualTime added in v0.17.0

func (k Keeper) GetSavingsRewardAccrualTime(ctx sdk.Context, poolID string) (blockTime time.Time, found bool)

GetSavingsRewardAccrualTime fetches the last time rewards were accrued for an individual denom type

func (Keeper) GetSavingsRewardIndexes added in v0.17.0

func (k Keeper) GetSavingsRewardIndexes(ctx sdk.Context, denom string) (types.RewardIndexes, bool)

GetSavingsRewardIndexes fetches the global reward indexes that track rewards for an individual denom type

func (Keeper) GetSavingsRewardPeriods added in v0.17.0

func (k Keeper) GetSavingsRewardPeriods(ctx sdk.Context, denom string) (types.MultiRewardPeriod, bool)

GetSavingsRewardPeriods returns the reward period with the specified collateral type if it's found in the params

func (Keeper) GetSwapClaim added in v0.15.0

func (k Keeper) GetSwapClaim(ctx sdk.Context, addr sdk.AccAddress) (types.SwapClaim, bool)

GetSwapClaim returns the claim in the store corresponding the the input address.

func (Keeper) GetSwapRewardAccrualTime added in v0.15.0

func (k Keeper) GetSwapRewardAccrualTime(ctx sdk.Context, poolID string) (blockTime time.Time, found bool)

GetSwapRewardAccrualTime fetches the last time rewards were accrued for a swap pool.

func (Keeper) GetSwapRewardIndexes added in v0.15.0

func (k Keeper) GetSwapRewardIndexes(ctx sdk.Context, poolID string) (types.RewardIndexes, bool)

GetSwapRewardIndexes fetches the global reward indexes that track total rewards to a swap pool.

func (Keeper) GetSynchronizedEarnClaim added in v0.19.0

func (k Keeper) GetSynchronizedEarnClaim(ctx sdk.Context, owner sdk.AccAddress) (types.EarnClaim, bool)

GetSynchronizedEarnClaim fetches a earn claim from the store and syncs rewards for all rewarded vaults.

func (Keeper) GetSynchronizedSavingsClaim added in v0.17.0

func (k Keeper) GetSynchronizedSavingsClaim(ctx sdk.Context, owner sdk.AccAddress) (types.SavingsClaim, bool)

GetSynchronizedSavingsClaim fetches a savings claim from the store and syncs rewards for all rewarded pools.

func (Keeper) GetSynchronizedSwapClaim added in v0.15.0

func (k Keeper) GetSynchronizedSwapClaim(ctx sdk.Context, owner sdk.AccAddress) (types.SwapClaim, bool)

GetSynchronizedSwapClaim fetches a swap claim from the store and syncs rewards for all rewarded pools.

func (Keeper) GetTotalDelegated added in v0.15.0

func (k Keeper) GetTotalDelegated(ctx sdk.Context, delegator sdk.AccAddress, valAddr sdk.ValAddress, shouldIncludeValidator bool) sdk.Dec

func (Keeper) GetUSDXMintingClaim added in v0.13.0

func (k Keeper) GetUSDXMintingClaim(ctx sdk.Context, addr sdk.AccAddress) (types.USDXMintingClaim, bool)

GetUSDXMintingClaim returns the claim in the store corresponding the the input address collateral type and id and a boolean for if the claim was found

func (Keeper) GetUSDXMintingRewardFactor added in v0.13.0

func (k Keeper) GetUSDXMintingRewardFactor(ctx sdk.Context, ctype string) (factor sdk.Dec, found bool)

GetUSDXMintingRewardFactor returns the current reward factor for an individual collateral type

func (Keeper) GetUSDXMintingRewardPeriod added in v0.13.0

func (k Keeper) GetUSDXMintingRewardPeriod(ctx sdk.Context, collateralType string) (types.RewardPeriod, bool)

GetUSDXMintingRewardPeriod returns the reward period with the specified collateral type if it's found in the params

func (Keeper) Hooks added in v0.13.0

func (k Keeper) Hooks() Hooks

Hooks create new incentive hooks

func (Keeper) InitializeDelegatorReward added in v0.15.0

func (k Keeper) InitializeDelegatorReward(ctx sdk.Context, delegator sdk.AccAddress)

InitializeDelegatorReward initializes the reward index of a delegator claim

func (Keeper) InitializeEarnReward added in v0.19.0

func (k Keeper) InitializeEarnReward(ctx sdk.Context, vaultDenom string, owner sdk.AccAddress)

InitializeEarnReward creates a new claim with zero rewards and indexes matching the global indexes. If the claim already exists it just updates the indexes.

func (Keeper) InitializeHardBorrowReward added in v0.13.0

func (k Keeper) InitializeHardBorrowReward(ctx sdk.Context, borrow hardtypes.Borrow)

InitializeHardBorrowReward initializes the borrow-side of a hard liquidity provider claim by creating the claim and setting the borrow reward factor index

func (Keeper) InitializeHardSupplyReward added in v0.13.0

func (k Keeper) InitializeHardSupplyReward(ctx sdk.Context, deposit hardtypes.Deposit)

InitializeHardSupplyReward initializes the supply-side of a hard liquidity provider claim by creating the claim and setting the supply reward factor index

func (Keeper) InitializeSavingsReward added in v0.17.0

func (k Keeper) InitializeSavingsReward(ctx sdk.Context, deposit savingstypes.Deposit)

InitializeSavingsReward initializes a savings claim by creating the claim and setting the reward factor indexes

func (Keeper) InitializeSwapReward added in v0.15.0

func (k Keeper) InitializeSwapReward(ctx sdk.Context, poolID string, owner sdk.AccAddress)

InitializeSwapReward creates a new claim with zero rewards and indexes matching the global indexes. If the claim already exists it just updates the indexes.

func (Keeper) InitializeUSDXMintingClaim added in v0.13.0

func (k Keeper) InitializeUSDXMintingClaim(ctx sdk.Context, cdp cdptypes.CDP)

InitializeUSDXMintingClaim creates or updates a claim such that no new rewards are accrued, but any existing rewards are not lost. this function should be called after a cdp is created. If a user previously had a cdp, then closed it, they shouldn't accrue rewards during the period the cdp was closed. By setting the reward factor to the current global reward factor, any unclaimed rewards are preserved, but no new rewards are added.

func (Keeper) IterateDelegatorClaims added in v0.15.0

func (k Keeper) IterateDelegatorClaims(ctx sdk.Context, cb func(c types.DelegatorClaim) (stop bool))

IterateDelegatorClaims iterates over all claim objects in the store and preforms a callback function

func (Keeper) IterateDelegatorRewardAccrualTimes added in v0.15.0

func (k Keeper) IterateDelegatorRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool))

func (Keeper) IterateDelegatorRewardIndexes added in v0.15.0

func (k Keeper) IterateDelegatorRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool))

IterateDelegatorRewardIndexes iterates over all delegator reward index objects in the store and preforms a callback function

func (Keeper) IterateEarnClaims added in v0.19.0

func (k Keeper) IterateEarnClaims(ctx sdk.Context, cb func(c types.EarnClaim) (stop bool))

IterateEarnClaims iterates over all claim objects in the store and preforms a callback function

func (Keeper) IterateEarnRewardAccrualTimes added in v0.19.0

func (k Keeper) IterateEarnRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool))

func (Keeper) IterateEarnRewardIndexes added in v0.19.0

func (k Keeper) IterateEarnRewardIndexes(ctx sdk.Context, cb func(vaultDenom string, indexes types.RewardIndexes) (stop bool))

IterateEarnRewardIndexes iterates over all earn reward index objects in the store and preforms a callback function

func (Keeper) IterateHardBorrowRewardAccrualTimes added in v0.14.3

func (k Keeper) IterateHardBorrowRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool))

func (Keeper) IterateHardBorrowRewardIndexes added in v0.14.1

func (k Keeper) IterateHardBorrowRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool))

IterateHardBorrowRewardIndexes iterates over all Hard borrow reward index objects in the store and preforms a callback function

func (Keeper) IterateHardLiquidityProviderClaims added in v0.13.0

func (k Keeper) IterateHardLiquidityProviderClaims(ctx sdk.Context, cb func(c types.HardLiquidityProviderClaim) (stop bool))

IterateHardLiquidityProviderClaims iterates over all claim objects in the store and preforms a callback function

func (Keeper) IterateHardSupplyRewardAccrualTimes added in v0.14.3

func (k Keeper) IterateHardSupplyRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool))

func (Keeper) IterateHardSupplyRewardIndexes added in v0.14.1

func (k Keeper) IterateHardSupplyRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool))

IterateHardSupplyRewardIndexes iterates over all Hard supply reward index objects in the store and preforms a callback function

func (Keeper) IterateSavingsClaims added in v0.17.0

func (k Keeper) IterateSavingsClaims(ctx sdk.Context, cb func(c types.SavingsClaim) (stop bool))

IterateSavingsClaims iterates over all savings claim objects in the store and preforms a callback function

func (Keeper) IterateSavingsRewardAccrualTimes added in v0.17.0

func (k Keeper) IterateSavingsRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool))

IterateSavingsRewardAccrualTimesiterates over all the previous savings reward accrual times in the store

func (Keeper) IterateSavingsRewardIndexes added in v0.17.0

func (k Keeper) IterateSavingsRewardIndexes(ctx sdk.Context, cb func(poolID string, indexes types.RewardIndexes) (stop bool))

IterateSavingsRewardIndexes iterates over all savings reward index objects in the store and preforms a callback function

func (Keeper) IterateSwapClaims added in v0.15.0

func (k Keeper) IterateSwapClaims(ctx sdk.Context, cb func(c types.SwapClaim) (stop bool))

IterateSwapClaims iterates over all claim objects in the store and preforms a callback function

func (Keeper) IterateSwapRewardAccrualTimes added in v0.15.0

func (k Keeper) IterateSwapRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool))

func (Keeper) IterateSwapRewardIndexes added in v0.15.0

func (k Keeper) IterateSwapRewardIndexes(ctx sdk.Context, cb func(poolID string, indexes types.RewardIndexes) (stop bool))

IterateSwapRewardIndexes iterates over all swap reward index objects in the store and preforms a callback function

func (Keeper) IterateUSDXMintingAccrualTimes added in v0.13.0

func (k Keeper) IterateUSDXMintingAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool))

IterateUSDXMintingAccrualTimes iterates over all previous USDX minting accrual times and preforms a callback function

func (Keeper) IterateUSDXMintingClaims added in v0.13.0

func (k Keeper) IterateUSDXMintingClaims(ctx sdk.Context, cb func(c types.USDXMintingClaim) (stop bool))

IterateUSDXMintingClaims iterates over all claim objects in the store and preforms a callback function

func (Keeper) IterateUSDXMintingRewardFactors added in v0.14.1

func (k Keeper) IterateUSDXMintingRewardFactors(ctx sdk.Context, cb func(denom string, factor sdk.Dec) (stop bool))

IterateUSDXMintingRewardFactors iterates over all USDX Minting reward factor objects in the store and preforms a callback function

func (Keeper) SendTimeLockedCoinsToAccount

func (k Keeper) SendTimeLockedCoinsToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, length int64) error

SendTimeLockedCoinsToAccount sends time-locked coins from the input module account to the recipient. If the recipients account is not a vesting account and the input length is greater than zero, the recipient account is converted to a periodic vesting account and the coins are added to the vesting balance as a vesting period with the input length.

func (Keeper) SendTimeLockedCoinsToBaseAccount

func (k Keeper) SendTimeLockedCoinsToBaseAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, length int64) error

SendTimeLockedCoinsToBaseAccount sends time-locked coins from the input module account to the recipient, converting the recipient account to a vesting account

func (Keeper) SendTimeLockedCoinsToPeriodicVestingAccount

func (k Keeper) SendTimeLockedCoinsToPeriodicVestingAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, length int64) error

SendTimeLockedCoinsToPeriodicVestingAccount sends time-locked coins from the input module account to the recipient

func (Keeper) SetDelegatorClaim added in v0.15.0

func (k Keeper) SetDelegatorClaim(ctx sdk.Context, c types.DelegatorClaim)

SetDelegatorClaim sets the claim in the store corresponding to the input address, collateral type, and id

func (Keeper) SetDelegatorRewardIndexes added in v0.15.0

func (k Keeper) SetDelegatorRewardIndexes(ctx sdk.Context, denom string, indexes types.RewardIndexes)

SetDelegatorRewardIndexes sets the current reward indexes for an individual denom

func (Keeper) SetEarnClaim added in v0.19.0

func (k Keeper) SetEarnClaim(ctx sdk.Context, c types.EarnClaim)

SetEarnClaim sets the claim in the store corresponding to the input address.

func (Keeper) SetEarnRewardAccrualTime added in v0.19.0

func (k Keeper) SetEarnRewardAccrualTime(ctx sdk.Context, vaultDenom string, blockTime time.Time)

SetEarnRewardAccrualTime stores the last time rewards were accrued for a earn vault.

func (Keeper) SetEarnRewardIndexes added in v0.19.0

func (k Keeper) SetEarnRewardIndexes(ctx sdk.Context, vaultDenom string, indexes types.RewardIndexes)

SetEarnRewardIndexes stores the global reward indexes that track total rewards to a earn vault.

func (Keeper) SetHardBorrowRewardIndexes added in v0.13.0

func (k Keeper) SetHardBorrowRewardIndexes(ctx sdk.Context, denom string, indexes types.RewardIndexes)

SetHardBorrowRewardIndexes sets the current reward indexes for an individual denom

func (Keeper) SetHardLiquidityProviderClaim added in v0.13.0

func (k Keeper) SetHardLiquidityProviderClaim(ctx sdk.Context, c types.HardLiquidityProviderClaim)

SetHardLiquidityProviderClaim sets the claim in the store corresponding to the input address, collateral type, and id

func (Keeper) SetHardSupplyRewardIndexes added in v0.13.0

func (k Keeper) SetHardSupplyRewardIndexes(ctx sdk.Context, denom string, indexes types.RewardIndexes)

SetHardSupplyRewardIndexes sets the current reward indexes for an individual denom

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets params on the store

func (Keeper) SetPreviousDelegatorRewardAccrualTime added in v0.15.0

func (k Keeper) SetPreviousDelegatorRewardAccrualTime(ctx sdk.Context, denom string, blockTime time.Time)

SetPreviousDelegatorRewardAccrualTime sets the last time a denom accrued protocol delegator rewards

func (Keeper) SetPreviousHardBorrowRewardAccrualTime added in v0.13.0

func (k Keeper) SetPreviousHardBorrowRewardAccrualTime(ctx sdk.Context, denom string, blockTime time.Time)

SetPreviousHardBorrowRewardAccrualTime sets the last time a denom accrued Hard protocol borrow-side rewards

func (Keeper) SetPreviousHardSupplyRewardAccrualTime added in v0.13.0

func (k Keeper) SetPreviousHardSupplyRewardAccrualTime(ctx sdk.Context, denom string, blockTime time.Time)

SetPreviousHardSupplyRewardAccrualTime sets the last time a denom accrued Hard protocol supply-side rewards

func (Keeper) SetPreviousUSDXMintingAccrualTime added in v0.13.0

func (k Keeper) SetPreviousUSDXMintingAccrualTime(ctx sdk.Context, ctype string, blockTime time.Time)

SetPreviousUSDXMintingAccrualTime sets the last time a collateral type accrued USDX minting rewards

func (Keeper) SetSavingsClaim added in v0.17.0

func (k Keeper) SetSavingsClaim(ctx sdk.Context, c types.SavingsClaim)

SetSavingsClaim sets the claim in the store corresponding to the input address.

func (Keeper) SetSavingsRewardAccrualTime added in v0.17.0

func (k Keeper) SetSavingsRewardAccrualTime(ctx sdk.Context, poolID string, blockTime time.Time)

SetSavingsRewardAccrualTime stores the last time rewards were accrued for a savings deposit denom type

func (Keeper) SetSavingsRewardIndexes added in v0.17.0

func (k Keeper) SetSavingsRewardIndexes(ctx sdk.Context, denom string, indexes types.RewardIndexes)

SetSavingsRewardIndexes stores the global reward indexes that rewards for an individual denom type

func (Keeper) SetSwapClaim added in v0.15.0

func (k Keeper) SetSwapClaim(ctx sdk.Context, c types.SwapClaim)

SetSwapClaim sets the claim in the store corresponding to the input address.

func (Keeper) SetSwapRewardAccrualTime added in v0.15.0

func (k Keeper) SetSwapRewardAccrualTime(ctx sdk.Context, poolID string, blockTime time.Time)

SetSwapRewardAccrualTime stores the last time rewards were accrued for a swap pool.

func (Keeper) SetSwapRewardIndexes added in v0.15.0

func (k Keeper) SetSwapRewardIndexes(ctx sdk.Context, poolID string, indexes types.RewardIndexes)

SetSwapRewardIndexes stores the global reward indexes that track total rewards to a swap pool.

func (Keeper) SetUSDXMintingClaim added in v0.13.0

func (k Keeper) SetUSDXMintingClaim(ctx sdk.Context, c types.USDXMintingClaim)

SetUSDXMintingClaim sets the claim in the store corresponding to the input address, collateral type, and id

func (Keeper) SetUSDXMintingRewardFactor added in v0.13.0

func (k Keeper) SetUSDXMintingRewardFactor(ctx sdk.Context, ctype string, factor sdk.Dec)

SetUSDXMintingRewardFactor sets the current reward factor for an individual collateral type

func (Keeper) SimulateDelegatorSynchronization added in v0.15.0

func (k Keeper) SimulateDelegatorSynchronization(ctx sdk.Context, claim types.DelegatorClaim) types.DelegatorClaim

SimulateDelegatorSynchronization calculates a user's outstanding delegator rewards by simulating reward synchronization

func (Keeper) SimulateHardSynchronization added in v0.13.0

func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiquidityProviderClaim) types.HardLiquidityProviderClaim

SimulateHardSynchronization calculates a user's outstanding hard rewards by simulating reward synchronization

func (Keeper) SimulateUSDXMintingSynchronization added in v0.13.0

func (k Keeper) SimulateUSDXMintingSynchronization(ctx sdk.Context, claim types.USDXMintingClaim) types.USDXMintingClaim

SimulateUSDXMintingSynchronization calculates a user's outstanding USDX minting rewards by simulating reward synchronization

func (Keeper) SynchronizeDelegatorClaim added in v0.15.0

func (k Keeper) SynchronizeDelegatorClaim(ctx sdk.Context, claim types.DelegatorClaim) (types.DelegatorClaim, error)

SynchronizeDelegatorClaim is a wrapper around SynchronizeDelegatorRewards that returns the synced claim

func (Keeper) SynchronizeDelegatorRewards added in v0.15.0

func (k Keeper) SynchronizeDelegatorRewards(ctx sdk.Context, delegator sdk.AccAddress, valAddr sdk.ValAddress, shouldIncludeValidator bool)

SynchronizeDelegatorRewards updates the claim object by adding any accumulated rewards, and setting the reward indexes to the global values. valAddr and shouldIncludeValidator are used to ignore or include delegations to a particular validator when summing up the total delegation. Normally only delegations to Bonded validators are included in the total. This is needed as staking hooks are sometimes called on the wrong side of a validator's state update (from this module's perspective).

func (Keeper) SynchronizeEarnReward added in v0.19.0

func (k Keeper) SynchronizeEarnReward(
	ctx sdk.Context,
	vaultDenom string,
	owner sdk.AccAddress,
	shares sdk.Dec,
)

SynchronizeEarnReward updates the claim object by adding any accumulated rewards and updating the reward index value.

func (Keeper) SynchronizeHardBorrowReward added in v0.13.0

func (k Keeper) SynchronizeHardBorrowReward(ctx sdk.Context, borrow hardtypes.Borrow)

SynchronizeHardBorrowReward updates the claim object by adding any accumulated rewards and updating the reward index value

func (Keeper) SynchronizeHardLiquidityProviderClaim added in v0.13.0

func (k Keeper) SynchronizeHardLiquidityProviderClaim(ctx sdk.Context, owner sdk.AccAddress)

SynchronizeHardLiquidityProviderClaim adds any accumulated rewards

func (Keeper) SynchronizeHardSupplyReward added in v0.13.0

func (k Keeper) SynchronizeHardSupplyReward(ctx sdk.Context, deposit hardtypes.Deposit)

SynchronizeHardSupplyReward updates the claim object by adding any accumulated rewards and updating the reward index value

func (Keeper) SynchronizeSavingsClaim added in v0.17.0

func (k Keeper) SynchronizeSavingsClaim(ctx sdk.Context, owner sdk.AccAddress)

SynchronizeSavingsClaim syncs a savings reward claim from its store

func (Keeper) SynchronizeSavingsReward added in v0.17.0

func (k Keeper) SynchronizeSavingsReward(ctx sdk.Context, deposit savingstypes.Deposit, incomingDenoms []string)

SynchronizeSavingsReward updates the claim object by adding any accumulated rewards and updating the reward index value

func (Keeper) SynchronizeSwapReward added in v0.15.0

func (k Keeper) SynchronizeSwapReward(ctx sdk.Context, poolID string, owner sdk.AccAddress, shares sdk.Int)

SynchronizeSwapReward updates the claim object by adding any accumulated rewards and updating the reward index value.

func (Keeper) SynchronizeUSDXMintingClaim added in v0.13.0

func (k Keeper) SynchronizeUSDXMintingClaim(ctx sdk.Context, claim types.USDXMintingClaim) (types.USDXMintingClaim, error)

SynchronizeUSDXMintingClaim updates the claim object by adding any rewards that have accumulated. Returns the updated claim object

func (Keeper) SynchronizeUSDXMintingReward added in v0.13.0

func (k Keeper) SynchronizeUSDXMintingReward(ctx sdk.Context, cdp cdptypes.CDP)

SynchronizeUSDXMintingReward updates the claim object by adding any accumulated rewards and updating the reward index value. this should be called before a cdp is modified.

func (Keeper) UpdateHardBorrowIndexDenoms added in v0.13.0

func (k Keeper) UpdateHardBorrowIndexDenoms(ctx sdk.Context, borrow hardtypes.Borrow)

UpdateHardBorrowIndexDenoms adds or removes reward indexes from a claim to match the denoms in the borrow.

func (Keeper) UpdateHardSupplyIndexDenoms added in v0.13.0

func (k Keeper) UpdateHardSupplyIndexDenoms(ctx sdk.Context, deposit hardtypes.Deposit)

UpdateHardSupplyIndexDenoms adds any new deposit denoms to the claim's supply reward index

func (Keeper) ZeroUSDXMintingClaim added in v0.13.0

func (k Keeper) ZeroUSDXMintingClaim(ctx sdk.Context, claim types.USDXMintingClaim) types.USDXMintingClaim

ZeroUSDXMintingClaim zeroes out the claim object's rewards and returns the updated claim object

type Migrator added in v0.19.0

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v0.19.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v0.19.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

Jump to

Keyboard shortcuts

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