Documentation ¶
Overview ¶
nolint
nolint
Index ¶
- Constants
- func ErrBurnEmptyCoins(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidAccount(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidInput(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidMemo(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidMemoRegexp(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 NewAnteHandler(ak auth.AccountKeeper) sdk.AnteHandler
- func NewHandler(k Keeper) sdk.Handler
- func NewQuerier(keeper Keeper, cdc *codec.Codec) sdk.Querier
- 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) BurnCoins(ctx sdk.Context, fromAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) DecreaseLoosenToken(ctx sdk.Context, amt sdk.Coins)
- func (keeper BaseKeeper) DecreaseTotalSupply(ctx sdk.Context, coin sdk.Coin) sdk.Error
- func (keeper BaseKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper BaseKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseKeeper) GetTotalSupplies(ctx sdk.Context) sdk.Iterator
- func (keeper BaseKeeper) GetTotalSupply(ctx sdk.Context, denom string) (coin sdk.Coin, found bool)
- 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) IncreaseTotalSupply(ctx sdk.Context, coin sdk.Coin) sdk.Error
- func (keeper BaseKeeper) Init(ctx sdk.Context)
- 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) SetMemoRegexp(ctx sdk.Context, fromAddr sdk.AccAddress, regexp string) (sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) SetTotalSupply(ctx sdk.Context, totalSupply sdk.Coin)
- func (keeper BaseKeeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- type BaseSendKeeper
- func (keeper BaseSendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper BaseSendKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseSendKeeper) GetTotalSupply(ctx sdk.Context, denom string) (coin sdk.Coin, found bool)
- 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) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper BaseViewKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
- func (keeper BaseViewKeeper) GetTotalSupply(ctx sdk.Context, denom string) (coin sdk.Coin, found bool)
- func (keeper BaseViewKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- type Input
- type Keeper
- type MsgBurn
- type MsgSend
- type MsgSetMemoRegexp
- type Output
- type QueryAccountParams
- type QueryTokenStatsParams
- type SendKeeper
- type TokenStats
- type ViewKeeper
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = "bank" CodeInvalidInput sdk.CodeType = 101 CodeInvalidOutput sdk.CodeType = 102 CodeBurnEmptyCoins sdk.CodeType = 103 CodeInvalidMemo sdk.CodeType = 104 CodeInvalidMemoRegexp sdk.CodeType = 105 CodeInvalidAccount sdk.CodeType = 106 )
Bank errors reserve 100 ~ 199.
const ( QueryAccount = "account" QueryTokenStats = "tokenStats" )
query endpoints supported by the auth Querier
Variables ¶
This section is empty.
Functions ¶
func ErrBurnEmptyCoins ¶
func ErrBurnEmptyCoins(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidAccount ¶
func ErrInvalidAccount(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidInput ¶
func ErrInvalidInput(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidMemo ¶
func ErrInvalidMemo(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidMemoRegexp ¶
func ErrInvalidMemoRegexp(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 NewAnteHandler ¶
func NewAnteHandler(ak auth.AccountKeeper) sdk.AnteHandler
NewAnteHandler returns an AnteHandler that checks if the memo of the tx satisfies the rule set by the recipient
func NewHandler ¶
NewHandler returns a handler for "bank" type messages.
func NewQuerier ¶
creates a querier for auth REST endpoints
func NonnegativeBalanceInvariant ¶
func NonnegativeBalanceInvariant(mapper auth.AccountKeeper) sdk.Invariant
NonnegativeBalanceInvariant checks that all accounts in the application have non-negative balances
func TotalCoinsInvariant ¶
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(cdc *codec.Codec, 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) BurnCoins ¶
func (keeper BaseKeeper) BurnCoins(ctx sdk.Context, fromAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
BurnCoins burns coins from the given account
func (BaseKeeper) DecreaseLoosenToken ¶
func (keeper BaseKeeper) DecreaseLoosenToken( ctx sdk.Context, amt sdk.Coins)
SendCoins moves coins from one account to another
func (BaseKeeper) DecreaseTotalSupply ¶
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 ¶
func (keeper BaseKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the total loosen coins
func (BaseKeeper) GetTotalSupplies ¶
func (keeper BaseKeeper) GetTotalSupplies(ctx sdk.Context) sdk.Iterator
func (BaseKeeper) GetTotalSupply ¶
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 ¶
func (keeper BaseKeeper) IncreaseLoosenToken( ctx sdk.Context, amt sdk.Coins)
func (BaseKeeper) IncreaseTotalSupply ¶
func (BaseKeeper) Init ¶
func (keeper BaseKeeper) Init(ctx sdk.Context)
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) SetMemoRegexp ¶
func (keeper BaseKeeper) SetMemoRegexp(ctx sdk.Context, fromAddr sdk.AccAddress, regexp string) (sdk.Tags, sdk.Error)
SetMemoRegexp sets memo regexp for sender account
func (BaseKeeper) SetTotalSupply ¶
func (keeper BaseKeeper) SetTotalSupply(ctx sdk.Context, totalSupply sdk.Coin)
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) GetCoins ¶
func (keeper BaseSendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (BaseSendKeeper) GetLoosenCoins ¶
func (keeper BaseSendKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the total loosen coins
func (BaseSendKeeper) GetTotalSupply ¶
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) GetCoins ¶
func (keeper BaseViewKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (BaseViewKeeper) GetLoosenCoins ¶
func (keeper BaseViewKeeper) GetLoosenCoins(ctx sdk.Context) sdk.Coins
GetLoosenCoins returns the total loosen coins
func (BaseViewKeeper) GetTotalSupply ¶
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 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) BurnCoins(ctx sdk.Context, fromAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error) SetMemoRegexp(ctx sdk.Context, fromAddr sdk.AccAddress, regexp string) (sdk.Tags, sdk.Error) IncreaseLoosenToken(ctx sdk.Context, amt sdk.Coins) DecreaseLoosenToken(ctx sdk.Context, amt sdk.Coins) IncreaseTotalSupply(ctx sdk.Context, amt sdk.Coin) sdk.Error DecreaseTotalSupply(ctx sdk.Context, amt sdk.Coin) sdk.Error SetTotalSupply(ctx sdk.Context, totalSupply sdk.Coin) }
Keeper defines a module interface that facilitates the transfer of coins between accounts.
type MsgBurn ¶
type MsgBurn struct { Owner sdk.AccAddress `json:"owner"` Coins sdk.Coins `json:"coins"` }
MsgBurn - high level transaction of the coin module
func NewMsgBurn ¶
func NewMsgBurn(owner sdk.AccAddress, coins sdk.Coins) MsgBurn
NewMsgBurn - construct MsgBurn
type MsgSend ¶
MsgSend - high level transaction of the coin module
func NewMsgSend ¶
NewMsgSend - construct arbitrary multi-in, multi-out send msg.
type MsgSetMemoRegexp ¶
type MsgSetMemoRegexp struct { Owner sdk.AccAddress `json:"owner"` MemoRegexp string `json:"memo_regexp"` }
MsgSetMemoRegexp - set memo regexp
func NewMsgSetMemoRegexp ¶
func NewMsgSetMemoRegexp(owner sdk.AccAddress, memoRegexp string) MsgSetMemoRegexp
NewMsgSetMemoRegexp - construct MsgSetMemoRegexp
func (MsgSetMemoRegexp) GetSignBytes ¶
func (msg MsgSetMemoRegexp) GetSignBytes() []byte
Implements Msg.
func (MsgSetMemoRegexp) GetSigners ¶
func (msg MsgSetMemoRegexp) GetSigners() []sdk.AccAddress
Implements Msg.
func (MsgSetMemoRegexp) Type ¶
func (msg MsgSetMemoRegexp) Type() string
func (MsgSetMemoRegexp) ValidateBasic ¶
func (msg MsgSetMemoRegexp) ValidateBasic() sdk.Error
Implements 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 QueryAccountParams ¶
type QueryAccountParams struct {
Address sdk.AccAddress
}
defines the params for query: "custom/acc/account"
func NewQueryAccountParams ¶
func NewQueryAccountParams(addr sdk.AccAddress) QueryAccountParams
type QueryTokenStatsParams ¶
type QueryTokenStatsParams struct {
TokenId string
}
defines the params for query: "custom/bank/token-stats"
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 TokenStats ¶
type TokenStats struct { LooseTokens sdk.Coins `json:"loose_tokens"` BondedTokens sdk.Coins `json:"bonded_tokens"` BurnedTokens sdk.Coins `json:"burned_tokens"` TotalSupply sdk.Coins `json:"total_supply"` }
func (TokenStats) HumanString ¶
func (ts TokenStats) HumanString(converter sdk.CoinsConverter) string
func (TokenStats) String ¶
func (ts TokenStats) String() string
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 GetTotalSupply(ctx sdk.Context, denom string) (coin sdk.Coin, found bool) }
ViewKeeper defines a module interface that facilitates read only access to account balances.