Documentation ¶
Index ¶
- Constants
- Variables
- func CalcReward(db vmctxt_interface.VmDatabase, old *Registration, total bool) (uint64, uint64, *big.Int)
- func CheckCreateConsensusGroupData(db vmctxt_interface.VmDatabase, param *ConsensusGroupInfo) error
- func CheckToken(param ParamMintage) error
- 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 GetHisNameKey(addr types.Address, gid types.Gid) []byte
- func GetMintageKey(tokenId types.TokenTypeId) []byte
- func GetNewContractData(bytecode []byte, gid types.Gid) []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 GetRegisterMessageForSignature(accountAddress types.Address, 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 InitContractsConfig(isTestParam bool)
- func IsExistGid(db vmctxt_interface.VmDatabase, gid types.Gid) bool
- func IsPledgeKey(key []byte) bool
- func IsRegisterKey(key []byte) bool
- func IsUserAccount(db vmctxt_interface.VmDatabase, addr types.Address) 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 ContractsParams
- type MethodCancelConsensusGroup
- func (p *MethodCancelConsensusGroup) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodCancelConsensusGroup) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodCancelConsensusGroup) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodCancelConsensusGroup) GetRefundData() []byte
- type MethodCancelPledge
- func (p *MethodCancelPledge) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodCancelPledge) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodCancelPledge) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodCancelPledge) GetRefundData() []byte
- type MethodCancelRegister
- func (p *MethodCancelRegister) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodCancelRegister) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodCancelRegister) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodCancelRegister) GetRefundData() []byte
- type MethodCancelVote
- func (p *MethodCancelVote) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodCancelVote) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodCancelVote) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodCancelVote) GetRefundData() []byte
- type MethodCreateConsensusGroup
- func (p *MethodCreateConsensusGroup) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodCreateConsensusGroup) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodCreateConsensusGroup) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodCreateConsensusGroup) GetRefundData() []byte
- type MethodMintage
- func (p *MethodMintage) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodMintage) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodMintage) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodMintage) GetRefundData() []byte
- type MethodMintageCancelPledge
- func (p *MethodMintageCancelPledge) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodMintageCancelPledge) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodMintageCancelPledge) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodMintageCancelPledge) GetRefundData() []byte
- type MethodPledge
- func (p *MethodPledge) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodPledge) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodPledge) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodPledge) GetRefundData() []byte
- type MethodReCreateConsensusGroup
- func (p *MethodReCreateConsensusGroup) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodReCreateConsensusGroup) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodReCreateConsensusGroup) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodReCreateConsensusGroup) GetRefundData() []byte
- type MethodRegister
- func (p *MethodRegister) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodRegister) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodRegister) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodRegister) GetRefundData() []byte
- type MethodReward
- func (p *MethodReward) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodReward) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodReward) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodReward) GetRefundData() []byte
- type MethodUpdateRegistration
- func (p *MethodUpdateRegistration) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodUpdateRegistration) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodUpdateRegistration) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodUpdateRegistration) GetRefundData() []byte
- type MethodVote
- func (p *MethodVote) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, ...) error
- func (p *MethodVote) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
- func (p *MethodVote) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
- func (p *MethodVote) GetRefundData() []byte
- type NodeConfig
- type ParamCancelPledge
- type ParamCancelRegister
- type ParamMintage
- type ParamRegister
- type ParamReward
- type ParamVote
- type PledgeInfo
- type PrecompiledContractMethod
- type Registration
- type StorageDatabase
- type TokenInfo
- type VariableConditionRegisterOfPledge
- type VariableConditionVoteOfKeepToken
- type VariablePledgeBeneficial
- type VoteInfo
Constants ¶
const ( MethodNameCreateConsensusGroup = "CreateConsensusGroup" MethodNameCancelConsensusGroup = "CancelConsensusGroup" MethodNameReCreateConsensusGroup = "ReCreateConsensusGroup" VariableNameConsensusGroupInfo = "consensusGroupInfo" VariableNameConditionRegisterOfPledge = "registerOfPledge" VariableNameConditionVoteOfKeepToken = "voteOfKeepToken" )
const ( MethodNameMintage = "Mintage" MethodNameMintageCancelPledge = "CancelPledge" VariableNameMintage = "mintage" )
const ( MethodNamePledge = "Pledge" MethodNameCancelPledge = "CancelPledge" VariableNamePledgeInfo = "pledgeInfo" VariableNamePledgeBeneficial = "pledgeBeneficial" )
const ( MethodNameRegister = "Register" MethodNameCancelRegister = "CancelRegister" MethodNameReward = "Reward" MethodNameUpdateRegistration = "UpdateRegistration" VariableNameRegistration = "registration" VariableNameHisName = "hisName" )
const ( MethodNameVote = "Vote" MethodNameCancelVote = "CancelVote" VariableNameVoteStatus = "voteStatus" )
const ( RegisterGas uint64 = 62200 UpdateRegistrationGas uint64 = 62200 CancelRegisterGas uint64 = 83200 RewardGas uint64 = 238800 VoteGas uint64 = 21000 CancelVoteGas uint64 = 62000 PledgeGas uint64 = 21000 CancelPledgeGas uint64 = 103400 CreateConsensusGroupGas uint64 = 62200 CancelConsensusGroupGas uint64 = 83200 ReCreateConsensusGroupGas uint64 = 62200 MintageGas uint64 = 83200 MintageCancelPledgeGas uint64 = 83200 MaxRewardCount uint64 = 7776000 )
Variables ¶
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})
)
var ( ContractsParamsTest = ContractsParams{ MinPledgeHeight: 1, CreateConsensusGroupPledgeHeight: 1, MintagePledgeHeight: 1, RewardHeightLimit: 1, } ContractsParamsMainNet = ContractsParams{ MinPledgeHeight: 3600 * 24 * 3, CreateConsensusGroupPledgeHeight: 3600 * 24 * 3, MintagePledgeHeight: 3600 * 24 * 30 * 3, RewardHeightLimit: 60 * 30, } )
var (
ABIConsensusGroup, _ = abi.JSONToABIContract(strings.NewReader(jsonConsensusGroup))
)
var (
ABIMintage, _ = abi.JSONToABIContract(strings.NewReader(jsonMintage))
)
var (
ABIPledge, _ = abi.JSONToABIContract(strings.NewReader(jsonPledge))
)
var (
ABIRegister, _ = abi.JSONToABIContract(strings.NewReader(jsonRegister))
)
var (
ABIVote, _ = abi.JSONToABIContract(strings.NewReader(jsonVote))
)
var SimpleCountingRuleList = map[ConditionCode]createConsensusGroupCondition{
RegisterConditionOfPledge: ®isterConditionOfPledge{},
VoteConditionOfDefault: &voteConditionOfDefault{},
VoteConditionOfBalance: &voteConditionOfKeepToken{},
}
Functions ¶
func CalcReward ¶
func CalcReward(db vmctxt_interface.VmDatabase, old *Registration, total bool) (uint64, uint64, *big.Int)
func CheckCreateConsensusGroupData ¶
func CheckCreateConsensusGroupData(db vmctxt_interface.VmDatabase, param *ConsensusGroupInfo) error
func CheckToken ¶
func CheckToken(param ParamMintage) error
func GetAddrFromVoteKey ¶
func GetConsensusGroupKey ¶
func GetMintageKey ¶
func GetMintageKey(tokenId types.TokenTypeId) []byte
func GetNewContractData ¶
TODO following method belongs to vm
func GetPledgeBeneficialAmount ¶
func GetPledgeBeneficialAmount(db StorageDatabase, beneficial types.Address) *big.Int
func GetPledgeBeneficialKey ¶
func GetRegisterMessageForSignature ¶
Sign certain tx data using private key of node address to prove ownership of node address
func GetTokenIdFromMintageKey ¶
func GetTokenIdFromMintageKey(key []byte) types.TokenTypeId
func GetTokenMap ¶
func GetTokenMap(db StorageDatabase) map[types.TokenTypeId]*TokenInfo
func InitContractsConfig ¶
func InitContractsConfig(isTestParam bool)
func IsExistGid ¶
func IsExistGid(db vmctxt_interface.VmDatabase, gid types.Gid) bool
func IsPledgeKey ¶
func IsRegisterKey ¶
func IsUserAccount ¶
func IsUserAccount(db vmctxt_interface.VmDatabase, addr types.Address) bool
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 ContractsParams ¶
type ContractsParams struct { MinPledgeHeight uint64 // Minimum pledge height CreateConsensusGroupPledgeHeight uint64 // Pledge height for registering to be a super node of snapshot group and common delegate group MintagePledgeHeight uint64 // Pledge height for mintage if choose to pledge instead of destroy vite token RewardHeightLimit uint64 // Cannot get snapshot block reward of current few blocks, for latest snapshot block could be reverted }
type MethodCancelConsensusGroup ¶
type MethodCancelConsensusGroup struct{}
func (*MethodCancelConsensusGroup) DoReceive ¶
func (p *MethodCancelConsensusGroup) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodCancelConsensusGroup) DoSend ¶
func (p *MethodCancelConsensusGroup) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
Cancel consensus group and get pledge back. A canceled consensus group(no-active) will not generate contract blocks after cancel receive block is confirmed. Consensus group name is kept even if canceled.
func (*MethodCancelConsensusGroup) GetFee ¶
func (p *MethodCancelConsensusGroup) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodCancelConsensusGroup) GetRefundData ¶
func (p *MethodCancelConsensusGroup) GetRefundData() []byte
type MethodCancelPledge ¶
type MethodCancelPledge struct{}
func (*MethodCancelPledge) DoReceive ¶
func (p *MethodCancelPledge) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodCancelPledge) DoSend ¶
func (p *MethodCancelPledge) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
cancel pledge ViteToken
func (*MethodCancelPledge) GetFee ¶
func (p *MethodCancelPledge) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodCancelPledge) GetRefundData ¶
func (p *MethodCancelPledge) GetRefundData() []byte
type MethodCancelRegister ¶
type MethodCancelRegister struct { }
func (*MethodCancelRegister) DoReceive ¶
func (p *MethodCancelRegister) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodCancelRegister) DoSend ¶
func (p *MethodCancelRegister) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
cancel register to become a super node of a consensus group after registered for 3 month, get 100w ViteToken back
func (*MethodCancelRegister) GetFee ¶
func (p *MethodCancelRegister) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodCancelRegister) GetRefundData ¶
func (p *MethodCancelRegister) GetRefundData() []byte
type MethodCancelVote ¶
type MethodCancelVote struct { }
func (*MethodCancelVote) DoReceive ¶
func (p *MethodCancelVote) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodCancelVote) DoSend ¶
func (p *MethodCancelVote) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
cancel vote for a super node of a consensus group
func (*MethodCancelVote) GetFee ¶
func (p *MethodCancelVote) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodCancelVote) GetRefundData ¶
func (p *MethodCancelVote) GetRefundData() []byte
type MethodCreateConsensusGroup ¶
type MethodCreateConsensusGroup struct{}
func (*MethodCreateConsensusGroup) DoReceive ¶
func (p *MethodCreateConsensusGroup) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodCreateConsensusGroup) DoSend ¶
func (p *MethodCreateConsensusGroup) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
func (*MethodCreateConsensusGroup) GetFee ¶
func (p *MethodCreateConsensusGroup) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodCreateConsensusGroup) GetRefundData ¶
func (p *MethodCreateConsensusGroup) GetRefundData() []byte
type MethodMintage ¶
type MethodMintage struct{}
func (*MethodMintage) DoReceive ¶
func (p *MethodMintage) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodMintage) DoSend ¶
func (p *MethodMintage) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
func (*MethodMintage) GetFee ¶
func (p *MethodMintage) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodMintage) GetRefundData ¶
func (p *MethodMintage) GetRefundData() []byte
type MethodMintageCancelPledge ¶
type MethodMintageCancelPledge struct{}
func (*MethodMintageCancelPledge) DoReceive ¶
func (p *MethodMintageCancelPledge) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodMintageCancelPledge) DoSend ¶
func (p *MethodMintageCancelPledge) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
func (*MethodMintageCancelPledge) GetFee ¶
func (p *MethodMintageCancelPledge) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodMintageCancelPledge) GetRefundData ¶
func (p *MethodMintageCancelPledge) GetRefundData() []byte
type MethodPledge ¶
type MethodPledge struct{}
func (*MethodPledge) DoReceive ¶
func (p *MethodPledge) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodPledge) DoSend ¶
func (p *MethodPledge) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
pledge ViteToken for a beneficial to get quota
func (*MethodPledge) GetFee ¶
func (p *MethodPledge) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodPledge) GetRefundData ¶
func (p *MethodPledge) GetRefundData() []byte
type MethodReCreateConsensusGroup ¶
type MethodReCreateConsensusGroup struct{}
func (*MethodReCreateConsensusGroup) DoReceive ¶
func (p *MethodReCreateConsensusGroup) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodReCreateConsensusGroup) DoSend ¶
func (p *MethodReCreateConsensusGroup) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
Pledge again for a canceled consensus group. A consensus group will start generate contract blocks after recreate receive block is confirmed.
func (*MethodReCreateConsensusGroup) GetFee ¶
func (p *MethodReCreateConsensusGroup) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodReCreateConsensusGroup) GetRefundData ¶
func (p *MethodReCreateConsensusGroup) GetRefundData() []byte
type MethodRegister ¶
type MethodRegister struct { }
func (*MethodRegister) DoReceive ¶
func (p *MethodRegister) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodRegister) DoSend ¶
func (p *MethodRegister) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
register to become a super node of a consensus group, lock 1 million ViteToken for 3 month
func (*MethodRegister) GetFee ¶
func (p *MethodRegister) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodRegister) GetRefundData ¶
func (p *MethodRegister) GetRefundData() []byte
type MethodReward ¶
type MethodReward struct { }
func (*MethodReward) DoReceive ¶
func (p *MethodReward) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodReward) DoSend ¶
func (p *MethodReward) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
get reward of generating snapshot block
func (*MethodReward) GetFee ¶
func (p *MethodReward) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodReward) GetRefundData ¶
func (p *MethodReward) GetRefundData() []byte
type MethodUpdateRegistration ¶
type MethodUpdateRegistration struct { }
func (*MethodUpdateRegistration) DoReceive ¶
func (p *MethodUpdateRegistration) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodUpdateRegistration) DoSend ¶
func (p *MethodUpdateRegistration) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
update registration info
func (*MethodUpdateRegistration) GetFee ¶
func (p *MethodUpdateRegistration) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodUpdateRegistration) GetRefundData ¶
func (p *MethodUpdateRegistration) GetRefundData() []byte
type MethodVote ¶
type MethodVote struct { }
func (*MethodVote) DoReceive ¶
func (p *MethodVote) DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error
func (*MethodVote) DoSend ¶
func (p *MethodVote) DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error)
vote for a super node of a consensus group
func (*MethodVote) GetFee ¶
func (p *MethodVote) GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error)
func (*MethodVote) GetRefundData ¶
func (p *MethodVote) GetRefundData() []byte
type NodeConfig ¶
type NodeConfig struct {
// contains filtered or unexported fields
}
type ParamCancelRegister ¶
type ParamMintage ¶
type ParamReward ¶
type PledgeInfo ¶
func GetPledgeInfoList ¶
func GetPledgeInfoList(db StorageDatabase, addr types.Address) ([]*PledgeInfo, *big.Int)
type PrecompiledContractMethod ¶
type PrecompiledContractMethod interface { GetFee(context contractsContext, block *vm_context.VmAccountBlock) (*big.Int, error) // calc and use quota, check tx data DoSend(context contractsContext, block *vm_context.VmAccountBlock, quotaLeft uint64) (uint64, error) // check status, update state DoReceive(context contractsContext, block *vm_context.VmAccountBlock, sendBlock *ledger.AccountBlock) error // refund data at receive error GetRefundData() []byte }
type Registration ¶
type Registration struct { Name string NodeAddr types.Address PledgeAddr types.Address Amount *big.Int WithdrawHeight uint64 RewardHeight uint64 CancelHeight uint64 HisAddrList []types.Address }
func GetCandidateList ¶
func GetCandidateList(db StorageDatabase, gid types.Gid) []*Registration
func GetRegistration ¶
func GetRegistration(db StorageDatabase, name string, gid types.Gid) *Registration
func GetRegistrationList ¶
func GetRegistrationList(db StorageDatabase, gid types.Gid, pledgeAddr types.Address) []*Registration
func (*Registration) IsActive ¶
func (r *Registration) IsActive() bool
type StorageDatabase ¶
type StorageDatabase interface { GetStorage(addr *types.Address, key []byte) []byte NewStorageIterator(addr *types.Address, prefix []byte) vmctxt_interface.StorageIterator }
type TokenInfo ¶
type TokenInfo struct { TokenName string `json:"tokenName"` TokenSymbol string `json:"tokenSymbol"` TotalSupply *big.Int `json:"totalSupply"` Decimals uint8 `json:"decimals"` Owner types.Address `json:"owner"` PledgeAmount *big.Int `json:"pledgeAmount"` WithdrawHeight uint64 `json:"withdrawHeight"` }
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 }