keeper

package
v12.0.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

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

func NewKeeper

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

func (*Keeper) AddDeposit

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

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

func (*Keeper) ExportGenesis

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

func (*Keeper) GetDeposit

func (k *Keeper) GetDeposit(ctx sdk.Context, addr sdk.AccAddress) (deposit v1.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 v1.Deposits)

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

func (*Keeper) HandleQueryDeposit

func (k *Keeper) HandleQueryDeposit(ctx sdk.Context, req *v1.QueryDepositRequest) (*v1.QueryDepositResponse, error)

func (*Keeper) HandleQueryDeposits

func (k *Keeper) HandleQueryDeposits(ctx sdk.Context, req *v1.QueryDepositsRequest) (*v1.QueryDepositsResponse, error)

func (*Keeper) InitGenesis

func (k *Keeper) InitGenesis(ctx sdk.Context, state *v1.GenesisState)

func (*Keeper) IterateDeposits

func (k *Keeper) IterateDeposits(ctx sdk.Context, fn func(index int, item v1.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) SendCoinsFromAccountToModule

func (k *Keeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error

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

func (k *Keeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error

func (*Keeper) SendCoinsFromModuleToModule

func (k *Keeper) SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error

func (*Keeper) SetDeposit

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

SetDeposit stores a deposit in the module's KVStore.

func (*Keeper) Store

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

func (*Keeper) SubtractDeposit

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

SubtractDeposit 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