keeper

package
v0.0.0-...-6cf2bb1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the savings module

func DepositsInvariant

func DepositsInvariant(k Keeper) sdk.Invariant

DepositsInvariant iterates all deposits and asserts that they are valid

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the savings MsgServer interface for the provided Keeper.

func NewQueryServerImpl

func NewQueryServerImpl(k Keeper) types.QueryServer

NewQueryServerImpl creates a new server for handling gRPC queries.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the savings module invariants

func SolvencyInvariant

func SolvencyInvariant(k Keeper) sdk.Invariant

SolvencyInvariant iterates all deposits and ensures the total amount matches the module account coins

Types

type Keeper

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

Keeper struct for savings module

func NewKeeper

func NewKeeper(
	cdc codec.Codec, key sdk.StoreKey, paramstore paramtypes.Subspace,
	ak types.AccountKeeper, bk types.BankKeeper, lk types.LiquidKeeper,
) Keeper

NewKeeper returns a new keeper for the savings module.

func (Keeper) AfterSavingsDepositCreated

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

AfterSavingsDepositCreated - call hook if registered

func (Keeper) BeforeSavingsDepositModified

func (k Keeper) BeforeSavingsDepositModified(ctx sdk.Context, deposit types.Deposit, incomingDenoms []string)

BeforeSavingsDepositModified - call hook if registered

func (Keeper) CalculateWithdrawAmount

func (k Keeper) CalculateWithdrawAmount(available sdk.Coins, request sdk.Coins) (sdk.Coins, error)

CalculateWithdrawAmount enables full withdraw of deposited coins by adjusting withdraw amount to equal total deposit amount if the requested withdraw amount > current deposit amount

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, coins sdk.Coins) error

Deposit deposit

func (Keeper) GetAllDeposits

func (k Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits)

GetAllDeposits returns all Deposits from the store

func (Keeper) GetDeposit

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

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

func (Keeper) GetParams

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

GetParams returns the params from the store

func (Keeper) GetSavingsModuleAccountBalances

func (k Keeper) GetSavingsModuleAccountBalances(ctx sdk.Context) sdk.Coins

GetSavingsModuleAccountBalances returns the savings module account balances

func (Keeper) GetTotalDeposited

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

GetTotalDeposited returns the total amount deposited for the deposit denom

func (Keeper) IsDenomSupported

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

IsDenomSupported returns a boolean indicating if a denom is supported

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) Logger

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

Logger returns a module-specific logger.

func (Keeper) SetDeposit

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

SetDeposit sets the input deposit in the store

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(hooks types.MultiSavingsHooks) *Keeper

SetHooks adds hooks to the keeper.

func (Keeper) SetParams

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

SetParams sets params on the store

func (Keeper) ValidateDeposit

func (k Keeper) ValidateDeposit(ctx sdk.Context, coins sdk.Coins) error

ValidateDeposit validates a deposit

func (Keeper) Withdraw

func (k Keeper) Withdraw(ctx sdk.Context, depositor sdk.AccAddress, coins sdk.Coins) 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