keeper

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) incentive.MsgServer

NewMsgServerImpl returns an implementation of MsgServer for the x/incentive module.

func RegisterInvariants

func RegisterInvariants(_ sdk.InvariantRegistry, _ Keeper)

RegisterInvariants registers empty incentive module invariants

Types

type BondHooks

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

BondHooks defines a structure around the x/incentive Keeper that implements various BondHooks interface defined by other modules such as x/leverage.

func (BondHooks) ForceUnbondTo

func (h BondHooks) ForceUnbondTo(ctx sdk.Context, addr sdk.AccAddress, uToken sdk.Coin) error

ForceUnbondTo instantly unbonds uTokens until an account's bonded amount of a given uToken is no greater than a certain amount.

func (BondHooks) GetBonded

func (h BondHooks) GetBonded(ctx sdk.Context, addr sdk.AccAddress, uDenom string) sdkmath.Int

GetBonded gets sum of bonded and unbonding uTokens of a given denom for an account.

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey storetypes.StoreKey,
	bk incentive.BankKeeper,
	lk incentive.LeverageKeeper,
) Keeper

func (Keeper) BondHooks

func (k Keeper) BondHooks() BondHooks

BondHooks returns a new Hooks instance that wraps the x/incentive keeper.

func (Keeper) BondSummary

func (k Keeper) BondSummary(ctx sdk.Context, addr sdk.AccAddress, denom string) (
	bonded sdk.Coin, unbonding sdk.Coin, unbondings []incentive.Unbonding,
)

BondSummary gets the total bonded and unbonding for a given account, as well as a list of ongoing unbondings, for a single uToken denom. It ignores completed unbondings without actually clearing those unbondings in state, so it is safe for use by queries and any parts of Msg functions which are not intended to alter state.

func (Keeper) EndBlock

func (k Keeper) EndBlock(ctx sdk.Context) (skipped bool, err error)

EndBlock updates incentive programs and reward accumulators, then sets LastRewardTime to the current block time. Also protects against negative time elapsed (without causing chain halt). In addition to regular error, returns a boolean indicating whether the main logic was skipped due to a blockTime issue. These situations are accompanied by error logs.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *incentive.GenesisState

ExportGenesis returns the x/incentive module's exported genesis state.

func (Keeper) GetBonded

func (k Keeper) GetBonded(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin

GetBonded retrieves the amount of uTokens of a given denom which are bonded by an account

func (Keeper) GetLastRewardsTime

func (k Keeper) GetLastRewardsTime(ctx sdk.Context) int64

getLastRewardsTime gets the last unix time incentive rewards were computed globally by EndBlocker. panics if it would return a negative value.

func (Keeper) GetParams

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

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, gs incentive.GenesisState)

InitGenesis initializes the x/incentive module state from a provided genesis state.

func (Keeper) KVStore

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

KVStore returns the module's KVStore

func (Keeper) Logger

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

func (Keeper) ModuleBalance

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

ModuleBalance returns the amount of a given token held in the x/incentive module account

func (Keeper) UpdateAccount

func (k Keeper) UpdateAccount(ctx sdk.Context, addr sdk.AccAddress) (sdk.Coins, error)

UpdateAccount finishes any unbondings associated with an account which have ended and claims any pending rewards. It returns the amount of rewards claimed.

Unlike updateRewards and updatePrograms, this function is not called during EndBlock.

REQUIREMENT: This function must be called during any message or hook which creates an unbonding or updates bonded amounts. Leverage hooks which decrease borrower collateral must also call this before acting. This ensures that between any two consecutive claims by a single account, bonded amounts were constant on that account for each collateral uToken denom.

type Querier

type Querier struct {
	Keeper
}

Querier implements a QueryServer for the x/incentive module.

func NewQuerier

func NewQuerier(k Keeper) Querier

func (Querier) AccountBonds

func (Querier) ActualRates

func (Querier) CurrentRates

func (Querier) Params

func (Querier) TotalBonded

Jump to

Keyboard shortcuts

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