keeper

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLiquidToken

func IsLiquidToken(denom string) bool

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func UnmarshalBalanceCompat

func UnmarshalBalanceCompat(cdc codec.BinaryCodec, bz []byte, denom string) (sdk.Coin, error)

UnmarshalBalanceCompat unmarshal balance amount from storage, it's backward-compatible with the legacy format.

Types

type BaseKeeper

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

BaseKeeper manages transfers between accounts. It implements the Keeper interface.

func NewBaseKeeper

func NewBaseKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	authority string,
) BaseKeeper

func (BaseKeeper) AllBalances

AllBalances implements the Query/AllBalances gRPC method

func (BaseKeeper) Balance

Balance implements the Query/Balance gRPC method

func (BaseKeeper) ExportGenesis

func (k BaseKeeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the bank module's genesis state.

func (BaseKeeper) Fund

func (k BaseKeeper) Fund(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error

Fund allows an account to directly fund the community fund pool. The amount is first added to the distribution module account and then directly added to the pool. An error is returned if the amount cannot be sent to the module account.

func (BaseKeeper) GetAccountBalances

func (k BaseKeeper) GetAccountBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

func (BaseKeeper) GetAccountsBalances

func (k BaseKeeper) GetAccountsBalances(ctx sdk.Context) []types.Balance

GetAccountsBalances returns all the accounts balances from the store.

func (BaseKeeper) GetBalance

func (k BaseKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin

GetBalance returns the balance of a specific denomination for a given account by address.

func (BaseKeeper) GetPaginatedAccountsBalances added in v1.8.2

func (k BaseKeeper) GetPaginatedAccountsBalances(ctx sdk.Context, pagination *query.PageRequest) ([]types.Balance, *query.PageResponse, error)

GetPaginatedAccountsBalances returns all the accounts balances from the store paginated by accounts.

func (BaseKeeper) GetPaginatedTotalBalance

func (k BaseKeeper) GetPaginatedTotalBalance(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error)

GetPaginatedTotalBalance queries for the supply, ignoring 0 coins, with a given pagination

func (BaseKeeper) GetParams

func (k BaseKeeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of dao parameters.

func (BaseKeeper) GetTotalBalance

func (k BaseKeeper) GetTotalBalance(ctx sdk.Context) sdk.Coins

GetTotalBalance get the global total balance of dao module

func (BaseKeeper) GetTotalBalanceOf

func (k BaseKeeper) GetTotalBalanceOf(ctx sdk.Context, denom string) sdk.Coin

GetTotalBalanceOf retrieves the total balance of certain coin from store

func (BaseKeeper) HasBalance

func (k BaseKeeper) HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool

HasBalance returns whether or not an account has at least amt balance.

func (BaseKeeper) HasTotalBalanceOf

func (k BaseKeeper) HasTotalBalanceOf(ctx sdk.Context, denom string) bool

HasTotalBalanceOf checks if the supply coin exists in store.

func (BaseKeeper) Holders added in v1.8.2

func (BaseKeeper) InitGenesis

func (k BaseKeeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState)

InitGenesis initializes the bank module's state from a given genesis state.

func (BaseKeeper) IsModuleEnabled

func (k BaseKeeper) IsModuleEnabled(ctx sdk.Context) bool

func (BaseKeeper) IterateAccountBalances

func (k BaseKeeper) IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(sdk.Coin) bool)

IterateAccountBalances iterates over the balances of a single account and provides the token balance to a callback. If true is returned from the callback, iteration is halted.

func (BaseKeeper) IterateAllBalances

func (k BaseKeeper) IterateAllBalances(ctx sdk.Context, cb func(sdk.AccAddress, sdk.Coin) bool)

IterateAllBalances iterates over all the balances of all accounts and denominations that are provided to a callback. If true is returned from the callback, iteration is halted.

func (BaseKeeper) IterateTotalBalance

func (k BaseKeeper) IterateTotalBalance(ctx sdk.Context, cb func(sdk.Coin) bool)

IterateTotalBalance iterates over the total balance calling the given cb (callback) function with the balance of each coin. The iteration stops if the callback returns true.

func (BaseKeeper) Logger

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

Logger returns a module-specific logger.

func (BaseKeeper) Params

Params implements the gRPC service handler for querying x/bank parameters.

func (BaseKeeper) SetParams

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

SetParams sets the total set of dao parameters.

func (BaseKeeper) TotalBalance

TotalBalance implements the Query/TotalSupply gRPC method

func (BaseKeeper) TransferOwnership

func (k BaseKeeper) TransferOwnership(ctx sdk.Context, owner, newOwner sdk.AccAddress, amount sdk.Coins) (sdk.Coins, error)

type Keeper

type Keeper interface {
	GetTotalBalance(ctx sdk.Context) sdk.Coins
	GetPaginatedTotalBalance(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error)
	IterateTotalBalance(ctx sdk.Context, cb func(sdk.Coin) bool)
	GetTotalBalanceOf(ctx sdk.Context, denom string) sdk.Coin
	HasTotalBalanceOf(ctx sdk.Context, denom string) bool

	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
	HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool
	IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(sdk.Coin) bool)
	GetAccountBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	IterateAllBalances(ctx sdk.Context, cb func(sdk.AccAddress, sdk.Coin) bool)
	GetAccountsBalances(ctx sdk.Context) []types.Balance

	Fund(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
	TransferOwnership(ctx sdk.Context, owner, newOwner sdk.AccAddress, amount sdk.Coins) (sdk.Coins, error)

	// grpc query endpoints
	Balance(ctx context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error)
	AllBalances(ctx context.Context, req *types.QueryAllBalancesRequest) (*types.QueryAllBalancesResponse, error)
	TotalBalance(ctx context.Context, req *types.QueryTotalBalanceRequest) (*types.QueryTotalBalanceResponse, error)
	Holders(ctx context.Context, req *types.QueryHoldersRequest) (*types.QueryHoldersResponse, error)
	Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)

	// genesis methods
	InitGenesis(ctx sdk.Context, genState *types.GenesisState)
	ExportGenesis(ctx sdk.Context) *types.GenesisState
}

Keeper defines a module interface that facilitates the transfer of coins between accounts.

Jump to

Keyboard shortcuts

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