Documentation
¶
Index ¶
- Constants
- Variables
- func ErrInputOutputMismatch() error
- func ErrNoInputs() error
- func ErrNoOutputs() error
- func NewHandler(bank BankKeeper) bankHandler
- func NonnegativeBalanceInvariant(acck auth.AccountKeeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, acck auth.AccountKeeper)
- func ValidateGenesis(data GenesisState) error
- func ValidateInputsOutputs(inputs []Input, outputs []Output) error
- type BankKeeper
- func (bank BankKeeper) AddCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error)
- func (bank BankKeeper) ExportGenesis(ctx sdk.Context) GenesisState
- func (bank BankKeeper) GetParams(ctx sdk.Context) Params
- func (bank BankKeeper) InitGenesis(ctx sdk.Context, data GenesisState)
- func (bank BankKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) error
- func (bank BankKeeper) RestrictedDenoms(ctx sdk.Context) []string
- func (bank BankKeeper) SendCoins(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error
- func (bank BankKeeper) SendCoinsUnrestricted(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error
- func (bank BankKeeper) SetCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) error
- func (bank BankKeeper) SetParams(ctx sdk.Context, params Params) error
- func (bank BankKeeper) SetRestrictedDenoms(ctx sdk.Context, restrictedDenoms []string)
- func (bank BankKeeper) SubtractCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error)
- func (bank BankKeeper) WillSetParam(ctx sdk.Context, key string, value any)
- func (bank BankKeeper) WillSetRestrictedDenoms(ctx sdk.Context, restrictedDenoms []string)
- type BankKeeperI
- type BankParamsContextKey
- type GenesisState
- type Input
- type InputOutputMismatchError
- type MsgMultiSend
- type MsgSend
- type NoInputsError
- type NoOutputsError
- type Output
- type Params
- type ViewKeeper
- type ViewKeeperI
Constants ¶
const (
ModuleName = "bank"
)
const QueryBalance = "balances"
query balance path
const RouterKey = ModuleName
RouterKey is they name of the bank module
Variables ¶
var Package = amino.RegisterPackage(amino.NewPackage( "github.com/gnolang/gno/tm2/pkg/sdk/bank", "bank", amino.GetCallersDirname(), ).WithDependencies().WithTypes( NoInputsError{}, "NoInputsError", NoOutputsError{}, "NoOutputsError", InputOutputMismatchError{}, "InputOutputMismatchError", MsgSend{}, "MsgSend", ))
Functions ¶
func ErrInputOutputMismatch ¶
func ErrInputOutputMismatch() error
func ErrNoInputs ¶
func ErrNoInputs() error
func ErrNoOutputs ¶
func ErrNoOutputs() error
func NewHandler ¶
func NewHandler(bank BankKeeper) bankHandler
NewHandler returns a handler for "bank" type messages.
func NonnegativeBalanceInvariant ¶
func NonnegativeBalanceInvariant(acck auth.AccountKeeper) sdk.Invariant
NonnegativeBalanceInvariant checks that all accounts in the application have non-negative balances
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, acck auth.AccountKeeper)
RegisterInvariants registers the bank module invariants
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis performs basic validation of genesis data returning an error for any failed validation criteria.
func ValidateInputsOutputs ¶
ValidateInputsOutputs validates that each respective input and output is valid and that the sum of inputs is equal to the sum of outputs.
Types ¶
type BankKeeper ¶
type BankKeeper struct { ViewKeeper // contains filtered or unexported fields }
BankKeeper only allows transfers between accounts without the possibility of creating coins. It implements the BankKeeperI interface.
func NewBankKeeper ¶
func NewBankKeeper(acck auth.AccountKeeper, pk params.ParamsKeeperI) BankKeeper
NewBankKeeper returns a new BankKeeper.
func (BankKeeper) AddCoins ¶
func (bank BankKeeper) AddCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error)
AddCoins adds amt to the coins at the addr.
func (BankKeeper) ExportGenesis ¶
func (bank BankKeeper) ExportGenesis(ctx sdk.Context) GenesisState
ExportGenesis returns a GenesisState for a given context and keeper
func (BankKeeper) InitGenesis ¶
func (bank BankKeeper) InitGenesis(ctx sdk.Context, data GenesisState)
InitGenesis - Init store state from genesis data
func (BankKeeper) InputOutputCoins ¶
InputOutputCoins handles a list of inputs and outputs
func (BankKeeper) RestrictedDenoms ¶
func (bank BankKeeper) RestrictedDenoms(ctx sdk.Context) []string
func (BankKeeper) SendCoins ¶
func (bank BankKeeper) SendCoins(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error
SendCoins moves coins from one account to another, restrction could be applied
func (BankKeeper) SendCoinsUnrestricted ¶
func (bank BankKeeper) SendCoinsUnrestricted(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error
SendCoinsUnrestricted is used for paying gas.
func (BankKeeper) SetParams ¶
func (bank BankKeeper) SetParams(ctx sdk.Context, params Params) error
func (BankKeeper) SetRestrictedDenoms ¶
func (bank BankKeeper) SetRestrictedDenoms(ctx sdk.Context, restrictedDenoms []string)
This is a convenience function for manually setting the restricted denoms. Useful for testing and initchain setup. The ParamKeeper will call WillSetRestrictedDenoms() before writing.
func (BankKeeper) SubtractCoins ¶
func (bank BankKeeper) SubtractCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error)
SubtractCoins subtracts amt from the coins at the addr.
CONTRACT: If the account is a vesting account, the amount has to be spendable.
func (BankKeeper) WillSetParam ¶
func (bank BankKeeper) WillSetParam(ctx sdk.Context, key string, value any)
func (BankKeeper) WillSetRestrictedDenoms ¶
func (bank BankKeeper) WillSetRestrictedDenoms(ctx sdk.Context, restrictedDenoms []string)
This will get called whenever the restricted denoms parameter is changed.
type BankKeeperI ¶
type BankKeeperI interface { ViewKeeperI InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) error SendCoins(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error SubtractCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error) AddCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error) SetCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) error SendCoinsUnrestricted(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error InitGenesis(ctx sdk.Context, data GenesisState) GetParams(ctx sdk.Context) Params }
bank.Keeper defines a module interface that facilitates the transfer of coins between accounts without the possibility of creating coins.
type BankParamsContextKey ¶
type BankParamsContextKey struct{}
type GenesisState ¶
type GenesisState struct {
Params Params `json:"params" yaml:"params"`
}
GenesisState - all state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState - Return a default genesis state
func NewGenesisState ¶
func NewGenesisState(params Params) GenesisState
NewGenesisState - Create a new genesis state
type Input ¶
type Input struct { Address crypto.Address `json:"address" yaml:"address"` Coins std.Coins `json:"coins" yaml:"coins"` }
Input models transaction input
func (Input) ValidateBasic ¶
ValidateBasic - validate transaction input
type InputOutputMismatchError ¶
type InputOutputMismatchError struct {
// contains filtered or unexported fields
}
func (InputOutputMismatchError) AssertABCIError ¶
func (InputOutputMismatchError) AssertABCIError()
func (InputOutputMismatchError) Error ¶
func (e InputOutputMismatchError) Error() string
type MsgMultiSend ¶
type MsgMultiSend struct { Inputs []Input `json:"inputs" yaml:"inputs"` Outputs []Output `json:"outputs" yaml:"outputs"` }
MsgMultiSend - high level transaction of the coin module
func NewMsgMultiSend ¶
func NewMsgMultiSend(in []Input, out []Output) MsgMultiSend
NewMsgMultiSend - construct arbitrary multi-in, multi-out send msg.
func (MsgMultiSend) GetSignBytes ¶
func (msg MsgMultiSend) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgMultiSend) GetSigners ¶
func (msg MsgMultiSend) GetSigners() []crypto.Address
GetSigners Implements Msg.
func (MsgMultiSend) ValidateBasic ¶
func (msg MsgMultiSend) ValidateBasic() error
ValidateBasic Implements Msg.
type MsgSend ¶
type MsgSend struct { FromAddress crypto.Address `json:"from_address" yaml:"from_address"` ToAddress crypto.Address `json:"to_address" yaml:"to_address"` Amount std.Coins `json:"amount" yaml:"amount"` }
MsgSend - high level transaction of the coin module
func NewMsgSend ¶
NewMsgSend - construct arbitrary multi-in, multi-out send msg.
func (MsgSend) GetSigners ¶
GetSigners Implements Msg.
func (MsgSend) ValidateBasic ¶
ValidateBasic Implements Msg.
type NoInputsError ¶
type NoInputsError struct {
// contains filtered or unexported fields
}
declare all bank errors. NOTE: these are meant to be used in conjunction with pkgs/errors.
func (NoInputsError) AssertABCIError ¶
func (NoInputsError) AssertABCIError()
func (NoInputsError) Error ¶
func (e NoInputsError) Error() string
type NoOutputsError ¶
type NoOutputsError struct {
// contains filtered or unexported fields
}
func (NoOutputsError) AssertABCIError ¶
func (NoOutputsError) AssertABCIError()
func (NoOutputsError) Error ¶
func (e NoOutputsError) Error() string
type Output ¶
type Output struct { Address crypto.Address `json:"address" yaml:"address"` Coins std.Coins `json:"coins" yaml:"coins"` }
Output models transaction outputs
func (Output) ValidateBasic ¶
ValidateBasic - validate transaction output
type Params ¶
type Params struct {
RestrictedDenoms []string `json:"restricted_denoms" yaml:"restricted_denoms"`
}
Params defines the parameters for the bank module.
type ViewKeeper ¶
type ViewKeeper struct {
// contains filtered or unexported fields
}
ViewKeeper implements a read only keeper implementation of ViewKeeperI.
func NewViewKeeper ¶
func NewViewKeeper(acck auth.AccountKeeper) ViewKeeper
NewViewKeeper returns a new ViewKeeper.