Documentation
¶
Index ¶
- Constants
- func GetCacheKey() string
- func GetDistributedKey() string
- func GetGovernTokenBucket() string
- func GetProposalBucket() string
- func GetProposalIDKey() []byte
- func GetTaskIDKey() []byte
- func GetTimerBucket() string
- func GetvoteCandidateKey() string
- func MakeAccountBalanceKey(account string) string
- func MakeCacheKey(account string) string
- func MakeProposalKey(proposalID string) string
- func MakeProposalLockKey(proposalID string, account string) string
- func MakeProposalLockPrefix(proposalID string) string
- func MakeProposalLockPrefixSeparator(proposalID string) string
- func MakeTimerBlockHeightPrefix(blockHeight string) string
- func MakeTimerBlockHeightPrefixSeparator(blockHeight string) string
- func MakeTimerBlockHeightTaskKey(blockHeight string, taskID string) string
- func MakeTotalSupplyKey() string
- func MakevoteCandidateKey(account string) string
- func PrefixRange(prefix []byte) []byte
- func UnParse(proposal *Proposal) ([]byte, error)
- type AllCandidate
- type CacheVoteCandidate
- type CandidateRatio
- type GovernTokenBalance
- type Proposal
- type TriggerDesc
Constants ¶
const ( GovernTokenTypeOrdinary = "ordinary" GovernTokenTypeTDPOS = "tdpos" ProposalStatusVoting = "voting" ProposalStatusCancelled = "cancelled" ProposalStatusRejected = "rejected" ProposalStatusPassed = "passed" ProposalStatusCompletedAndFailure = "completed_failure" ProposalStatusCompletedAndSuccess = "completed_success" )
const ( GovernTokenKernelContract = "$govern_token" ProposalKernelContract = "$proposal" TimerTaskKernelContract = "$timer_task" TDPOSKernelContract = "$tdpos" XPOSKernelContract = "$xpos" )
const ( StatusOK = 200 StatusException = 500 )
Variables ¶
This section is empty.
Functions ¶
func GetCacheKey ¶
func GetCacheKey() string
func GetDistributedKey ¶
func GetDistributedKey() string
GetDistributedKey get contract distributed key
func GetGovernTokenBucket ¶
func GetGovernTokenBucket() string
GetGovernTokenBucket return the govern token bucket name
func GetProposalBucket ¶
func GetProposalBucket() string
GetProposalBucket return the proposal bucket name
func GetProposalIDKey ¶
func GetProposalIDKey() []byte
GetProposalIDKey return the proposal_id key name
func GetvoteCandidateKey ¶
func GetvoteCandidateKey() string
func MakeAccountBalanceKey ¶
MakeContractMethodKey generate contract and account mapping key
func MakeCacheKey ¶
func MakeProposalKey ¶
MakeProposalKey generate proposal key
func MakeProposalLockKey ¶
MakeProposalLockKey generate proposal lock key
func MakeProposalLockPrefix ¶
MakeTimerBlockHeightPrefix generate timer and blockHeight prefix
func MakeProposalLockPrefixSeparator ¶
MakeTimerBlockHeightPrefix generate timer and blockHeight prefix
func MakeTimerBlockHeightPrefix ¶
MakeTimerBlockHeightPrefix generate timer and blockHeight prefix
func MakeTimerBlockHeightPrefixSeparator ¶
MakeTimerBlockHeightPrefix generate timer and blockHeight prefix
func MakeTimerBlockHeightTaskKey ¶
MakeTimerBlockHeightKey generate timer and blockHeight mapping key
func MakeTotalSupplyKey ¶
func MakeTotalSupplyKey() string
MakeTotalSupplyKey generate totalsupply key
func MakevoteCandidateKey ¶
func PrefixRange ¶
PrefixRange returns key range that satisfy the given prefix
Types ¶
type AllCandidate ¶
纪录所有提名人,每轮开始的时候用于更新缓存表
type CacheVoteCandidate ¶
type CacheVoteCandidate struct {
//分红比率
Ratio int64 `json:"ratio"`
//投票的人
VotingUser map[string]*big.Int `json:"voting_user"`
//总票数
TotalVote *big.Int `json:"total_vote"`
}
缓存表,产块分红读取这个
type CandidateRatio ¶
type CandidateRatio struct {
//总票数
TotalVote *big.Int `json:"total_vote"`
//分红比率
Ratio int64 `json:"ratio"`
//投票的人
VotingUser map[string]*big.Int `json:"voting_user"`
//是否是提名人(取消此提名人后数据不能删除,通过标志位修改)
IsNominate bool `json:"is_nominate"`
//我投票的人
MyVoting map[string]*big.Int `json:"my_voting"`
}
投票提名记录表(普通用户这是这张表,只是部分数据没有而已)
func NewCandidateRatio ¶
func NewCandidateRatio() *CandidateRatio
type GovernTokenBalance ¶
type GovernTokenBalance struct {
TotalBalance *big.Int `json:"total_balance"`
LockedBalance map[string]*big.Int `json:"locked_balances"`
}
Govern Token Balance TotalBalance = AvailableBalance + LockedBalance 目前包括tdpos和oridinary两种场景 用户的可转账余额是min(AvailableBalances)
func NewGovernTokenBalance ¶
func NewGovernTokenBalance() *GovernTokenBalance