keeper

package
v0.12.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 17 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 NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier is the module level router for state queries

Types

type Keeper

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

Keeper keeper for the harvest module

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramstore subspace.Subspace, ak types.AccountKeeper, sk types.SupplyKeeper, stk types.StakingKeeper) Keeper

NewKeeper creates a new keeper

func (Keeper) AddToClaim

func (k Keeper) AddToClaim(ctx sdk.Context, owner sdk.AccAddress, depositDenom string, depositType types.DepositType, amountToAdd sdk.Coin)

AddToClaim adds the input amount to an existing claim or creates a new one

func (Keeper) ApplyDelegationRewards

func (k Keeper) ApplyDelegationRewards(ctx sdk.Context, denom string)

ApplyDelegationRewards iterates over each delegation object in the staking store and applies rewards according to the input delegation distribution schedule

func (Keeper) ApplyDepositRewards

func (k Keeper) ApplyDepositRewards(ctx sdk.Context)

ApplyDepositRewards iterates over lp and gov deposits and updates the amount of rewards for each depositor

func (Keeper) BondDenom

func (k Keeper) BondDenom(ctx sdk.Context) string

BondDenom returns the bond denom from the staking keeper

func (Keeper) ClaimReward

func (k Keeper) ClaimReward(ctx sdk.Context, claimHolder sdk.AccAddress, receiver sdk.AccAddress, depositDenom string, depositType types.DepositType, multiplier types.MultiplierName) error

ClaimReward sends the reward amount to the reward owner and deletes the claim from the store

func (Keeper) DeleteClaim

func (k Keeper) DeleteClaim(ctx sdk.Context, claim types.Claim)

DeleteClaim deletes a claim from the store

func (Keeper) DeleteDeposit

func (k Keeper) DeleteDeposit(ctx sdk.Context, deposit types.Deposit)

DeleteDeposit deletes a deposit from the store

func (Keeper) Deposit

func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, amount sdk.Coin, depositType types.DepositType) error

Deposit deposit

func (Keeper) GetClaim

func (k Keeper) GetClaim(ctx sdk.Context, owner sdk.AccAddress, depositDenom string, depositType types.DepositType) (types.Claim, bool)

GetClaim returns a claim from the store for a particular claim owner, deposit denom, and deposit type

func (Keeper) GetDelegatorSchedule

func (k Keeper) GetDelegatorSchedule(ctx sdk.Context, denom string) (types.DelegatorDistributionSchedule, bool)

func (Keeper) GetDeposit

func (k Keeper) GetDeposit(ctx sdk.Context, depositor sdk.AccAddress, denom string, depositType types.DepositType) (types.Deposit, bool)

GetDeposit returns a deposit from the store for a particular depositor address, deposit denom, and deposit type

func (Keeper) GetLPSchedule

func (k Keeper) GetLPSchedule(ctx sdk.Context, denom string) (types.DistributionSchedule, bool)

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(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) GetPreviousBlockTime

func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time, found bool)

GetPreviousBlockTime get the blocktime for the previous block

func (Keeper) GetPreviousDelegatorDistribution

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

GetPreviousDelegatorDistribution get the time of the previous delegator distribution

func (Keeper) GetTotalDeposited

func (k Keeper) GetTotalDeposited(ctx sdk.Context, depositType types.DepositType, depositDenom string) (total sdk.Int)

GetTotalDeposited returns the total amount deposited for the input deposit type and deposit denom

func (Keeper) IterateClaims

func (k Keeper) IterateClaims(ctx sdk.Context, cb func(claim types.Claim) (stop bool))

IterateClaims iterates over all claim objects in the store and performs a callback function

func (Keeper) IterateClaimsByTypeAndDenom

func (k Keeper) IterateClaimsByTypeAndDenom(ctx sdk.Context, depositType types.DepositType, depositDenom string, cb func(claim types.Claim) (stop bool))

IterateClaimsByTypeAndDenom iterates over all claim objects in the store with the matching deposit type and deposit denom and performs a callback function

func (Keeper) IterateDeposits

func (k Keeper) IterateDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool))

IterateDeposits iterates over all deposit objects in the store and performs a callback function

func (Keeper) IterateDepositsByTypeAndDenom

func (k Keeper) IterateDepositsByTypeAndDenom(ctx sdk.Context, depositType types.DepositType, depositDenom string, cb func(deposit types.Deposit) (stop bool))

IterateDepositsByTypeAndDenom iterates over all deposit objects in the store with the matching deposit type and deposit denom and performs 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) SetClaim

func (k Keeper) SetClaim(ctx sdk.Context, claim types.Claim)

SetClaim stores the input claim in the store, prefixed by the deposit type, deposit denom, and owner address, in that order

func (Keeper) SetDeposit

func (k Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit)

SetDeposit sets the input deposit in the store, prefixed by the deposit type, deposit denom, and depositor address, in that order

func (Keeper) SetParams

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

SetParams sets params on the store

func (Keeper) SetPreviousBlockTime

func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time)

SetPreviousBlockTime set the time of the previous block

func (Keeper) SetPreviousDelegationDistribution

func (k Keeper) SetPreviousDelegationDistribution(ctx sdk.Context, distTime time.Time, denom string)

SetPreviousDelegationDistribution set the time of the previous delegator distribution

func (Keeper) ShouldDistributeValidatorRewards

func (k Keeper) ShouldDistributeValidatorRewards(ctx sdk.Context, denom string) bool

ShouldDistributeValidatorRewards returns true if enough time has elapsed such that rewards should be distributed to delegators

func (Keeper) ValidateDeposit

func (k Keeper) ValidateDeposit(ctx sdk.Context, amount sdk.Coin, depositType types.DepositType) error

ValidateDeposit validates a deposit

func (Keeper) ValidateLPDeposit

func (k Keeper) ValidateLPDeposit(ctx sdk.Context, amount sdk.Coin, depositType types.DepositType) error

ValidateLPDeposit validates that a liquidity provider deposit

func (Keeper) Withdraw

func (k Keeper) Withdraw(ctx sdk.Context, depositor sdk.AccAddress, amount sdk.Coin, depositType types.DepositType) error

Withdraw returns some or all of a deposit back to original depositor

Jump to

Keyboard shortcuts

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