Documentation
¶
Index ¶
- Constants
- Variables
- func GetAccountDecoder(cdc *wire.Codec) auth.AccountDecoder
- func IsMiniTokenSymbol(symbol string) bool
- func IsValidMiniTokenSymbol(symbol string) bool
- func ProtoAppAccount() sdk.Account
- func RegisterWire(cdc *wire.Codec)
- func ValidateIssueMiniSymbol(symbol string) error
- func ValidateIssueSymbol(symbol string) error
- func ValidateMiniTokenSymbol(symbol string) error
- func ValidateTokenSymbol(symbol string) error
- func ValidateTokenSymbols(coins sdk.Coins) error
- type AbciQueryHandler
- type AppAccount
- func (acc *AppAccount) Clone() sdk.Account
- func (acc *AppAccount) GetFlags() uint64
- func (acc AppAccount) GetFrozenCoins() sdk.Coins
- func (acc AppAccount) GetLockedCoins() sdk.Coins
- func (acc AppAccount) GetName() string
- func (acc *AppAccount) SetFlags(flags uint64)
- func (acc *AppAccount) SetFrozenCoins(frozen sdk.Coins)
- func (acc *AppAccount) SetLockedCoins(frozen sdk.Coins)
- func (acc *AppAccount) SetName(name string)
- type ChainApp
- type IToken
- type MiniToken
- func (token *MiniToken) GetContractAddress() string
- func (token MiniToken) GetContractDecimals() int8
- func (token MiniToken) GetName() string
- func (token MiniToken) GetOrigSymbol() string
- func (token MiniToken) GetOwner() sdk.AccAddress
- func (token MiniToken) GetSymbol() string
- func (token MiniToken) GetTotalSupply() utils.Fixed8
- func (token MiniToken) IsMintable() bool
- func (token *MiniToken) IsOwner(addr sdk.AccAddress) bool
- func (token *MiniToken) SetContractAddress(addr string)
- func (token *MiniToken) SetContractDecimals(decimal int8)
- func (token *MiniToken) SetOwner(addr sdk.AccAddress)
- func (token *MiniToken) SetTotalSupply(totalSupply utils.Fixed8)
- func (token MiniToken) String() string
- type NamedAccount
- type SupplyRangeType
- type Token
- func (token *Token) GetContractAddress() string
- func (token Token) GetContractDecimals() int8
- func (token Token) GetName() string
- func (token Token) GetOrigSymbol() string
- func (token Token) GetOwner() sdk.AccAddress
- func (token Token) GetSymbol() string
- func (token Token) GetTotalSupply() utils.Fixed8
- func (token Token) IsMintable() bool
- func (token *Token) IsOwner(addr sdk.AccAddress) bool
- func (token *Token) SetContractAddress(addr string)
- func (token *Token) SetContractDecimals(decimal int8)
- func (token *Token) SetOwner(addr sdk.AccAddress)
- func (token *Token) SetTotalSupply(totalSupply utils.Fixed8)
- func (token Token) String() string
Constants ¶
const ( MiniTokenSymbolMaxLen = 8 MiniTokenSymbolMinLen = 3 MiniTokenSymbolNewMinLen = 2 MiniTokenSymbolSuffixLen = 4 // probably enough. if it collides (unlikely) the issuer can just use another tx. MiniTokenSymbolTxHashSuffixLen = 3 // probably enough. if it collides (unlikely) the issuer can just use another tx. MiniTokenSymbolMSuffix = "M" MiniTokenMinExecutionAmount int64 = 1e8 // 1 with 8 decimal digits MiniTokenSupplyUpperBound int64 = 1000000e8 // 1m with 8 decimal digits TinyTokenSupplyUpperBound int64 = 10000e8 // 10k with 8 decimal digits MaxTokenURILength = 2048 TinyRangeType SupplyRangeType = 1 MiniRangeType SupplyRangeType = 2 )
const ( TokenSymbolMaxLen = 8 TokenSymbolMinLen = 3 TokenSymbolNewMinLen = 2 TokenSymbolTxHashSuffixLen = 3 // probably enough. if it collides (unlikely) the issuer can just use another tx. TokenSymbolDotBSuffix = ".B" TokenDecimals int8 = 8 TokenMaxTotalSupply int64 = 9000000000000000000 // 90 billions with 8 decimal digits NativeTokenSymbol = "AXC" // number of zeros = TokenSymbolTxHashSuffixLen NativeTokenSymbolDotBSuffixed = "AXC" + TokenSymbolDotBSuffix NativeTokenTotalSupply = 2e16 )
Variables ¶
var SupplyRange = struct { TINY SupplyRangeType MINI SupplyRangeType }{TinyRangeType, MiniRangeType}
Functions ¶
func GetAccountDecoder ¶
func GetAccountDecoder(cdc *wire.Codec) auth.AccountDecoder
Get the AccountDecoder function for the custom AppAccount
func IsMiniTokenSymbol ¶
check if it's mini token by last letter without validation
func IsValidMiniTokenSymbol ¶
Validate and check if it's mini token
func RegisterWire ¶
func ValidateIssueMiniSymbol ¶
This function is used by both client and server side, and the client needs to use MiniTokenSymbolNewMinLen for the validation. If the UpgradeMgr.GetHeight == 0, that indicates the function is invoked by client side, and we should use MiniTokenSymbolNewMinLen
func ValidateIssueSymbol ¶
This function is used by both client and server side, and the client needs to use TokenSymbolNewMinLen for the validation. If the UpgradeMgr.GetHeight == 0, that indicates the function is invoked by client side, and we should use TokenSymbolNewMinLen
func ValidateMiniTokenSymbol ¶
func ValidateTokenSymbol ¶
func ValidateTokenSymbols ¶
Types ¶
type AbciQueryHandler ¶
type AbciQueryHandler func(app ChainApp, req abci.RequestQuery, path []string) (res *abci.ResponseQuery)
AbciQueryHandler represents an abci query handler, registered by a plugin's InitPlugin.
type AppAccount ¶
type AppAccount struct {
auth.BaseAccount `json:"base"`
Name string `json:"name"`
FrozenCoins sdk.Coins `json:"frozen"`
LockedCoins sdk.Coins `json:"locked"`
Flags uint64 `json:"flags"`
}
func (*AppAccount) Clone ¶
func (acc *AppAccount) Clone() sdk.Account
func (*AppAccount) GetFlags ¶
func (acc *AppAccount) GetFlags() uint64
func (AppAccount) GetFrozenCoins ¶
func (acc AppAccount) GetFrozenCoins() sdk.Coins
func (AppAccount) GetLockedCoins ¶
func (acc AppAccount) GetLockedCoins() sdk.Coins
func (*AppAccount) SetFlags ¶
func (acc *AppAccount) SetFlags(flags uint64)
func (*AppAccount) SetFrozenCoins ¶
func (acc *AppAccount) SetFrozenCoins(frozen sdk.Coins)
func (*AppAccount) SetLockedCoins ¶
func (acc *AppAccount) SetLockedCoins(frozen sdk.Coins)
func (*AppAccount) SetName ¶
func (acc *AppAccount) SetName(name string)
type ChainApp ¶
type ChainApp interface {
GetCodec() *wire.Codec
GetRouter() baseapp.Router
GetContextForCheckState() sdk.Context
Query(req abci.RequestQuery) (res abci.ResponseQuery)
RegisterQueryHandler(prefix string, handler AbciQueryHandler)
ExportAppStateAndValidators() (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error)
EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
}
ChainApp represents the main ABCI application
type IToken ¶
type IToken interface {
GetName() string
GetSymbol() string
GetOrigSymbol() string
GetTotalSupply() utils.Fixed8
SetTotalSupply(totalSupply utils.Fixed8)
SetContractAddress(addr string)
GetContractAddress() string
SetContractDecimals(decimal int8)
GetContractDecimals() int8
SetOwner(addr sdk.AccAddress)
GetOwner() sdk.AccAddress
IsMintable() bool
IsOwner(addr sdk.AccAddress) bool
String() string
}
type MiniToken ¶
type MiniToken struct {
Name string `json:"name"`
Symbol string `json:"symbol"`
OrigSymbol string `json:"original_symbol"`
TotalSupply utils.Fixed8 `json:"total_supply"`
Owner sdk.AccAddress `json:"owner"`
Mintable bool `json:"mintable"`
TokenType SupplyRangeType `json:"token_type"`
TokenURI string `json:"token_uri"`
ContractAddress string `json:"contract_address,omitempty"`
ContractDecimals int8 `json:"contract_decimals,omitempty"`
}
func NewMiniToken ¶
func NewMiniToken(name, origSymbol, symbol string, supplyRangeType SupplyRangeType, totalSupply int64, owner sdk.AccAddress, mintable bool, tokenURI string) *MiniToken
func (*MiniToken) GetContractAddress ¶
func (MiniToken) GetContractDecimals ¶
func (MiniToken) GetOrigSymbol ¶
func (MiniToken) GetOwner ¶
func (token MiniToken) GetOwner() sdk.AccAddress
func (MiniToken) GetTotalSupply ¶
func (MiniToken) IsMintable ¶
func (*MiniToken) SetContractAddress ¶
func (*MiniToken) SetContractDecimals ¶
func (*MiniToken) SetOwner ¶
func (token *MiniToken) SetOwner(addr sdk.AccAddress)
func (*MiniToken) SetTotalSupply ¶
type NamedAccount ¶
type NamedAccount interface {
sdk.Account
GetName() string
SetName(string)
GetFrozenCoins() sdk.Coins
SetFrozenCoins(sdk.Coins)
//TODO: this should merge into Coin
GetLockedCoins() sdk.Coins
SetLockedCoins(sdk.Coins)
GetFlags() uint64
SetFlags(uint64)
}
TODO: maybe need to move GetFrozenCoins to the base interface
type SupplyRangeType ¶
type SupplyRangeType int8
func (SupplyRangeType) String ¶
func (t SupplyRangeType) String() string
func (SupplyRangeType) UpperBound ¶
func (t SupplyRangeType) UpperBound() int64
type Token ¶
type Token struct {
Name string `json:"name"`
Symbol string `json:"symbol"`
OrigSymbol string `json:"original_symbol"`
TotalSupply utils.Fixed8 `json:"total_supply"`
Owner sdk.AccAddress `json:"owner"`
Mintable bool `json:"mintable"`
ContractAddress string `json:"contract_address,omitempty"`
ContractDecimals int8 `json:"contract_decimals,omitempty"`
}
func (*Token) GetContractAddress ¶
func (Token) GetContractDecimals ¶
func (Token) GetOrigSymbol ¶
func (Token) GetOwner ¶
func (token Token) GetOwner() sdk.AccAddress
func (Token) GetTotalSupply ¶
func (Token) IsMintable ¶
func (*Token) SetContractAddress ¶
func (*Token) SetContractDecimals ¶
func (*Token) SetOwner ¶
func (token *Token) SetOwner(addr sdk.AccAddress)