keeper

package
v0.17.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RewardTypeJinx        = "jinx"
	RewardTypeUSDFMinting = "usdf_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,
	totalBfurySupply sdkmath.Int,
	singleBfurySupply 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 jinxtypes.Borrow)

AfterBorrowCreated function that runs after a borrow is created

func (Hooks) AfterBorrowModified

func (h Hooks) AfterBorrowModified(ctx sdk.Context, borrow jinxtypes.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 jinxtypes.Deposit)

AfterDepositCreated function that runs after a deposit is created

func (Hooks) AfterDepositModified

func (h Hooks) AfterDepositModified(ctx sdk.Context, deposit jinxtypes.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 jinxtypes.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 jinxtypes.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) AccumulateJinxBorrowRewards

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

AccumulateJinxBorrowRewards 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) AccumulateJinxSupplyRewards

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

AccumulateJinxSupplyRewards 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) AccumulateUSDFMintingRewards

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

AccumulateUSDFMintingRewards 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 jinx borrowed btc amount) between two index values.

oldIndex is normally the index stored on a claim, newIndex the current global value, and sourceShares a jinx 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) ClaimJinxReward

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

ClaimJinxReward 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) ClaimUSDFMintingReward

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

ClaimUSDFMintingReward 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) DeleteJinxLiquidityProviderClaim

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

DeleteJinxLiquidityProviderClaim 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) DeleteUSDFMintingClaim

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

DeleteUSDFMintingClaim 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) GetAllJinxLiquidityProviderClaims

func (k Keeper) GetAllJinxLiquidityProviderClaims(ctx sdk.Context) types.JinxLiquidityProviderClaims

GetAllJinxLiquidityProviderClaims 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) GetAllUSDFMintingClaims

func (k Keeper) GetAllUSDFMintingClaims(ctx sdk.Context) types.USDFMintingClaims

GetAllUSDFMintingClaims 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) GetJinxBorrowRewardIndexes

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

GetJinxBorrowRewardIndexes gets the current reward indexes for an individual denom

func (Keeper) GetJinxBorrowRewardPeriods

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

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

func (Keeper) GetJinxLiquidityProviderClaim

func (k Keeper) GetJinxLiquidityProviderClaim(ctx sdk.Context, addr sdk.AccAddress) (types.JinxLiquidityProviderClaim, bool)

GetJinxLiquidityProviderClaim 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) GetJinxSupplyRewardIndexes

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

GetJinxSupplyRewardIndexes gets the current reward indexes for an individual denom

func (Keeper) GetJinxSupplyRewardPeriods

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

GetJinxSupplyRewardPeriods 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) GetPreviousJinxBorrowRewardAccrualTime

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

GetPreviousJinxBorrowRewardAccrualTime returns the last time a denom accrued Jinx protocol borrow-side rewards

func (Keeper) GetPreviousJinxSupplyRewardAccrualTime

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

GetPreviousJinxSupplyRewardAccrualTime returns the last time a denom accrued Jinx protocol supply-side rewards

func (Keeper) GetPreviousUSDFMintingAccrualTime

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

GetPreviousUSDFMintingAccrualTime returns the last time a collateral type accrued USDF 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) GetUSDFMintingClaim

func (k Keeper) GetUSDFMintingClaim(ctx sdk.Context, addr sdk.AccAddress) (types.USDFMintingClaim, bool)

GetUSDFMintingClaim 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) GetUSDFMintingRewardFactor

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

GetUSDFMintingRewardFactor returns the current reward factor for an individual collateral type

func (Keeper) GetUSDFMintingRewardPeriod

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

GetUSDFMintingRewardPeriod 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) InitializeJinxBorrowReward

func (k Keeper) InitializeJinxBorrowReward(ctx sdk.Context, borrow jinxtypes.Borrow)

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

func (Keeper) InitializeJinxSupplyReward

func (k Keeper) InitializeJinxSupplyReward(ctx sdk.Context, deposit jinxtypes.Deposit)

InitializeJinxSupplyReward initializes the supply-side of a jinx 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) InitializeUSDFMintingClaim

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

InitializeUSDFMintingClaim 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) IterateJinxBorrowRewardAccrualTimes

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

func (Keeper) IterateJinxBorrowRewardIndexes

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

IterateJinxBorrowRewardIndexes iterates over all Jinx borrow reward index objects in the store and preforms a callback function

func (Keeper) IterateJinxLiquidityProviderClaims

func (k Keeper) IterateJinxLiquidityProviderClaims(ctx sdk.Context, cb func(c types.JinxLiquidityProviderClaim) (stop bool))

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

func (Keeper) IterateJinxSupplyRewardAccrualTimes

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

func (Keeper) IterateJinxSupplyRewardIndexes

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

IterateJinxSupplyRewardIndexes iterates over all Jinx 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) IterateUSDFMintingAccrualTimes

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

IterateUSDFMintingAccrualTimes iterates over all previous USDF minting accrual times and preforms a callback function

func (Keeper) IterateUSDFMintingClaims

func (k Keeper) IterateUSDFMintingClaims(ctx sdk.Context, cb func(c types.USDFMintingClaim) (stop bool))

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

func (Keeper) IterateUSDFMintingRewardFactors

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

IterateUSDFMintingRewardFactors iterates over all USDF 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) SetJinxBorrowRewardIndexes

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

SetJinxBorrowRewardIndexes sets the current reward indexes for an individual denom

func (Keeper) SetJinxLiquidityProviderClaim

func (k Keeper) SetJinxLiquidityProviderClaim(ctx sdk.Context, c types.JinxLiquidityProviderClaim)

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

func (Keeper) SetJinxSupplyRewardIndexes

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

SetJinxSupplyRewardIndexes 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) SetPreviousJinxBorrowRewardAccrualTime

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

SetPreviousJinxBorrowRewardAccrualTime sets the last time a denom accrued Jinx protocol borrow-side rewards

func (Keeper) SetPreviousJinxSupplyRewardAccrualTime

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

SetPreviousJinxSupplyRewardAccrualTime sets the last time a denom accrued Jinx protocol supply-side rewards

func (Keeper) SetPreviousUSDFMintingAccrualTime

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

SetPreviousUSDFMintingAccrualTime sets the last time a collateral type accrued USDF 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) SetUSDFMintingClaim

func (k Keeper) SetUSDFMintingClaim(ctx sdk.Context, c types.USDFMintingClaim)

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

func (Keeper) SetUSDFMintingRewardFactor

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

SetUSDFMintingRewardFactor 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) SimulateJinxSynchronization

func (k Keeper) SimulateJinxSynchronization(ctx sdk.Context, claim types.JinxLiquidityProviderClaim) types.JinxLiquidityProviderClaim

SimulateJinxSynchronization calculates a user's outstanding jinx rewards by simulating reward synchronization

func (Keeper) SimulateUSDFMintingSynchronization

func (k Keeper) SimulateUSDFMintingSynchronization(ctx sdk.Context, claim types.USDFMintingClaim) types.USDFMintingClaim

SimulateUSDFMintingSynchronization calculates a user's outstanding USDF 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) SynchronizeJinxBorrowReward

func (k Keeper) SynchronizeJinxBorrowReward(ctx sdk.Context, borrow jinxtypes.Borrow)

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

func (Keeper) SynchronizeJinxLiquidityProviderClaim

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

SynchronizeJinxLiquidityProviderClaim adds any accumulated rewards

func (Keeper) SynchronizeJinxSupplyReward

func (k Keeper) SynchronizeJinxSupplyReward(ctx sdk.Context, deposit jinxtypes.Deposit)

SynchronizeJinxSupplyReward 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) SynchronizeUSDFMintingClaim

func (k Keeper) SynchronizeUSDFMintingClaim(ctx sdk.Context, claim types.USDFMintingClaim) (types.USDFMintingClaim, error)

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

func (Keeper) SynchronizeUSDFMintingReward

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

SynchronizeUSDFMintingReward 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) UpdateJinxBorrowIndexDenoms

func (k Keeper) UpdateJinxBorrowIndexDenoms(ctx sdk.Context, borrow jinxtypes.Borrow)

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

func (Keeper) UpdateJinxSupplyIndexDenoms

func (k Keeper) UpdateJinxSupplyIndexDenoms(ctx sdk.Context, deposit jinxtypes.Deposit)

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

func (Keeper) ZeroUSDFMintingClaim

func (k Keeper) ZeroUSDFMintingClaim(ctx sdk.Context, claim types.USDFMintingClaim) types.USDFMintingClaim

ZeroUSDFMintingClaim 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