Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- func ErrBurnEmptyCoins(codespace sdk.CodespaceType) sdk.Error
- 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 NewHandler(k Keeper) sdk.Handler
- func NonnegativeBalanceInvariant(mapper auth.AccountKeeper) sdk.Invariant
- func RegisterCodec(cdc *codec.Codec)
- func TotalCoinsInvariant(mapper auth.AccountKeeper, totalSupplyFn func() sdk.Coins) sdk.Invariant
- type BaseKeeper
- func (keeper BaseKeeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) BurnCoinsFromAddr(ctx sdk.Context, fromAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) BurnCoinsFromPool(ctx sdk.Context, pool string, amt sdk.Coins) (sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) DecreaseLoosenToken(ctx sdk.Context, amt sdk.Coins)
- func (keeper BaseKeeper) GetBurnedCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper BaseKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- func (keeper BaseKeeper) IncreaseLoosenToken(ctx sdk.Context, amt sdk.Coins)
- func (keeper BaseKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- type BaseSendKeeper
- func (keeper BaseSendKeeper) GetBurnedCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseSendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper BaseSendKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseSendKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- func (keeper BaseSendKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
- func (keeper BaseSendKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- type BaseViewKeeper
- func (keeper BaseViewKeeper) GetBurnedCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseViewKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper BaseViewKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseViewKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- type Input
- type Keeper
- type MsgBurn
- type MsgIssue
- type MsgSend
- type Output
- type SendKeeper
- type ViewKeeper
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = "bank" CodeInvalidInput sdk.CodeType = 101 CodeInvalidOutput sdk.CodeType = 102 CodeBurnEmptyCoins sdk.CodeType = 103 )
Bank errors reserve 100 ~ 199.
Variables ¶
This section is empty.
Functions ¶
func ErrBurnEmptyCoins ¶ added in v0.10.0
func ErrBurnEmptyCoins(codespace sdk.CodespaceType) sdk.Error
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 NewHandler ¶
NewHandler returns a handler for "bank" type messages.
func NonnegativeBalanceInvariant ¶ added in v0.11.0
func NonnegativeBalanceInvariant(mapper auth.AccountKeeper) sdk.Invariant
NonnegativeBalanceInvariant checks that all accounts in the application have non-negative balances
func TotalCoinsInvariant ¶ added in v0.11.0
TotalCoinsInvariant checks that the sum of the coins across all accounts is what is expected
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(am auth.AccountKeeper) BaseKeeper
NewBaseKeeper returns a new BaseKeeper
func (BaseKeeper) AddCoins ¶
func (keeper BaseKeeper) 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 (BaseKeeper) BurnCoinsFromAddr ¶ added in v0.10.0
func (keeper BaseKeeper) BurnCoinsFromAddr( ctx sdk.Context, fromAddr sdk.AccAddress, amt sdk.Coins, ) (sdk.Tags, sdk.Error)
BurnCoins burns coins from one account
func (BaseKeeper) BurnCoinsFromPool ¶ added in v0.10.0
func (keeper BaseKeeper) BurnCoinsFromPool( ctx sdk.Context, pool string, amt sdk.Coins, ) (sdk.Tags, sdk.Error)
BurnCoins burns coins from one account
func (BaseKeeper) DecreaseLoosenToken ¶ added in v0.10.0
func (keeper BaseKeeper) DecreaseLoosenToken( ctx sdk.Context, amt sdk.Coins)
SendCoins moves coins from one account to another
func (BaseKeeper) GetBurnedCoins ¶ added in v0.10.0
func (keeper BaseKeeper) GetBurnedCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the burned coins
func (BaseKeeper) GetCoins ¶
func (keeper BaseKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (BaseKeeper) GetLoosenCoins ¶ added in v0.10.0
func (keeper BaseKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the total loosen coins
func (BaseKeeper) HasCoins ¶
func (keeper BaseKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
HasCoins returns whether or not an account has at least amt coins.
func (BaseKeeper) IncreaseLoosenToken ¶ added in v0.10.0
func (keeper BaseKeeper) IncreaseLoosenToken( ctx sdk.Context, amt sdk.Coins)
func (BaseKeeper) InputOutputCoins ¶
func (keeper BaseKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
InputOutputCoins handles a list of inputs and outputs
func (BaseKeeper) SendCoins ¶
func (keeper BaseKeeper) 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
func (BaseKeeper) SubtractCoins ¶
func (keeper BaseKeeper) SubtractCoins( ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins, ) (sdk.Coins, sdk.Tags, sdk.Error)
SubtractCoins subtracts amt from the coins at the addr.
type BaseSendKeeper ¶
type BaseSendKeeper struct {
// contains filtered or unexported fields
}
SendKeeper only allows transfers between accounts without the possibility of creating coins. It implements the SendKeeper interface.
func NewBaseSendKeeper ¶
func NewBaseSendKeeper(am auth.AccountKeeper) BaseSendKeeper
NewBaseSendKeeper returns a new BaseSendKeeper.
func (BaseSendKeeper) GetBurnedCoins ¶ added in v0.10.0
func (keeper BaseSendKeeper) GetBurnedCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the burned coins
func (BaseSendKeeper) GetCoins ¶
func (keeper BaseSendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (BaseSendKeeper) GetLoosenCoins ¶ added in v0.10.0
func (keeper BaseSendKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the total loosen coins
func (BaseSendKeeper) HasCoins ¶
func (keeper BaseSendKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
HasCoins returns whether or not an account has at least amt coins.
func (BaseSendKeeper) InputOutputCoins ¶
func (keeper BaseSendKeeper) InputOutputCoins( ctx sdk.Context, inputs []Input, outputs []Output, ) (sdk.Tags, sdk.Error)
InputOutputCoins handles a list of inputs and outputs
func (BaseSendKeeper) SendCoins ¶
func (keeper BaseSendKeeper) 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 BaseViewKeeper ¶
type BaseViewKeeper struct {
// contains filtered or unexported fields
}
BaseViewKeeper implements a read only keeper implementation of ViewKeeper.
func NewBaseViewKeeper ¶
func NewBaseViewKeeper(am auth.AccountKeeper) BaseViewKeeper
NewBaseViewKeeper returns a new BaseViewKeeper.
func (BaseViewKeeper) GetBurnedCoins ¶ added in v0.10.0
func (keeper BaseViewKeeper) GetBurnedCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the burned coins
func (BaseViewKeeper) GetCoins ¶
func (keeper BaseViewKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (BaseViewKeeper) GetLoosenCoins ¶ added in v0.10.0
func (keeper BaseViewKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the total loosen coins
func (BaseViewKeeper) HasCoins ¶
func (keeper BaseViewKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
HasCoins returns whether or not an account has at least amt coins.
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 interface { SendKeeper IncreaseLoosenToken(ctx sdk.Context, amt sdk.Coins) DecreaseLoosenToken(ctx sdk.Context, amt sdk.Coins) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error) BurnCoinsFromAddr(ctx sdk.Context, fromAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error) BurnCoinsFromPool(ctx sdk.Context, pool string, amt sdk.Coins) (sdk.Tags, sdk.Error) }
Keeper defines a module interface that facilitates the transfer of coins between accounts.
type MsgBurn ¶ added in v0.10.0
type MsgBurn struct { Owner sdk.AccAddress `json:"owner"` Coins sdk.Coins `json:"coins"` }
MsgBurn - high level transaction of the coin module
func NewMsgBurn ¶ added in v0.10.0
func NewMsgBurn(owner sdk.AccAddress, coins sdk.Coins) MsgBurn
NewMsgIssue - construct arbitrary multi-in, multi-out send msg.
func (MsgBurn) GetSignBytes ¶ added in v0.10.0
Implements Msg.
func (MsgBurn) GetSigners ¶ added in v0.10.0
func (msg MsgBurn) GetSigners() []sdk.AccAddress
Implements Msg.
func (MsgBurn) ValidateBasic ¶ added in v0.10.0
Implements Msg.
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 interface { ViewKeeper SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error) }
SendKeeper defines a module interface that facilitates the transfer of coins between accounts without the possibility of creating coins.
type ViewKeeper ¶
type ViewKeeper interface { GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins GetLoosenCoins(ctx sdk.Context) sdk.Coins GetBurnedCoins(ctx sdk.Context) sdk.Coins HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool }
ViewKeeper defines a module interface that facilitates read only access to account balances.