Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func CheckAndValidateMiniTokenCoins(ctx sdk.Context, am auth.AccountKeeper, addr sdk.AccAddress, coins sdk.Coins) 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 RegisterCodec(cdc *codec.Codec)
- type BaseKeeper
- func (keeper BaseKeeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) GetAccountKeeper() auth.AccountKeeper
- func (keeper BaseKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper BaseKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- 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) SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) 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) GetCoins(ctx sdk.Context, addr sdk.AccAddress) 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
- type Input
- type Keeper
- type MsgSend
- type Output
- type SendKeeper
- type ViewKeeper
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = 2 CodeInvalidInput sdk.CodeType = 101 CodeInvalidOutput sdk.CodeType = 102 )
Bank errors reserve 100 ~ 199.
const ( MiniTokenSymbolSuffixLen = 4 // probably enough. if it collides (unlikely) the issuer can just use another tx. MiniTokenSymbolMSuffix = "M" MiniTokenMinExecutionAmount int64 = 100000000 // 1 with 8 decimal digits )
Variables ¶
var TransferFeeCalculatorGen = fees.FeeCalculatorGenerator(func(params param.FeeParam) fees.FeeCalculator { transferFeeParam, ok := params.(*param.TransferFeeParam) if !ok { panic("Generator received unexpected param type") } return fees.FeeCalculator(func(msg types.Msg) types.Fee { transferMsg, ok := msg.(MsgSend) if !ok { panic("unexpected msg for TransferFeeCalculator") } totalFee := transferFeeParam.Fee var inputNum int64 = 0 for _, input := range transferMsg.Inputs { inputNum += int64(len(input.Coins)) } var outputNum int64 = 0 for _, output := range transferMsg.Outputs { outputNum += int64(len(output.Coins)) } num := common.MaxInt64(inputNum, outputNum) if num >= transferFeeParam.LowerLimitAsMulti { if num > types.TokenMaxTotalSupply/transferFeeParam.MultiTransferFee { totalFee = types.TokenMaxTotalSupply } else { totalFee = transferFeeParam.MultiTransferFee * num } } return types.NewFee(types.Coins{types.NewCoin(types.NativeTokenSymbol, totalFee)}, transferFeeParam.FeeFor) }) })
Functions ¶
func CheckAndValidateMiniTokenCoins ¶
func CheckAndValidateMiniTokenCoins(ctx sdk.Context, am auth.AccountKeeper, addr sdk.AccAddress, coins sdk.Coins) 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.
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) GetAccountKeeper ¶
func (keeper BaseKeeper) GetAccountKeeper() auth.AccountKeeper
func (BaseKeeper) GetCoins ¶
func (keeper BaseKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
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) 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) SetCoins ¶
func (keeper BaseKeeper) SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error
SetCoins sets the coins at the addr.
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) 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) 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 SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error 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) GetAccountKeeper() auth.AccountKeeper }
Keeper defines a module interface that facilitates the transfer of coins between accounts.
type MsgSend ¶
MsgSend - high level transaction of the coin module
func NewMsgSend ¶
NewMsgSend - construct arbitrary multi-in, multi-out send msg.
func (MsgSend) GetInvolvedAddresses ¶
func (msg MsgSend) GetInvolvedAddresses() []sdk.AccAddress
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) 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 HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool }
ViewKeeper defines a module interface that facilitates read only access to account balances.