token

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 42 Imported by: 2

Documentation

Index

Constants

View Source
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
)
View Source
const (
	FlagOSSEnable          = "oss-enable"
	FlagOSSEndpoint        = "oss-endpoint"
	FlagOSSAccessKeyID     = "oss-access-key-id"
	FlagOSSAccessKeySecret = "oss-access-key-secret"
	FlagOSSBucketName      = "oss-bucket-name"
	FlagOSSObjectPath      = "oss-object-path"
)
View Source
const DefaultTokenOwner = "ex10q0rk5qnyag7wfvvt7rtphlw589m7frs3hvqmf"

default owner of okt

View Source
const (
	// InitFeeDetailsCap default fee detail list cap
	InitFeeDetailsCap = 2000
)

Variables

View Source
var (
	// RegisterCodec register module codec
	RegisterCodec = types.RegisterCodec
)

Functions

func InitTestToken

func InitTestToken(name string) types.Token

func InitTestTokenWithOwner

func InitTestTokenWithOwner(name string, owner sdk.AccAddress) types.Token

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func NewTestToken

func NewTestToken(t *testing.T, ctx sdk.Context, keeper Keeper, bankKeeper bank.Keeper, tokenName string, addrList []sdk.AccAddress)

func NewTokenHandler

func NewTokenHandler(keeper Keeper, protocolVersion version.ProtocolVersionType) sdk.Handler

NewTokenHandler returns a handler for "token" type messages.

Types

type AccType

type AccType int

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

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) Name

func (AppModule) Name() string

nolint

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

nolint

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

nolint

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

nolint

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

nolint

func (AppModule) Route

func (AppModule) Route() string

Route module message route name

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) Name

func (AppModuleBasic) Name() string

nolint

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

nolint

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 Cache

type Cache struct {
	FeeDetails []*FeeDetail
}

Cache for detail

func NewCache

func NewCache() *Cache

NewCache news cache for detail

type CoinInfo

type CoinInfo = types.CoinInfo

CoinInfo coin info for query token

type CoinsInfo

type CoinsInfo = types.CoinsInfo

type FeeDetail

type FeeDetail = types.FeeDetail

nolint

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

func CreateParam(t *testing.T, isCheckTx bool) (sdk.Context, Keeper, *sdk.KVStoreKey, []byte)

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, ak types.AccountKeeper) 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

func (k Keeper) DeleteConfirmOwnership(ctx sdk.Context, symbol string)

DeleteConfirmOwnership deletes ownership confirming information from db

func (Keeper) DeleteUserToken

func (k Keeper) DeleteUserToken(ctx sdk.Context, owner sdk.AccAddress, symbol string)

DeleteUserToken deletes token by user address and symbol

func (Keeper) GetAllLockedCoins

func (k Keeper) GetAllLockedCoins(ctx sdk.Context) (locks []types.AccCoins)

GetAllLockCoins iterates KVStore and gets all of the locked coins

func (Keeper) GetCoins

func (k Keeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.SysCoins

nolint

func (Keeper) GetCoinsInfo

func (k Keeper) GetCoinsInfo(ctx sdk.Context, addr sdk.AccAddress) (coinsInfo types.CoinsInfo)

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

func (k Keeper) GetCurrenciesInfo(ctx sdk.Context) (currencies []types.Currency)

GetCurrenciesInfo returns all of the currencies info

func (Keeper) GetFeeDetailList

func (k Keeper) GetFeeDetailList() []*FeeDetail

GetFeeDetailList gets fee detail list from cache

func (Keeper) GetLockedCoins

func (k Keeper) GetLockedCoins(ctx sdk.Context, addr sdk.AccAddress) (coins sdk.SysCoins)

GetLockCoins gets locked coins by address

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams gets inflation params from the global param store

func (Keeper) GetTokenInfo

func (k Keeper) GetTokenInfo(ctx sdk.Context, symbol string) types.Token

nolint

func (Keeper) GetTokenTotalSupply

func (k Keeper) GetTokenTotalSupply(ctx sdk.Context, symbol string) sdk.Dec

nolint

func (Keeper) GetTokensInfo

func (k Keeper) GetTokensInfo(ctx sdk.Context) (tokens []types.Token)

nolint

func (Keeper) GetUserTokensInfo

func (k Keeper) GetUserTokensInfo(ctx sdk.Context, owner sdk.AccAddress) (tokens []types.Token)

GetUserTokensInfo gets tokens info by owner address

func (Keeper) IsContractAddress

func (k Keeper) IsContractAddress(ctx sdk.Context, addr sdk.AccAddress) bool

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) NewToken

func (k Keeper) NewToken(ctx sdk.Context, token types.Token)

nolint

func (Keeper) ResetCache

func (k Keeper) ResetCache(ctx sdk.Context)

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) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams set inflation params from the global param store

func (Keeper) TokenExist

func (k Keeper) TokenExist(ctx sdk.Context, symbol string) bool

TokenExist checks whether the token with symbol exist or not

func (Keeper) UnlockCoins

func (k Keeper) UnlockCoins(ctx sdk.Context, addr sdk.AccAddress, coins sdk.SysCoins, lockCoinsType int) error

nolint

func (Keeper) UpdateToken

func (k Keeper) UpdateToken(ctx sdk.Context, token types.Token)

type MsgSend

type MsgSend = types.MsgSend

MsgSend send token message

type Params

type Params = types.Params

Params token params

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)

type Token

type Token = types.Token

Directories

Path Synopsis
client
cli
rest
Package rest API.
Package rest API.
legacy
nolint
nolint

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL