Documentation ¶
Index ¶
- Constants
- Variables
- func IsBuiltinContractAddr(addr Address) bool
- func IsBuiltinContractAddrInUse(addr Address) bool
- func IsBuiltinContractAddrInUseWithSendConfirm(addr Address) bool
- func IsBuiltinContractAddrInUseWithoutQuota(addr Address) bool
- func IsContractAddr(addr Address) bool
- func IsValidHexAddress(hexStr string) bool
- func IsValidHexTokenTypeId(hexStr string) bool
- type Address
- func BigToAddress(b *big.Int) (Address, error)
- func BytesToAddress(b []byte) (Address, error)
- func CreateAddress() (Address, ed25519.PrivateKey, error)
- func CreateAddressWithDeterministic(d [32]byte) (Address, ed25519.PrivateKey, error)
- func CreateContractAddress(data ...[]byte) Address
- func GenContractAddress(data []byte) (Address, error)
- func GenUserAddress(data []byte) (Address, error)
- func HexToAddress(hexStr string) (Address, error)
- func HexToAddressPanic(hexstr string) Address
- func PrikeyToAddress(key ed25519.PrivateKey) Address
- func PubkeyToAddress(pubkey []byte) Address
- func ValidHexAddress(hexStr string) (Address, error)
- func (addr Address) Bytes() []byte
- func (addr Address) Hex() string
- func (addr Address) IsZero() bool
- func (a Address) MarshalText() ([]byte, error)
- func (addr *Address) SetBytes(b []byte) error
- func (addr Address) String() string
- func (a *Address) UnmarshalJSON(input []byte) error
- func (a *Address) UnmarshalText(input []byte) error
- type BlockSource
- type ConsensusGroupInfo
- type GetError
- type Gid
- type Hash
- type Quota
- type QuotaInfo
- type Registration
- type StakeInfo
- type TokenInfo
- type TokenTypeId
- func (tid TokenTypeId) Bytes() []byte
- func (tid TokenTypeId) Hex() string
- func (tid TokenTypeId) MarshalText() ([]byte, error)
- func (tid *TokenTypeId) SetBytes(b []byte) error
- func (tid TokenTypeId) String() string
- func (tid *TokenTypeId) UnmarshalJSON(input []byte) error
- func (tid *TokenTypeId) UnmarshalText(input []byte) error
- type VoteInfo
Constants ¶
View Source
const ( AddressPrefix = "vite_" AddressSize = 21 AddressCoreSize = 20 )
View Source
const ( UserAddrByte = byte(0) ContractAddrByte = byte(1) )
View Source
const ( Unkonwn BlockSource = 0 RemoteBroadcast = 10 RemoteFetch = 20 Local = 30 RollbackChain = 40 QueryChain = 41 RemoteSync = 50 RemoteCache = 60 )
View Source
const ( TokenTypeIdPrefix = "tti_" TokenTypeIdSize = 10 )
View Source
const (
GidSize = 10
)
View Source
const (
HashSize = 32
)
Variables ¶
View Source
var (
AddressQuota, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, ContractAddrByte})
AddressGovernance, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, ContractAddrByte})
AddressAsset, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, ContractAddrByte})
AddressDexFund, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, ContractAddrByte})
AddressDexTrade, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, ContractAddrByte})
BuiltinContracts = []Address{AddressQuota, AddressGovernance, AddressAsset, AddressDexFund, AddressDexTrade}
BuiltinContractsWithoutQuota = []Address{AddressQuota, AddressGovernance, AddressAsset, AddressDexTrade}
BuiltinContractsWithSendConfirm = []Address{AddressQuota, AddressGovernance, AddressAsset}
)
View Source
var ( PRIVATE_GID = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 0} SNAPSHOT_GID = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 1} DELEGATE_GID = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 2} )
View Source
var EmptyHeight = uint64(0)
View Source
var (
ErrJsonNotString = errors.New("not valid string")
)
View Source
var GenesisHeight = uint64(1)
View Source
var ZERO_ADDRESS = Address{}
View Source
var ZERO_HASH = Hash{}
View Source
var ZERO_TOKENID = TokenTypeId{}
Functions ¶
func IsBuiltinContractAddr ¶
func IsContractAddr ¶
func IsValidHexAddress ¶
func IsValidHexTokenTypeId ¶
Types ¶
type Address ¶
type Address [AddressSize]byte
func BytesToAddress ¶
func CreateAddress ¶
func CreateAddress() (Address, ed25519.PrivateKey, error)
func CreateAddressWithDeterministic ¶
func CreateAddressWithDeterministic(d [32]byte) (Address, ed25519.PrivateKey, error)
func CreateContractAddress ¶
func GenContractAddress ¶
func GenUserAddress ¶
func HexToAddress ¶
func HexToAddressPanic ¶
func PrikeyToAddress ¶
func PrikeyToAddress(key ed25519.PrivateKey) Address
func PubkeyToAddress ¶
func ValidHexAddress ¶
func (Address) MarshalText ¶
func (*Address) UnmarshalJSON ¶
func (*Address) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type BlockSource ¶
type BlockSource uint16
type ConsensusGroupInfo ¶
type ConsensusGroupInfo struct { Gid Gid // Consensus group id NodeCount uint8 // Active miner count Interval int64 // Timestamp gap between two continuous block PerCount int64 // Continuous block generation interval count RandCount uint8 // Random miner count RandRank uint8 // Chose random miner with chain rank limit of vote Repeat uint16 // reuse consensus info to produce blocks within repeat times CheckLevel uint8 // consensus check param, 0-check address and sequence, 1-check address only CountingTokenId TokenTypeId // Token id for selecting miner through vote RegisterConditionId uint8 RegisterConditionParam []byte VoteConditionId uint8 VoteConditionParam []byte Owner Address StakeAmount *big.Int ExpirationHeight uint64 }
func (*ConsensusGroupInfo) IsActive ¶
func (groupInfo *ConsensusGroupInfo) IsActive() bool
type Hash ¶
func BytesToHash ¶
func DataListHash ¶
func HexToHashPanic ¶ added in v1.3.0
func (Hash) MarshalText ¶
func (*Hash) UnmarshalJSON ¶
type Quota ¶
type Quota struct {
// contains filtered or unexported fields
}
func (*Quota) BlockReleaseHeight ¶
func (*Quota) SnapshotCurrent ¶
Available quota in current snapshot block, excluding unconfirmed blocks
func (*Quota) StakeQuotaPerSnapshotBlock ¶
type Registration ¶
type Registration struct { Name string BlockProducingAddress Address RewardWithdrawAddress Address StakeAddress Address Amount *big.Int ExpirationHeight uint64 RewardTime int64 RevokeTime int64 HisAddrList []Address }
func (*Registration) IsActive ¶
func (r *Registration) IsActive() bool
type StakeInfo ¶
type StakeInfo struct { Amount *big.Int `json:"amount"` ExpirationHeight uint64 `json:"withdrawHeight"` Beneficiary Address `json:"beneficialAddr"` IsDelegated bool `json:"agent"` DelegateAddress Address `json:"agentAddr"` Bid uint8 `json:"bid"` StakeAddress Address `json:"pledgeAddr"` Id *Hash `json:"id"` }
type TokenInfo ¶
type TokenInfo struct { TokenName string `json:"tokenName"` TokenSymbol string `json:"tokenSymbol"` TotalSupply *big.Int `json:"totalSupply"` Decimals uint8 `json:"decimals"` Owner Address `json:"owner"` MaxSupply *big.Int `json:"maxSupply"` OwnerBurnOnly bool `json:"ownerBurnOnly"` IsReIssuable bool `json:"isReIssuable"` Index uint16 `json:"index"` }
type TokenTypeId ¶
type TokenTypeId [TokenTypeIdSize]byte
func BigToTokenTypeId ¶ added in v1.2.0
func BigToTokenTypeId(b *big.Int) (TokenTypeId, error)
func BytesToTokenTypeId ¶
func BytesToTokenTypeId(b []byte) (TokenTypeId, error)
func CreateTokenTypeId ¶
func CreateTokenTypeId(data ...[]byte) TokenTypeId
func HexToTokenTypeId ¶
func HexToTokenTypeId(hexStr string) (TokenTypeId, error)
func (TokenTypeId) Bytes ¶
func (tid TokenTypeId) Bytes() []byte
func (TokenTypeId) Hex ¶
func (tid TokenTypeId) Hex() string
func (TokenTypeId) MarshalText ¶
func (tid TokenTypeId) MarshalText() ([]byte, error)
func (*TokenTypeId) SetBytes ¶
func (tid *TokenTypeId) SetBytes(b []byte) error
func (TokenTypeId) String ¶
func (tid TokenTypeId) String() string
func (*TokenTypeId) UnmarshalJSON ¶
func (tid *TokenTypeId) UnmarshalJSON(input []byte) error
func (*TokenTypeId) UnmarshalText ¶
func (tid *TokenTypeId) UnmarshalText(input []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
Click to show internal directories.
Click to hide internal directories.