keeper

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RewardTypeHard        = "hard"
	RewardTypeUSDXMinting = "usdx_minting"
	RewardTypeDelegator   = "delegator"
	RewardTypeSwap        = "swap"
	RewardTypeSavings     = "savings"
	RewardTypeEarn        = "earn"
)
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

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

GetAPYFromMultiRewardPeriod calculates the APY for a given MultiRewardPeriod

func GetProportionalRewardsPerSecond

func GetProportionalRewardsPerSecond(
	rewardPeriod types.MultiRewardPeriod,
	totalBnemoSupply sdkmath.Int,
	singleBnemoSupply sdkmath.Int,
) sdk.DecCoins

func GetStakingAPR

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

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

func NewQueryServerImpl

func NewQueryServerImpl(keeper Keeper) types.QueryServer

NewQueryServerImpl creates a new server for handling gRPC queries.

Types

type Hooks

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

Hooks wrapper struct for hooks

func (Hooks) AfterBorrowCreated

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

AfterBorrowCreated function that runs after a borrow is created

func (Hooks) AfterBorrowModified

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

AfterBorrowModified function that runs after a borrow is modified

func (Hooks) AfterCDPCreated

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

AfterCDPCreated function that runs after a cdp is created

func (Hooks) AfterDelegationModified

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

AfterDelegationModified runs after a delegation is modified

func (Hooks) AfterDepositCreated

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

AfterDepositCreated function that runs after a deposit is created

func (Hooks) AfterDepositModified

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

AfterDepositModified function that runs after a deposit is modified

func (Hooks) AfterPoolDepositCreated

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

func (Hooks) AfterSavingsDepositCreated

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

AfterSavingsDepositCreated function that runs after a deposit is created

func (Hooks) AfterValidatorBeginUnbonding

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

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

func (Hooks) AfterValidatorBonded

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

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

func (Hooks) AfterValidatorCreated

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

AfterValidatorCreated runs after a validator is created

func (Hooks) AfterValidatorRemoved

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

AfterValidatorRemoved runs after a validator is removed

func (Hooks) AfterVaultDepositCreated

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

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

BeforeBorrowModified function that runs before a borrow is modified

func (Hooks) BeforeCDPModified

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

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

BeforeDelegationCreated runs before a delegation is created

func (Hooks) BeforeDelegationRemoved

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

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

func (Hooks) BeforeDelegationSharesModified

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

BeforeDelegationSharesModified runs before an existing delegation is modified

func (Hooks) BeforeDepositModified

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

BeforeDepositModified function that runs before a deposit is modified

func (Hooks) BeforePoolDepositModified

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

func (Hooks) BeforeSavingsDepositModified

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

BeforeSavingsDepositModified function that runs before a deposit is modified

func (Hooks) BeforeValidatorModified

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

BeforeValidatorModified runs before a validator is modified

func (Hooks) BeforeValidatorSlashed

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

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

func (Hooks) BeforeVaultDepositModified

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

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

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

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

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

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

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

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

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

func (k Keeper) CalculateSingleReward(oldIndex, newIndex, sourceShares sdk.Dec) (sdkmath.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

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

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

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

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

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

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

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

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

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

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

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

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

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

GetAllDelegatorClaims returns all DelegatorClaim objects in the store

func (Keeper) GetAllEarnClaims

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

GetAllEarnClaims returns all Claim objects in the store

func (Keeper) GetAllHardLiquidityProviderClaims

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

GetAllHardLiquidityProviderClaims returns all Claim objects in the store

func (Keeper) GetAllSavingsClaims

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

GetAllSavingsClaims returns all savings claim objects in the store

func (Keeper) GetAllSwapClaims

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

GetAllSwapClaims returns all Claim objects in the store

func (Keeper) GetAllUSDXMintingClaims

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

GetAllUSDXMintingClaims returns all Claim objects in the store

func (Keeper) GetClaimEnd

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

GetClaimEnd returns the claim end time for the params

func (Keeper) GetDelegatorClaim

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func (Keeper) GetUSDXMintingClaim

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

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

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

func (k Keeper) Hooks() Hooks

Hooks create new incentive hooks

func (Keeper) InitializeDelegatorReward

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

InitializeDelegatorReward initializes the reward index of a delegator claim

func (Keeper) InitializeEarnReward

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

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

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

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

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

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

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

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

func (Keeper) IterateDelegatorRewardIndexes

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

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

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

func (Keeper) IterateEarnRewardIndexes

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

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

func (Keeper) IterateHardBorrowRewardIndexes

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

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

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

func (Keeper) IterateHardSupplyRewardIndexes

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

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

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

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

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

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

func (Keeper) IterateSwapRewardIndexes

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

SynchronizeHardLiquidityProviderClaim adds any accumulated rewards

func (Keeper) SynchronizeHardSupplyReward

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

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

SynchronizeSavingsClaim syncs a savings reward claim from its store

func (Keeper) SynchronizeSavingsReward

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

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

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

func (Keeper) SynchronizeUSDXMintingClaim

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

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

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

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

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

Jump to

Keyboard shortcuts

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