types

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressPrefix = "vite_"
	AddressSize   = 20
)
View Source
const (
	Unkonwn         BlockSource = 0
	RemoteBroadcast             = 10
	RemoteFetch                 = 20
	Local                       = 30
	RollbackChain               = 40
	QueryChain                  = 41
	RemoteSync                  = 50
)
View Source
const (
	TokenTypeIdPrefix = "tti_"
	TokenTypeIdSize   = 10
)
View Source
const (
	GidSize = 10
)
View Source
const (
	HashSize = 32
)

Variables

View Source
var (
	AddressRegister, _       = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1})
	AddressVote, _           = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2})
	AddressPledge, _         = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3})
	AddressConsensusGroup, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4})
	AddressMintage, _        = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5})

	PrecompiledContractAddressList             = []Address{AddressRegister, AddressVote, AddressPledge, AddressConsensusGroup, AddressMintage}
	PrecompiledContractWithoutQuotaAddressList = []Address{AddressRegister, AddressVote, AddressPledge, AddressConsensusGroup, AddressMintage}
)
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 AccountLimitSnapshotHeight = uint64(60 * 60 * 24)
View Source
var EmptyHeight = uint64(0)
View Source
var (
	ErrJsonNotString = errors.New("not valid string")
)
View Source
var GenesisHeight = uint64(1)
View Source
var SnapshotDayHeight = uint64(60 * 60 * 24)
View Source
var SnapshotHourHeight = uint64(60 * 60)
View Source
var ZERO_HASH = Hash{}
View Source
var ZERO_TOKENID = TokenTypeId{}

Functions

func IsPrecompiledContractAddress

func IsPrecompiledContractAddress(addr Address) bool

func IsPrecompiledContractWithoutQuotaAddress added in v1.3.0

func IsPrecompiledContractWithoutQuotaAddress(addr Address) bool

func IsValidHexAddress

func IsValidHexAddress(hexStr string) bool

func IsValidHexTokenTypeId

func IsValidHexTokenTypeId(hexStr string) bool

Types

type Address

type Address [AddressSize]byte

func BigToAddress added in v1.2.0

func BigToAddress(b *big.Int) (Address, error)

func BytesToAddress

func BytesToAddress(b []byte) (Address, error)

func CreateAddress

func CreateAddress() (Address, ed25519.PrivateKey, error)

func CreateAddressWithDeterministic

func CreateAddressWithDeterministic(d [32]byte) (Address, ed25519.PrivateKey, error)

func CreateContractAddress

func CreateContractAddress(data ...[]byte) Address

func HexToAddress

func HexToAddress(hexStr string) (Address, error)

func PrikeyToAddress

func PrikeyToAddress(key ed25519.PrivateKey) Address

func PubkeyToAddress

func PubkeyToAddress(pubkey []byte) Address

func (Address) Bytes

func (addr Address) Bytes() []byte

func (Address) Hex

func (addr Address) Hex() string

func (Address) MarshalText

func (a Address) MarshalText() ([]byte, error)

func (*Address) SetBytes

func (addr *Address) SetBytes(b []byte) error

func (Address) String

func (addr Address) String() string

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(input []byte) error

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 a rank limit of vote
	CountingTokenId        TokenTypeId // Token id for selecting miner through vote
	RegisterConditionId    uint8
	RegisterConditionParam []byte
	VoteConditionId        uint8
	VoteConditionParam     []byte
	Owner                  Address
	PledgeAmount           *big.Int
	WithdrawHeight         uint64
}

func (*ConsensusGroupInfo) IsActive

func (groupInfo *ConsensusGroupInfo) IsActive() bool

type GetError

type GetError struct {
	Code int
	Err  error
}

func (GetError) Error

func (getErr GetError) Error() string

type Gid

type Gid [GidSize]byte

func BigToGid

func BigToGid(data *big.Int) (Gid, error)

func BytesToGid

func BytesToGid(b []byte) (Gid, error)

func DataToGid

func DataToGid(data ...[]byte) Gid

func HexToGid

func HexToGid(hexStr string) (Gid, error)

func (*Gid) Bytes

func (gid *Gid) Bytes() []byte

func (Gid) Hex

func (gid Gid) Hex() string

func (Gid) MarshalText

func (gid Gid) MarshalText() ([]byte, error)

func (*Gid) SetBytes

func (gid *Gid) SetBytes(b []byte) error

func (Gid) String

func (gid Gid) String() string

func (*Gid) UnmarshalJSON

func (gid *Gid) UnmarshalJSON(input []byte) error

type Hash

type Hash [HashSize]byte

func BigToHash

func BigToHash(b *big.Int) (Hash, error)

func BytesToHash

func BytesToHash(b []byte) (Hash, error)

func DataHash

func DataHash(data []byte) Hash

func DataListHash

func DataListHash(data ...[]byte) Hash

func HexToHash

func HexToHash(hexstr string) (Hash, error)

func HexToHashPanic added in v1.3.0

func HexToHashPanic(hexstr string) Hash

func (Hash) Big

func (h Hash) Big() *big.Int

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) Hex

func (h Hash) Hex() string

func (Hash) IsZero

func (h Hash) IsZero() bool

func (Hash) MarshalText

func (h Hash) MarshalText() ([]byte, error)

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte) error

func (Hash) String

func (h Hash) String() string

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(input []byte) error

type Registration

type Registration struct {
	Name           string
	NodeAddr       Address
	PledgeAddr     Address
	Amount         *big.Int
	WithdrawHeight uint64
	RewardIndex    uint64
	CancelHeight   uint64
	HisAddrList    []Address
}

func (*Registration) IsActive

func (r *Registration) IsActive() bool

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"`
	PledgeAmount   *big.Int `json:"pledgeAmount"`
	PledgeAddr     Address  `json:"pledgeAddr"`
	WithdrawHeight uint64   `json:"withdrawHeight"`
	MaxSupply      *big.Int `json:"maxSupply"`
	OwnerBurnOnly  bool     `json:"ownerBurnOnly"`
	IsReIssuable   bool     `json:"isReIssuable"`
}

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

type VoteInfo

type VoteInfo struct {
	VoterAddr Address
	NodeName  string
}

Jump to

Keyboard shortcuts

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