keeper

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

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
)

Variables

This section is empty.

Functions

func CalculateTimeElapsed added in v0.2.0

func CalculateTimeElapsed(start, end, blockTime time.Time, previousAccrualTime time.Time) sdk.Int

CalculateTimeElapsed calculates the number of reward-eligible seconds that have passed since the previous time rewards were accrued, taking into account the end time of the reward period

func NewQuerier

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

Types

type Hooks added in v0.2.0

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

Hooks wrapper struct for hooks

func (Hooks) AfterCdpCreated added in v0.3.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.2.0

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

AfterDelegationModified runs after a delegation is modified

func (Hooks) AfterValidatorBeginUnbonding added in v0.2.0

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

AfterValidatorBeginUnbonding is called after a validator begins unbonding

func (Hooks) AfterValidatorBonded added in v0.2.0

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

AfterValidatorBonded is called after a validator is bonded

func (Hooks) AfterValidatorCreated added in v0.2.0

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

AfterValidatorCreated runs after a validator is created

func (Hooks) AfterValidatorRemoved added in v0.2.0

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

AfterValidatorRemoved runs after a validator is removed

func (Hooks) BeforeCdpModified added in v0.3.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.2.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.2.0

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

BeforeDelegationRemoved runs directly before a delegation is deleted

func (Hooks) BeforeDelegationSharesModified added in v0.2.0

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

BeforeDelegationSharesModified runs before an existing delegation is modified

func (Hooks) BeforeValidatorModified added in v0.2.0

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

BeforeValidatorModified runs before a validator is modified

func (Hooks) BeforeValidatorSlashed added in v0.2.0

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

BeforeValidatorSlashed is called before a validator is slashed

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.Marshaler, storeKey, memKey sdk.StoreKey,
	paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	cdpKeeper types.CdpKeeper) Keeper

func (Keeper) AccumulateEurxMintingRewards added in v0.3.0

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

AccumulateEurxMintingRewards updates the rewards accumulated for the input reward period

func (Keeper) ClaimEurxMintingReward added in v0.3.0

func (k Keeper) ClaimEurxMintingReward(ctx sdk.Context, addr sdk.AccAddress, multiplierName string) error

ClaimEurxMintingReward sends the reward amount to the input address and zero's out the claim in the store

func (Keeper) DeleteEurxMintingClaim added in v0.3.0

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

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

func (Keeper) GetAllEurxMintingClaims added in v0.3.0

func (k Keeper) GetAllEurxMintingClaims(ctx sdk.Context) types.EurxMintingClaims

GetAllEurxMintingClaims returns all Claim objects in the store

func (Keeper) GetClaimEnd added in v0.2.0

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

GetClaimEnd returns the claim end time for the params

func (Keeper) GetEurxMintingClaim added in v0.3.0

func (k Keeper) GetEurxMintingClaim(ctx sdk.Context, addr sdk.AccAddress) (types.EurxMintingClaim, bool)

GetEurxMintingClaim 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) GetEurxMintingRewardFactor added in v0.3.0

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

GetEurxMintingRewardFactor returns the current reward factor for an individual collateral type

func (Keeper) GetEurxMintingRewardPeriod added in v0.3.0

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

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

func (Keeper) GetMultiplier added in v0.2.0

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

GetMultiplier returns the multiplier with the specified name if it's found in the params

func (Keeper) GetParams

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

func (Keeper) GetPeriodLength added in v0.2.0

func (k Keeper) GetPeriodLength(ctx sdk.Context, multiplier types.Multiplier) (int64, error)

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

func (Keeper) GetPreviousEurxMintingAccrualTime added in v0.3.0

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

GetPreviousEurxMintingAccrualTime returns the last time a collateral type accrued Eurx minting rewards

func (Keeper) Hooks added in v0.2.0

func (k Keeper) Hooks() Hooks

Hooks create new incentive hooks

func (Keeper) InitializeEurxMintingClaim added in v0.3.0

func (k Keeper) InitializeEurxMintingClaim(ctx sdk.Context, cdp cdptypes.Cdp)

InitializeEurxMintingClaim 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) IterateEurxMintingAccrualTimes added in v0.3.0

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

IterateEurxMintingAccrualTimes iterates over all previous Eurx minting accrual times and preforms a callback function

func (Keeper) IterateEurxMintingClaims added in v0.3.0

func (k Keeper) IterateEurxMintingClaims(ctx sdk.Context, cb func(c types.EurxMintingClaim) (stop bool))

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

func (Keeper) Logger added in v0.2.0

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) Params added in v0.2.0

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) SetEurxMintingClaim added in v0.3.0

func (k Keeper) SetEurxMintingClaim(ctx sdk.Context, c types.EurxMintingClaim)

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

func (Keeper) SetEurxMintingRewardFactor added in v0.3.0

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

SetEurxMintingRewardFactor sets the current reward factor for an individual collateral type

func (Keeper) SetParams

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

func (Keeper) SetPreviousEurxMintingAccrualTime added in v0.3.0

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

SetPreviousEurxMintingAccrualTime sets the last time a collateral type accrued Eurx minting rewards

func (Keeper) SimulateEurxMintingSynchronization added in v0.3.0

func (k Keeper) SimulateEurxMintingSynchronization(ctx sdk.Context, claim types.EurxMintingClaim) types.EurxMintingClaim

SimulateEurxMintingSynchronization calculates a user's outstanding Eurx minting rewards by simulating reward synchronization

func (Keeper) SynchronizeEurxMintingClaim added in v0.3.0

func (k Keeper) SynchronizeEurxMintingClaim(ctx sdk.Context, claim types.EurxMintingClaim) (types.EurxMintingClaim, error)

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

func (Keeper) SynchronizeEurxMintingReward added in v0.3.0

func (k Keeper) SynchronizeEurxMintingReward(ctx sdk.Context, cdp cdptypes.Cdp)

SynchronizeEurxMintingReward updates the claim object by adding any accumulated rewards and updating the reward index value. this should be called before a cdp is modified, immediately after the 'SynchronizeInterest' method is called in the cdp module

func (Keeper) ZeroEurxMintingClaim added in v0.3.0

func (k Keeper) ZeroEurxMintingClaim(ctx sdk.Context, claim types.EurxMintingClaim) types.EurxMintingClaim

ZeroEurxMintingClaim 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