keeper

package
v12.0.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQueryServiceServer

func NewQueryServiceServer(k Keeper) types.QueryServiceServer

Types

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey) Keeper

func (*Keeper) Add

func (k *Keeper) Add(ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) error

Add is a utility function to add coins to a deposit by transferring from the account to the deposit.

func (*Keeper) GetDeposit

func (k *Keeper) GetDeposit(ctx sdk.Context, addr sdk.AccAddress) (deposit types.Deposit, found bool)

GetDeposit retrieves a deposit from the module's KVStore based on the account address. If the deposit exists, it returns the deposit and 'found' as true; otherwise, it returns 'found' as false.

func (*Keeper) GetDeposits

func (k *Keeper) GetDeposits(ctx sdk.Context) (items types.Deposits)

GetDeposits retrieves all deposits stored in the module's KVStore.

func (*Keeper) IterateDeposits

func (k *Keeper) IterateDeposits(ctx sdk.Context, fn func(index int, item types.Deposit) (stop bool))

IterateDeposits iterates over all deposits stored in the module's KVStore and calls the provided function for each deposit. The iteration stops when the provided function returns 'true'.

func (*Keeper) Logger

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

func (*Keeper) SendCoinsFromAccountToDeposit

func (k *Keeper) SendCoinsFromAccountToDeposit(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, coins sdk.Coins) error

SendCoinsFromAccountToDeposit transfers coins from an account to a deposit and updates the deposit in the KVStore. If the deposit does not exist, a new deposit will be created. It returns an error if the account doesn't have enough balance.

func (*Keeper) SendCoinsFromDepositToAccount

func (k *Keeper) SendCoinsFromDepositToAccount(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, coins sdk.Coins) error

SendCoinsFromDepositToAccount transfers coins from a deposit to an account and updates the deposit in the KVStore. It returns an error if the deposit doesn't have enough balance.

func (*Keeper) SendCoinsFromDepositToModule

func (k *Keeper) SendCoinsFromDepositToModule(ctx sdk.Context, fromAddr sdk.AccAddress, toModule string, coins sdk.Coins) error

SendCoinsFromDepositToModule transfers coins from a deposit to a module and updates the deposit in the KVStore. It returns an error if the deposit doesn't have enough balance.

func (*Keeper) SetDeposit

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

SetDeposit stores a deposit in the module's KVStore.

func (*Keeper) Store

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

func (*Keeper) Subtract

func (k *Keeper) Subtract(ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) error

Subtract is a utility function to subtract coins from a deposit by transferring from the deposit to the account.

func (*Keeper) WithBankKeeper

func (k *Keeper) WithBankKeeper(keeper expected.BankKeeper)

Jump to

Keyboard shortcuts

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