Documentation
¶
Index ¶
- Constants
- Variables
- func GetAddrFromVoteKey(key []byte) types.Address
- func GetBeneficialFromPledgeKey(key []byte) types.Address
- func GetConsensusGroupKey(gid types.Gid) []byte
- func GetGidFromConsensusGroupKey(key []byte) types.Gid
- func GetGidFromCreateContractData(data []byte) types.Gid
- func GetMintageKey(tokenId types.TokenTypeId) []byte
- func GetPledgeBeneficialAmount(db StorageDatabase, beneficial types.Address) *big.Int
- func GetPledgeBeneficialKey(beneficial types.Address) []byte
- func GetPledgeKey(addr types.Address, pledgeBeneficialKey []byte) []byte
- func GetRegisterKey(name string, gid types.Gid) []byte
- func GetTokenIdFromMintageKey(key []byte) types.TokenTypeId
- func GetTokenMap(db StorageDatabase) map[types.TokenTypeId]*TokenInfo
- func GetVoteKey(addr types.Address, gid types.Gid) []byte
- func IsPledgeKey(key []byte) bool
- func NewContractAddress(accountAddress types.Address, accountBlockHeight uint64, ...) types.Address
- func NewGid(accountAddress types.Address, accountBlockHeight uint64, ...) types.Gid
- func NewTokenId(accountAddress types.Address, accountBlockHeight uint64, ...) types.TokenTypeId
- func PackConsensusGroupConditionParam(conditionIdPrefix ConditionCode, conditionId uint8, params ...interface{}) ([]byte, error)
- func PackMethodParam(contractsAddr types.Address, methodName string, params ...interface{}) ([]byte, error)
- type ConditionCode
- type ConsensusGroupInfo
- type ParamCancelPledge
- type ParamCancelRegister
- type ParamMintage
- type ParamRegister
- type ParamReward
- type ParamVote
- type PledgeInfo
- type Registration
- type StorageDatabase
- type TokenInfo
- type VariableConditionRegisterOfPledge
- type VariableConditionVoteOfKeepToken
- type VariablePledgeBeneficial
- type VoteInfo
Constants ¶
View Source
const ( MethodNameRegister = "Register" MethodNameCancelRegister = "CancelRegister" MethodNameReward = "Reward" MethodNameUpdateRegistration = "UpdateRegistration" VariableNameRegistration = "registration" MethodNameVote = "Vote" MethodNameCancelVote = "CancelVote" VariableNameVoteStatus = "voteStatus" MethodNamePledge = "Pledge" MethodNameCancelPledge = "CancelPledge" VariableNamePledgeInfo = "pledgeInfo" VariableNamePledgeBeneficial = "pledgeBeneficial" MethodNameCreateConsensusGroup = "CreateConsensusGroup" MethodNameCancelConsensusGroup = "CancelConsensusGroup" MethodNameReCreateConsensusGroup = "ReCreateConsensusGroup" VariableNameConsensusGroupInfo = "consensusGroupInfo" VariableNameConditionRegisterOfPledge = "registerOfPledge" VariableNameConditionVoteOfBalance = "voteOfKeepToken" MethodNameMintage = "Mintage" MethodNameMintageCancelPledge = "CancelPledge" VariableNameMintage = "mintage" )
Variables ¶
View Source
var (
ABIRegister, _ = abi.JSONToABIContract(strings.NewReader(jsonRegister))
ABIVote, _ = abi.JSONToABIContract(strings.NewReader(jsonVote))
ABIPledge, _ = abi.JSONToABIContract(strings.NewReader(jsonPledge))
ABIConsensusGroup, _ = abi.JSONToABIContract(strings.NewReader(jsonConsensusGroup))
ABIMintage, _ = abi.JSONToABIContract(strings.NewReader(jsonMintage))
)
View Source
var (
AddressRegister, _ = types.BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1})
AddressVote, _ = types.BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2})
AddressPledge, _ = types.BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3})
AddressConsensusGroup, _ = types.BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4})
AddressMintage, _ = types.BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5})
)
Functions ¶
func GetAddrFromVoteKey ¶
func GetConsensusGroupKey ¶
func GetMintageKey ¶
func GetMintageKey(tokenId types.TokenTypeId) []byte
func GetPledgeBeneficialAmount ¶
func GetPledgeBeneficialAmount(db StorageDatabase, beneficial types.Address) *big.Int
func GetPledgeBeneficialKey ¶
func GetTokenIdFromMintageKey ¶
func GetTokenIdFromMintageKey(key []byte) types.TokenTypeId
func GetTokenMap ¶
func GetTokenMap(db StorageDatabase) map[types.TokenTypeId]*TokenInfo
func IsPledgeKey ¶
func NewContractAddress ¶
func NewTokenId ¶
func PackConsensusGroupConditionParam ¶
func PackConsensusGroupConditionParam(conditionIdPrefix ConditionCode, conditionId uint8, params ...interface{}) ([]byte, error)
pack consensus group condition params by condition id
Types ¶
type ConditionCode ¶
type ConditionCode uint8
const ( RegisterConditionPrefix ConditionCode = 10 VoteConditionPrefix ConditionCode = 20 RegisterConditionOfPledge ConditionCode = 11 VoteConditionOfDefault ConditionCode = 21 VoteConditionOfBalance ConditionCode = 22 )
type ConsensusGroupInfo ¶
type ConsensusGroupInfo struct { Gid types.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 types.TokenTypeId // Token id for selecting miner through vote RegisterConditionId uint8 RegisterConditionParam []byte VoteConditionId uint8 VoteConditionParam []byte Owner types.Address PledgeAmount *big.Int WithdrawHeight uint64 }
func GetActiveConsensusGroupList ¶
func GetActiveConsensusGroupList(db StorageDatabase) []*ConsensusGroupInfo
func GetConsensusGroup ¶
func GetConsensusGroup(db StorageDatabase, gid types.Gid) *ConsensusGroupInfo
func (*ConsensusGroupInfo) IsActive ¶
func (groupInfo *ConsensusGroupInfo) IsActive() bool
type ParamCancelRegister ¶
type ParamMintage ¶
type ParamRegister ¶
type ParamReward ¶
type PledgeInfo ¶
func GetPledgeAmount ¶
func GetPledgeAmount(db StorageDatabase, addr types.Address) []*PledgeInfo
type Registration ¶
type Registration struct { Name string NodeAddr types.Address PledgeAddr types.Address BeneficialAddr types.Address Amount *big.Int PledgeHeight uint64 RewardHeight uint64 CancelHeight uint64 }
func GetRegisterList ¶
func GetRegisterList(db StorageDatabase, gid types.Gid) []*Registration
func (*Registration) IsActive ¶
func (r *Registration) IsActive() bool
type StorageDatabase ¶
type StorageDatabase interface { GetStorage(addr *types.Address, key []byte) []byte NewStorageIterator(prefix []byte) vmctxt_interface.StorageIterator }
type TokenInfo ¶
type TokenInfo struct { TokenName string TokenSymbol string TotalSupply *big.Int Decimals uint8 Owner types.Address PledgeAmount *big.Int WithdrawHeight uint64 }
func GetTokenById ¶
func GetTokenById(db StorageDatabase, tokenId types.TokenTypeId) *TokenInfo
type VariableConditionRegisterOfPledge ¶
type VariableConditionRegisterOfPledge struct { PledgeAmount *big.Int PledgeToken types.TokenTypeId PledgeHeight uint64 }
type VariableConditionVoteOfKeepToken ¶
type VariableConditionVoteOfKeepToken struct { KeepAmount *big.Int KeepToken types.TokenTypeId }
Click to show internal directories.
Click to hide internal directories.