Documentation ¶
Index ¶
- Constants
- Variables
- func ErrCodeUnknownTransaction(transactionID uint64) sdk.Error
- func ErrInvalidQueryParams(err error) sdk.Error
- func ErrInvalidRewardBrokerAddress(address sdk.AccAddress) sdk.Error
- func ErrInvalidTransactionType(txType TransactionType) sdk.Error
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(c *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type AppModule
- func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)
- func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
- func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
- func (am AppModule) NewHandler() sdk.Handler
- func (am AppModule) NewQuerierHandler() sdk.Querier
- func (AppModule) QuerierRoute() string
- func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
- func (AppModule) Route() string
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
- func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
- type Filter
- type GenesisState
- type Keeper
- func (k Keeper) AddCoin(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin, referenceID uint64, ...) (sdk.Coins, sdk.Error)
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k Keeper) GetCoins(ctx sdk.Context, address sdk.AccAddress) sdk.Coins
- func (k Keeper) GetParams(ctx sdk.Context) Params
- func (k Keeper) IterateUserTransactions(ctx sdk.Context, creator sdk.AccAddress, reverse bool, ...)
- func (k Keeper) SafeSubtractCoin(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin, referenceID uint64, ...) (sdk.Coins, sdk.Coin, sdk.Error)
- func (k Keeper) SetParams(ctx sdk.Context, params Params)
- func (k Keeper) SubtractCoin(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin, referenceID uint64, ...) (sdk.Coins, sdk.Error)
- func (k Keeper) Transactions(ctx sdk.Context) []Transaction
- func (k Keeper) TransactionsByAddress(ctx sdk.Context, address sdk.AccAddress, filterSetters ...Filter) []Transaction
- func (k Keeper) UpdateParams(ctx sdk.Context, updates Params, updatedFields []string) sdk.Error
- type MsgSendGift
- type MsgUpdateParams
- type Params
- type QueryTransactionsByAddressParams
- type SortOrderType
- type Transaction
- type TransactionSetter
- type TransactionType
Constants ¶
const ( ModuleName = types.ModuleName StoreKey = types.StoreKey QuerierRoute = types.QuerierRoute DefaultParamspace = types.DefaultParamspace TransactionGift = exported.TransactionGift TransactionBacking = exported.TransactionBacking TransactionBackingReturned = exported.TransactionBackingReturned TransactionChallenge = exported.TransactionChallenge TransactionChallengeReturned = exported.TransactionChallengeReturned TransactionUpvote = exported.TransactionUpvote TransactionUpvoteReturned = exported.TransactionUpvoteReturned TransactionInterestArgumentCreation = exported.TransactionInterestArgumentCreation TransactionInterestUpvoteReceived = exported.TransactionInterestUpvoteReceived TransactionInterestUpvoteGiven = exported.TransactionInterestUpvoteGiven TransactionRewardPayout = exported.TransactionRewardPayout TransactionInterestArgumentCreationSlashed = exported.TransactionInterestArgumentCreationSlashed TransactionInterestUpvoteReceivedSlashed = exported.TransactionInterestUpvoteReceivedSlashed TransactionInterestUpvoteGivenSlashed = exported.TransactionInterestUpvoteGivenSlashed TransactionStakeCreatorSlashed = exported.TransactionStakeCreatorSlashed TransactionStakeCuratorSlashed = exported.TransactionStakeCuratorSlashed TransactionCuratorReward = exported.TransactionCuratorReward SortAsc = exported.SortAsc SortDesc = exported.SortDesc QueryTransactionsByAddress = exported.QueryTransactionsByAddress QueryParams = exported.QueryParams RouterKey = exported.RouterKey )
const ( DefaultCodespace sdk.CodespaceType = ModuleName ErrorCodeInvalidTransactionType sdk.CodeType = 401 ErrorCodeInvalidRewardBrokerAddress sdk.CodeType = 402 ErrorCodeInvalidQueryParams sdk.CodeType = 403 ErrorCodeUnknownTransaction sdk.CodeType = 404 )
Bank errors reserve 400 ~ 499.
const ( TypeMsgSendGift = "send_gift" TypeMsgUpdateParams = "update_params" )
Variables ¶
var ( GetFilters = exported.GetFilters FilterByTransactionType = exported.FilterByTransactionType SortOrder = exported.SortOrder Limit = exported.Limit Offset = exported.Offset FromModuleAccount = exported.FromModuleAccount ToModuleAccount = exported.ToModuleAccount ModuleCodec = types.ModuleCodec )
var ( TransactionsKeyPrefix = []byte{0x00} // ID Keys TransactionIDKey = []byte{0x10} // AssociationKeys UserTransactionKeyPrefix = []byte{0x20} )
Define keys
var (
ParamKeyRewardBrokerAddress = []byte("rewardBrokerAddress")
)
Functions ¶
func ErrCodeUnknownTransaction ¶
ErrCodeUnknownTransaction throws an error when an invalid transaction id
func ErrInvalidQueryParams ¶
ErrInvalidQueryParams throws an error when the transaction type is invalid.
func ErrInvalidRewardBrokerAddress ¶
func ErrInvalidRewardBrokerAddress(address sdk.AccAddress) sdk.Error
ErrInvalidRewardBrokerAddress throws an error when the address doesn't match with genesis param address.
func ErrInvalidTransactionType ¶
func ErrInvalidTransactionType(txType TransactionType) sdk.Error
ErrInvalidTransactionType throws an error when the transaction type is invalid.
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
InitGenesis initializes story state from genesis file
func NewHandler ¶
NewHandler creates a new handler for bank module
func RegisterCodec ¶
RegisterCodec registers all the necessary types and interfaces for the module
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the genesis state data
Types ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule defines external data for the module ----------------------------------------------------------------------------
func NewAppModule ¶
NewAppModule creates a NewAppModule object
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)
BeginBlock returns the begin blocker for the supply module.
func (AppModule) EndBlock ¶
func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
EndBlock returns the end blocker for the supply module. It returns no validator updates.
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
ExportGenesis enforces exporting this module's data to a genesis file
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
InitGenesis enforces the creation of the genesis state for the bank module
func (AppModule) NewHandler ¶
NewHandler creates the handler for the bank module
func (AppModule) NewQuerierHandler ¶
NewQuerierHandler creates a new querier handler
func (AppModule) QuerierRoute ¶
QuerierRoute defines the querier route
func (AppModule) RegisterInvariants ¶
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
RegisterInvariants enforces registering of invariants
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic defines the internal data for the module ----------------------------------------------------------------------------
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
DefaultGenesis creates the default genesis state for testing
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
GetQueryCmd returns no root query command for the trubank module.
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command
GetTxCmd returns the root tx command for the bank module.
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
RegisterCodec registers the types needed for amino encoding/decoding
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
RegisterRESTRoutes registers the REST routes for the bank module.
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
ValidateGenesis validates the genesis state
type GenesisState ¶
type GenesisState struct { Transactions []Transaction `json:"transactions"` Params Params `json:"params"` }
GenesisState defines genesis data for the module
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default genesis state
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
ExportGenesis exports the genesis state
func NewGenesisState ¶
func NewGenesisState(params Params, transactions []Transaction) GenesisState
NewGenesisState creates a new genesis state.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper is the model object for the package bank module
func NewKeeper ¶
func NewKeeper(codec *codec.Codec, storeKey sdk.StoreKey, bankKeeper bank.Keeper, paramStore params.Subspace, codespace sdk.CodespaceType, supplyKeeper supply.Keeper) Keeper
NewKeeper creates a bank keeper.
func (Keeper) AddCoin ¶
func (k Keeper) AddCoin(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin, referenceID uint64, txType TransactionType, txSetters ...TransactionSetter) (sdk.Coins, sdk.Error)
AddCoin adds a coin to an address and adds the transaction to the association list.
func (Keeper) Codespace ¶
func (k Keeper) Codespace() sdk.CodespaceType
Codespace returns the codespace
func (Keeper) IterateUserTransactions ¶
func (k Keeper) IterateUserTransactions(ctx sdk.Context, creator sdk.AccAddress, reverse bool, cb func(transaction Transaction) (stop bool))
func (Keeper) SafeSubtractCoin ¶
func (k Keeper) SafeSubtractCoin(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin, referenceID uint64, txType TransactionType, txSetters ...TransactionSetter) (sdk.Coins, sdk.Coin, sdk.Error)
SafeSubtractCoin subtracts a coin without going below zero
func (Keeper) SubtractCoin ¶
func (k Keeper) SubtractCoin(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin, referenceID uint64, txType TransactionType, txSetters ...TransactionSetter) (sdk.Coins, sdk.Error)
SubtractCoin subtracts a coin from an address and adds the transaction to the association list.
func (Keeper) Transactions ¶
func (k Keeper) Transactions(ctx sdk.Context) []Transaction
Transactions gets all the transactions
func (Keeper) TransactionsByAddress ¶
func (k Keeper) TransactionsByAddress(ctx sdk.Context, address sdk.AccAddress, filterSetters ...Filter) []Transaction
TransactionsByAddress gets transactions for a given address and applies sent filters.
type MsgSendGift ¶
type MsgSendGift struct { Sender sdk.AccAddress Recipient sdk.AccAddress Reward sdk.Coin }
func NewMsgSendGift ¶
func NewMsgSendGift(sender, recipient sdk.AccAddress, reward sdk.Coin) MsgSendGift
func (MsgSendGift) GetSignBytes ¶
func (msg MsgSendGift) GetSignBytes() []byte
func (MsgSendGift) GetSigners ¶
func (msg MsgSendGift) GetSigners() []sdk.AccAddress
func (MsgSendGift) Route ¶
func (msg MsgSendGift) Route() string
func (MsgSendGift) Type ¶
func (msg MsgSendGift) Type() string
func (MsgSendGift) ValidateBasic ¶
func (msg MsgSendGift) ValidateBasic() sdk.Error
type MsgUpdateParams ¶
type MsgUpdateParams struct { Updates Params `json:"updates"` UpdatedFields []string `json:"updated_fields"` Updater sdk.AccAddress `json:"updater"` }
MsgUpdateParams defines the message to remove an admin
func NewMsgUpdateParams ¶
func NewMsgUpdateParams(updates Params, updatedFields []string, updater sdk.AccAddress) MsgUpdateParams
NewMsgUpdateParams returns the message to update the params
func (MsgUpdateParams) GetSignBytes ¶
func (msg MsgUpdateParams) GetSignBytes() []byte
GetSignBytes implements Msg
func (MsgUpdateParams) GetSigners ¶
func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress
GetSigners implements Msg. Returns the remover as the signer.
func (MsgUpdateParams) ValidateBasic ¶
func (msg MsgUpdateParams) ValidateBasic() sdk.Error
ValidateBasic implements Msg
type Params ¶
type Params struct {
RewardBrokerAddress sdk.AccAddress `json:"reward_broker_address"`
}
func DefaultParams ¶
func DefaultParams() Params
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
type QueryTransactionsByAddressParams ¶
type QueryTransactionsByAddressParams = exported.QueryTransactionsByAddressParams
type SortOrderType ¶
type SortOrderType = exported.SortOrderType
type Transaction ¶
type Transaction = exported.Transaction
type TransactionSetter ¶
type TransactionSetter = exported.TransactionSetter
type TransactionType ¶
type TransactionType = exported.TransactionType