Documentation ¶
Index ¶
- Constants
- Variables
- func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState) []abci.ValidatorUpdate
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func NewTokenProposalHandler(k Keeper) govtypes.Handler
- func ValidateGenesis(data GenesisState) error
- type AppModule
- func (am AppModule) BeginBlock(ctx sdk.Context, req 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 (AppModule) Name() string
- 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(cdc *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 GenesisState
- type Keeper
- func (k *Keeper) DeleteTokenInfo(ctx sdk.Context, symbol string)
- func (k *Keeper) DeleteTokenInfoWithoutSupply(ctx sdk.Context, symbol string)
- func (k *Keeper) DisableSend(ctx sdk.Context, symbol sdk.Symbol)
- func (k *Keeper) EnableSend(ctx sdk.Context, symbol sdk.Symbol)
- func (k *Keeper) GetAllTokenInfo(ctx sdk.Context) []sdk.TokenInfo
- func (k *Keeper) GetAllTokenInfoWithoutSupply(ctx sdk.Context) []sdk.TokenInfoWithoutSupply
- func (k *Keeper) GetDecimals(ctx sdk.Context, symbol sdk.Symbol) uint64
- func (k *Keeper) GetIssuer(ctx sdk.Context, symbol sdk.Symbol) string
- func (k *Keeper) GetParams(ctx sdk.Context) (params Params)
- func (k *Keeper) GetSymbolIterator(ctx sdk.Context) sdk.Iterator
- func (k *Keeper) GetSymbols(ctx sdk.Context) []string
- func (k *Keeper) GetTokenInfo(ctx sdk.Context, symbol sdk.Symbol) *sdk.TokenInfo
- func (k *Keeper) GetTokenInfoWithoutSupply(ctx sdk.Context, symbol sdk.Symbol) *sdk.TokenInfoWithoutSupply
- func (k *Keeper) GetTotalSupply(ctx sdk.Context, symbol sdk.Symbol) sdk.Int
- func (k *Keeper) IsSendEnabled(ctx sdk.Context, symbol sdk.Symbol) bool
- func (k *Keeper) IsTokenSupported(ctx sdk.Context, symbol sdk.Symbol) bool
- func (k *Keeper) SetParams(ctx sdk.Context, params Params)
- func (k *Keeper) SetTokenInfo(ctx sdk.Context, tokenInfo *sdk.TokenInfo)
- func (k *Keeper) SetTokenInfoWithoutSupply(ctx sdk.Context, tokenInfo *sdk.TokenInfoWithoutSupply)
- type Params
- type QueryTokenInfo
- type TokenKeeper
Constants ¶
const ( ModuleName = types.ModuleName RouterKey = types.RouterKey StoreKey = types.StoreKey QueryTokens = types.QueryTokens QueryToken = types.QueryToken QuerySymbols = types.QuerySymbols QueryParameters = types.QueryParameters DefaultParamspace = types.DefaultParamspace DefaultCodespace = types.DefaultCodespace )
Variables ¶
var ( ModuleCdc = types.ModuleCdc RegisterCodec = types.RegisterCodec DefaultParams = types.DefaultParams KeyTokenCacheSize = types.KeyTokenCacheSize DisableTokenProposalHandler = client.DisableTokenProposalHandler TokenParamsChangeProposalHandler = client.TokenParamsChangeProposalHandler NewTokenParamsChangeProposal = types.NewTokenParamsChangeProposal NewDisableTokenProposal = types.NewDisableTokenProposal )
var ( EthToken = "eth" BtcToken = "btc" UsdtToken = "usdt" )
var TestTokenData = []sdk.TokenInfo{ { Symbol: sdk.Symbol(sdk.NativeToken), Issuer: "", IsSendEnabled: true, Decimals: 8, TotalSupply: sdk.NewIntWithDecimal(21, 15), }, { Symbol: sdk.Symbol(BtcToken), Issuer: "", IsSendEnabled: true, Decimals: 8, TotalSupply: sdk.NewIntWithDecimal(21, 15), }, { Symbol: sdk.Symbol(EthToken), Issuer: "", IsSendEnabled: true, Decimals: 18, TotalSupply: sdk.NewInt(0), }, { Symbol: sdk.Symbol(UsdtToken), Issuer: "0xFF760fcB0fa4Ba68d9DD2e28fc7A3c593b5d2106", IsSendEnabled: true, Decimals: 18, TotalSupply: sdk.NewIntWithDecimal(1, 28), }, }
var TokenStoreKeyPrefix = []byte{0x01}
TokenStoreKeyPrefix define prefix for storing tokeninfk
Functions ¶
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState) []abci.ValidatorUpdate
InitGenesis ...
func NewHandler ¶
NewHandler create a token message handler
func NewQuerier ¶
NewQuerier create a token's query handler
func NewTokenProposalHandler ¶
NewTokenProposalHandler create handler for token's proposal
Types ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule implements an application module for the token module.
func NewAppModule ¶
NewAppModule creates a new AppModule object
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
BeginBlock returns the begin blocker for the distribution module.
func (AppModule) EndBlock ¶
func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
EndBlock returns the end blocker for the distribution module. It returns no validator updates.
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
ExportGenesis returns the exported genesis state as raw bytes for the distribution module.
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
InitGenesis performs genesis initialization for the token module. It returns no validator updates.
func (AppModule) NewHandler ¶
NewHandler returns an sdk.Handler for the token module.
func (AppModule) NewQuerierHandler ¶
NewQuerierHandler returns the distribution module sdk.Querier.
func (AppModule) QuerierRoute ¶
QuerierRoute returns the distribution module's querier route name.
func (AppModule) RegisterInvariants ¶
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
RegisterInvariants registers the distribution module invariants.
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic defines the basic application module used by the token module.
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
DefaultGenesis returns default genesis state as raw bytes for the token module.
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
GetQueryCmd returns the root query command for the token module.
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
GetTxCmd returns the root tx command for the token module.
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
Name returns the distribution module's name.
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
RegisterCodec registers the distribution module's types for the given codec.
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
RegisterRESTRoutes registers the REST routes for the token module.
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
ValidateGenesis performs genesis state validation for the token module.
type GenesisState ¶
type GenesisState struct { GenesisTokenInfos []sdk.TokenInfoWithoutSupply `json:"genesis_token_info"` Params Params `json:"params"` }
GenesisState ...
func NewGenesisState ¶
func NewGenesisState(tokenInfos []sdk.TokenInfoWithoutSupply, params Params) GenesisState
NewGenesisState ...
func (*GenesisState) AddTokenInfoWithoutSupplyIntoGenesis ¶
func (g *GenesisState) AddTokenInfoWithoutSupplyIntoGenesis(new sdk.TokenInfoWithoutSupply) error
AddTokenInfoWithoutSupplyIntoGenesis add a token into genesis
func (GenesisState) Equal ¶
func (g GenesisState) Equal(g2 GenesisState) bool
Equal check whether 2 genesisstate equal
func (GenesisState) IsEmpty ¶
func (g GenesisState) IsEmpty() bool
IsEmpty checks whether genesis state is empty
func (GenesisState) String ¶
func (g GenesisState) String() string
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper ...
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, dk types.DistrKeeper, sk types.SupplyKeeper, paramSubSpace params.Subspace) Keeper
NewKeeper create token's Keeper
func (*Keeper) DeleteTokenInfo ¶
DeleteTokenInfo delete TokenInfo and total supply
func (*Keeper) DeleteTokenInfoWithoutSupply ¶
DeleteTokenInfoWithoutSupply delete TokenInfoWithoutSupply
func (*Keeper) DisableSend ¶
DisableSend ...
func (*Keeper) EnableSend ¶
EnableSend ...
func (*Keeper) GetAllTokenInfo ¶
GetAllTokenInfo get all tokeninfo, whose totalsupply is stored in supply module
func (*Keeper) GetAllTokenInfoWithoutSupply ¶
func (k *Keeper) GetAllTokenInfoWithoutSupply(ctx sdk.Context) []sdk.TokenInfoWithoutSupply
GetAllTokenInfoWithoutSupply get all token's TokenInfoWithoutSupply
func (*Keeper) GetDecimals ¶
GetDecimals ...
func (*Keeper) GetSymbolIterator ¶
GetSymbolIterator ...
func (*Keeper) GetTokenInfo ¶
GetTokenInfo get a specified tokeninfo, whose totalsupply is stored in supply module
func (*Keeper) GetTokenInfoWithoutSupply ¶
func (k *Keeper) GetTokenInfoWithoutSupply(ctx sdk.Context, symbol sdk.Symbol) *sdk.TokenInfoWithoutSupply
GetTokenInfoWithoutSupply gets a specified token's GetTokenInfoWithoutSupply
func (*Keeper) GetTotalSupply ¶
GetTotalSupply ...
func (*Keeper) IsSendEnabled ¶
IsSendEnabled ...
func (*Keeper) IsTokenSupported ¶
IsTokenSupported ...
func (*Keeper) SetTokenInfo ¶
__For Test only__ The following methods will update total supply unconditionlly, shoul only be used in test SetTokenInfo set TokenInfo and total supply
func (*Keeper) SetTokenInfoWithoutSupply ¶
func (k *Keeper) SetTokenInfoWithoutSupply(ctx sdk.Context, tokenInfo *sdk.TokenInfoWithoutSupply)
SetTokenInfoWithoutSupply sets TokenInfoWithoutSupply
type QueryTokenInfo ¶
type QueryTokenInfo = types.QueryTokenInfo
type TokenKeeper ¶
type TokenKeeper interface { SetTokenInfoWithoutSupply(ctx sdk.Context, tokenInfo *sdk.TokenInfoWithoutSupply) DeleteTokenInfoWithoutSupply(ctx sdk.Context, symbol string) GetTokenInfo(ctx sdk.Context, symbol sdk.Symbol) *sdk.TokenInfo GetIssuer(ctx sdk.Context, symbol sdk.Symbol) string GetDecimals(ctx sdk.Context, symbol sdk.Symbol) uint64 GetTotalSupply(ctx sdk.Context, symbol sdk.Symbol) sdk.Int IsSendEnabled(ctx sdk.Context, symbol sdk.Symbol) bool EnableSend(ctx sdk.Context, symbol sdk.Symbol) DisableSend(ctx sdk.Context, symbol sdk.Symbol) }
TokenKeeper defines the token module interface
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
* ******************************************************************* * @项目名称: types * @文件名称: querier.go * @Date: 2019/06/05 * @Author: Keep * @Copyright(C): 2019 BlueHelix Inc.
|
* ******************************************************************* * @项目名称: types * @文件名称: querier.go * @Date: 2019/06/05 * @Author: Keep * @Copyright(C): 2019 BlueHelix Inc. |