Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- func ErrInvalidInput(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidOutput(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrNoInputs(codespace sdk.CodespaceType) sdk.Error
- func ErrNoOutputs(codespace sdk.CodespaceType) sdk.Error
- func ModuleInvariants(t *testing.T, app *mock.App, log string)
- func NewHandler(k Keeper) sdk.Handler
- func NonnegativeBalanceInvariant(t *testing.T, app *mock.App, log string)
- func RegisterWire(cdc *wire.Codec)
- func TestAndRunSingleInputMsgSend(t *testing.T, r *rand.Rand, app *mock.App, ctx sdk.Context, ...) (action string, err sdk.Error)
- func TotalCoinsInvariant(t *testing.T, app *mock.App, log string)
- type Input
- type Keeper
- func (keeper Keeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- func (keeper Keeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper Keeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- func (keeper Keeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
- func (keeper Keeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- func (keeper Keeper) SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error
- func (keeper Keeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- type MsgIssue
- type MsgSend
- type Output
- type SendKeeper
- func (keeper SendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper SendKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- func (keeper SendKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
- func (keeper SendKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- type ViewKeeper
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = 2 CodeInvalidInput sdk.CodeType = 101 CodeInvalidOutput sdk.CodeType = 102 )
Bank errors reserve 100 ~ 199.
Variables ¶
This section is empty.
Functions ¶
func ErrInvalidInput ¶
func ErrInvalidInput(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidOutput ¶
func ErrInvalidOutput(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrNoInputs ¶
func ErrNoInputs(codespace sdk.CodespaceType) sdk.Error
func ErrNoOutputs ¶
func ErrNoOutputs(codespace sdk.CodespaceType) sdk.Error
func ModuleInvariants ¶
ModuleInvariants runs all invariants of the bank module. Currently runs non-negative balance invariant and TotalCoinsInvariant
func NewHandler ¶
NewHandler returns a handler for "bank" type messages.
func NonnegativeBalanceInvariant ¶
NonnegativeBalanceInvariant checks that all accounts in the application have non-negative balances
func TestAndRunSingleInputMsgSend ¶
func TestAndRunSingleInputMsgSend(t *testing.T, r *rand.Rand, app *mock.App, ctx sdk.Context, keys []crypto.PrivKey, log string) (action string, err sdk.Error)
TestAndRunSingleInputMsgSend tests and runs a single msg send, with one input and one output, where both accounts already exist.
Types ¶
type Input ¶
type Input struct { Address sdk.AccAddress `json:"address"` Coins sdk.Coins `json:"coins"` }
Transaction Input
func NewInput ¶
func NewInput(addr sdk.AccAddress, coins sdk.Coins) Input
NewInput - create a transaction input, used with MsgSend
func (Input) ValidateBasic ¶
ValidateBasic - validate transaction input
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper manages transfers between accounts
func (Keeper) AddCoins ¶
func (keeper Keeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
AddCoins adds amt to the coins at the addr.
func (Keeper) InputOutputCoins ¶
func (keeper Keeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
InputOutputCoins handles a list of inputs and outputs
func (Keeper) SendCoins ¶
func (keeper Keeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
SendCoins moves coins from one account to another
type MsgIssue ¶
type MsgIssue struct { Banker sdk.AccAddress `json:"banker"` Outputs []Output `json:"outputs"` }
MsgIssue - high level transaction of the coin module
func NewMsgIssue ¶
func NewMsgIssue(banker sdk.AccAddress, out []Output) MsgIssue
NewMsgIssue - construct arbitrary multi-in, multi-out send msg.
type MsgSend ¶
MsgSend - high level transaction of the coin module
func NewMsgSend ¶
NewMsgSend - construct arbitrary multi-in, multi-out send msg.
type Output ¶
type Output struct { Address sdk.AccAddress `json:"address"` Coins sdk.Coins `json:"coins"` }
Transaction Output
func NewOutput ¶
func NewOutput(addr sdk.AccAddress, coins sdk.Coins) Output
NewOutput - create a transaction output, used with MsgSend
func (Output) GetSignBytes ¶
Return bytes to sign for Output
func (Output) ValidateBasic ¶
ValidateBasic - validate transaction output
type SendKeeper ¶
type SendKeeper struct {
// contains filtered or unexported fields
}
SendKeeper only allows transfers between accounts, without the possibility of creating coins
func NewSendKeeper ¶
func NewSendKeeper(am auth.AccountMapper) SendKeeper
NewSendKeeper returns a new Keeper
func (SendKeeper) GetCoins ¶
func (keeper SendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (SendKeeper) HasCoins ¶
func (keeper SendKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
HasCoins returns whether or not an account has at least amt coins.
func (SendKeeper) InputOutputCoins ¶
func (keeper SendKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
InputOutputCoins handles a list of inputs and outputs
func (SendKeeper) SendCoins ¶
func (keeper SendKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
SendCoins moves coins from one account to another
type ViewKeeper ¶
type ViewKeeper struct {
// contains filtered or unexported fields
}
ViewKeeper only allows reading of balances
func NewViewKeeper ¶
func NewViewKeeper(am auth.AccountMapper) ViewKeeper
NewViewKeeper returns a new Keeper
func (ViewKeeper) GetCoins ¶
func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (ViewKeeper) HasCoins ¶
func (keeper ViewKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
HasCoins returns whether or not an account has at least amt coins.