Documentation ¶
Index ¶
- Constants
- Variables
- func InitTestToken(name string) types.Token
- func InitTestTokenWithOwner(name string, owner sdk.AccAddress) types.Token
- func NewQuerier(keeper Keeper) sdk.Querier
- func NewTestToken(t *testing.T, ctx sdk.Context, keeper Keeper, bankKeeper bank.Keeper, ...)
- func NewTokenHandler(keeper Keeper, protocolVersion version.ProtocolVersionType) sdk.Handler
- type AccountResponse
- 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 Cache
- type CoinInfo
- type CoinsInfo
- type FeeDetail
- type GenesisState
- type Keeper
- func (k Keeper) AddFeeDetail(ctx sdk.Context, from string, fee sdk.SysCoins, feeType string, ...)
- func (k Keeper) BalanceAccount(ctx sdk.Context, addr sdk.AccAddress, outputCoins sdk.SysCoins, ...) (err error)
- func (k Keeper) DeleteConfirmOwnership(ctx sdk.Context, symbol string)
- func (k Keeper) DeleteUserToken(ctx sdk.Context, owner sdk.AccAddress, symbol string)
- func (k Keeper) GetAllLockedCoins(ctx sdk.Context) (locks []types.AccCoins)
- func (k Keeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.SysCoins
- func (k Keeper) GetCoinsInfo(ctx sdk.Context, addr sdk.AccAddress) (coinsInfo types.CoinsInfo)
- func (k Keeper) GetConfirmOwnership(ctx sdk.Context, symbol string) (confirmOwnership *types.ConfirmOwnership, exist bool)
- func (k Keeper) GetCurrenciesInfo(ctx sdk.Context) (currencies []types.Currency)
- func (k Keeper) GetFeeDetailList() []*FeeDetail
- func (k Keeper) GetLockedCoins(ctx sdk.Context, addr sdk.AccAddress) (coins sdk.SysCoins)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetTokenInfo(ctx sdk.Context, symbol string) types.Token
- func (k Keeper) GetTokenTotalSupply(ctx sdk.Context, symbol string) sdk.Dec
- func (k Keeper) GetTokensInfo(ctx sdk.Context) (tokens []types.Token)
- func (k Keeper) GetUserTokensInfo(ctx sdk.Context, owner sdk.AccAddress) (tokens []types.Token)
- func (k Keeper) IterateLockedFees(ctx sdk.Context, cb func(acc sdk.AccAddress, coins sdk.SysCoins) (stop bool))
- func (k Keeper) LockCoins(ctx sdk.Context, addr sdk.AccAddress, coins sdk.SysCoins, lockCoinsType int) error
- func (k Keeper) NewToken(ctx sdk.Context, token types.Token)
- func (k Keeper) ResetCache(ctx sdk.Context)
- func (k Keeper) SendCoinsFromAccountToAccount(ctx sdk.Context, from, to sdk.AccAddress, amt sdk.SysCoins) error
- func (k Keeper) SetConfirmOwnership(ctx sdk.Context, confirmOwnership *types.ConfirmOwnership)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) TokenExist(ctx sdk.Context, symbol string) bool
- func (k Keeper) UnlockCoins(ctx sdk.Context, addr sdk.AccAddress, coins sdk.SysCoins, lockCoinsType int) error
- func (k Keeper) UpdateToken(ctx sdk.Context, token types.Token)
- type MsgSend
- type Params
- type StakingKeeper
- type SupplyKeeper
- type Token
Constants ¶
const ( // ModuleName is the module name constant used in many places ModuleName = types.ModuleName // StoreKey is the store key string for token module StoreKey = types.StoreKey // RouterKey is the message route for token module RouterKey = types.RouterKey // QuerierRoute is the querier route for token module QuerierRoute = types.QuerierRoute // DefaultParamspace is the param space for token module DefaultParamspace = types.DefaultParamspace // DefaultCodespace is the code space for token module DefaultCodespace = types.DefaultCodespace // KeyLock key for token lock store KeyLock = types.KeyLock // KeyMint key for token mint store KeyMint = types.KeyMint // CodeInvalidAsset error code of invalid asset CodeInvalidAsset = types.CodeInvalidAsset )
const DefaultTokenOwner = "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9"
default owner of okt
const (
// InitFeeDetailsCap default fee detail list cap
InitFeeDetailsCap = 2000
)
Variables ¶
var ( // RegisterCodec register module codec RegisterCodec = types.RegisterCodec )
Functions ¶
func InitTestToken ¶ added in v0.13.0
func InitTestTokenWithOwner ¶ added in v0.13.0
func InitTestTokenWithOwner(name string, owner sdk.AccAddress) types.Token
func NewQuerier ¶
NewQuerier is the module level router for state queries
func NewTestToken ¶ added in v0.13.0
func NewTokenHandler ¶
func NewTokenHandler(keeper Keeper, protocolVersion version.ProtocolVersionType) sdk.Handler
NewTokenHandler returns a handler for "token" type messages.
Types ¶
type AccountResponse ¶
type AccountResponse = types.AccountResponse
AccountResponse response for query account
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule app module
func NewAppModule ¶
func NewAppModule(v version.ProtocolVersionType, keeper Keeper, supplyKeeper authTypes.SupplyKeeper) AppModule
NewAppModule creates a new AppModule object
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
nolint
func (AppModule) EndBlock ¶
func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
nolint
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
nolint
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
nolint
func (AppModule) RegisterInvariants ¶
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
nolint
type AppModuleBasic ¶
type AppModuleBasic struct{}
nolint
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
nolint
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
GetQueryCmd gets the root query command of this module
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
GetTxCmd gets the root tx command of this module
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
RegisterRESTRoutes register rest routes
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
validateGenesis module validate genesis from json raw message
type GenesisState ¶
type GenesisState struct { Params types.Params `json:"params"` Tokens []types.Token `json:"tokens"` LockedAssets []types.AccCoins `json:"locked_assets"` LockedFees []types.AccCoins `json:"locked_fees"` }
all state that must be provided in genesis file
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) (data GenesisState)
ExportGenesis writes the current store values to a genesis file, which can be imported again with initGenesis
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
func CreateParam ¶
CreateParam create okexchain parm for test
func NewKeeper ¶
func NewKeeper(bankKeeper bank.Keeper, paramSpace params.Subspace, feeCollectorName string, supplyKeeper SupplyKeeper, tokenStoreKey, lockStoreKey sdk.StoreKey, cdc *codec.Codec, enableBackend bool) Keeper
NewKeeper creates a new token keeper
func (Keeper) AddFeeDetail ¶
func (k Keeper) AddFeeDetail(ctx sdk.Context, from string, fee sdk.SysCoins, feeType string, receiver string)
nolint
func (Keeper) BalanceAccount ¶
func (k Keeper) BalanceAccount(ctx sdk.Context, addr sdk.AccAddress, outputCoins sdk.SysCoins, inputCoins sdk.SysCoins) (err error)
BalanceAccount is ONLY expected by the order module to settle an order where outputCoins is used to exchange inputCoins
func (Keeper) DeleteConfirmOwnership ¶
DeleteConfirmOwnership deletes ownership confirming information from db
func (Keeper) DeleteUserToken ¶
DeleteUserToken deletes token by user address and symbol
func (Keeper) GetAllLockedCoins ¶
GetAllLockCoins iterates KVStore and gets all of the locked coins
func (Keeper) GetCoinsInfo ¶
GetCoinsInfo gets all of the coin info by addr
func (Keeper) GetConfirmOwnership ¶
func (k Keeper) GetConfirmOwnership(ctx sdk.Context, symbol string) (confirmOwnership *types.ConfirmOwnership, exist bool)
GetConfirmOwnership returns ownership confirming information
func (Keeper) GetCurrenciesInfo ¶
GetCurrenciesInfo returns all of the currencies info
func (Keeper) GetFeeDetailList ¶
GetFeeDetailList gets fee detail list from cache
func (Keeper) GetLockedCoins ¶
GetLockCoins gets locked coins by address
func (Keeper) GetTokenInfo ¶
nolint
func (Keeper) GetTokenTotalSupply ¶
nolint
func (Keeper) GetTokensInfo ¶
nolint
func (Keeper) GetUserTokensInfo ¶
GetUserTokensInfo gets tokens info by owner address
func (Keeper) IterateLockedFees ¶
func (k Keeper) IterateLockedFees(ctx sdk.Context, cb func(acc sdk.AccAddress, coins sdk.SysCoins) (stop bool))
IterateAllDeposits iterates over the all the stored lock fee and performs a callback function
func (Keeper) LockCoins ¶
func (k Keeper) LockCoins(ctx sdk.Context, addr sdk.AccAddress, coins sdk.SysCoins, lockCoinsType int) error
nolint
func (Keeper) SendCoinsFromAccountToAccount ¶
func (k Keeper) SendCoinsFromAccountToAccount(ctx sdk.Context, from, to sdk.AccAddress, amt sdk.SysCoins) error
SendCoinsFromAccountToAccount - send token from one account to another account
func (Keeper) SetConfirmOwnership ¶
func (k Keeper) SetConfirmOwnership(ctx sdk.Context, confirmOwnership *types.ConfirmOwnership)
SetConfirmOwnership sets ownership confirming information to db
func (Keeper) TokenExist ¶
TokenExist checks whether the token with symbol exist or not
type StakingKeeper ¶
type StakingKeeper interface {
IsValidator(ctx sdk.Context, addr sdk.AccAddress) bool
}
StakingKeeper defines the expected staking Keeper (noalias)
type SupplyKeeper ¶
type SupplyKeeper interface { GetSupplyByDenom(ctx sdk.Context, denom string) sdk.Dec GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI) SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) sdk.Error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error }
SupplyKeeper defines the expected supply Keeper (noalias)