abi

package
v1.2.3-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: GPL-3.0 Imports: 9 Imported by: 19

Documentation

Index

Constants

View Source
const (
	MethodNameCreateConsensusGroup        = "CreateConsensusGroup"
	MethodNameCancelConsensusGroup        = "CancelConsensusGroup"
	MethodNameReCreateConsensusGroup      = "ReCreateConsensusGroup"
	VariableNameConsensusGroupInfo        = "consensusGroupInfo"
	VariableNameConditionRegisterOfPledge = "registerOfPledge"
	VariableNameConditionVoteOfKeepToken  = "voteOfKeepToken"
)
View Source
const (
	MethodNameMintage             = "Mintage"
	MethodNameMintageCancelPledge = "CancelPledge"
	VariableNameMintage           = "mintage"
)
View Source
const (
	MethodNamePledge             = "Pledge"
	MethodNameCancelPledge       = "CancelPledge"
	VariableNamePledgeInfo       = "pledgeInfo"
	VariableNamePledgeBeneficial = "pledgeBeneficial"
)
View Source
const (
	MethodNameRegister           = "Register"
	MethodNameCancelRegister     = "CancelRegister"
	MethodNameReward             = "Reward"
	MethodNameUpdateRegistration = "UpdateRegistration"
	VariableNameRegistration     = "registration"
	VariableNameHisName          = "hisName"
)
View Source
const (
	MethodNameVote         = "Vote"
	MethodNameCancelVote   = "CancelVote"
	VariableNameVoteStatus = "voteStatus"
)

Variables

View Source
var (
	ABIConsensusGroup, _ = abi.JSONToABIContract(strings.NewReader(jsonConsensusGroup))
)
View Source
var (
	ABIMintage, _ = abi.JSONToABIContract(strings.NewReader(jsonMintage))
)
View Source
var (
	ABIPledge, _ = abi.JSONToABIContract(strings.NewReader(jsonPledge))
)
View Source
var (
	ABIRegister, _ = abi.JSONToABIContract(strings.NewReader(jsonRegister))
)
View Source
var (
	ABIVote, _ = abi.JSONToABIContract(strings.NewReader(jsonVote))
)

Functions

func GetActiveConsensusGroupList

func GetActiveConsensusGroupList(db StorageDatabase, snapshotHash *types.Hash) []*types.ConsensusGroupInfo

func GetAddrFromVoteKey

func GetAddrFromVoteKey(key []byte) types.Address

func GetBeneficialFromPledgeKey

func GetBeneficialFromPledgeKey(key []byte) types.Address

func GetCandidateList

func GetCandidateList(db StorageDatabase, gid types.Gid, snapshotHash *types.Hash) []*types.Registration

func GetConsensusGroup

func GetConsensusGroup(db StorageDatabase, gid types.Gid) *types.ConsensusGroupInfo

func GetConsensusGroupKey

func GetConsensusGroupKey(gid types.Gid) []byte

func GetGidFromConsensusGroupKey

func GetGidFromConsensusGroupKey(key []byte) types.Gid

func GetHisNameKey

func GetHisNameKey(addr types.Address, gid types.Gid) []byte

func GetMintageKey

func GetMintageKey(tokenId types.TokenTypeId) []byte

TODO no left pad

func GetPledgeBeneficialAmount

func GetPledgeBeneficialAmount(db StorageDatabase, beneficial types.Address) *big.Int

func GetPledgeBeneficialKey

func GetPledgeBeneficialKey(beneficial types.Address) []byte

func GetPledgeKey

func GetPledgeKey(addr types.Address, pledgeBeneficialKey []byte) []byte

func GetRegisterKey

func GetRegisterKey(name string, gid types.Gid) []byte

func GetRegistration

func GetRegistration(db StorageDatabase, gid types.Gid, name string) *types.Registration

func GetRegistrationList

func GetRegistrationList(db StorageDatabase, gid types.Gid, pledgeAddr types.Address) []*types.Registration

func GetTokenById

func GetTokenById(db StorageDatabase, tokenId types.TokenTypeId) *types.TokenInfo

func GetTokenIdFromMintageKey

func GetTokenIdFromMintageKey(key []byte) types.TokenTypeId

func GetTokenMap

func GetTokenMap(db StorageDatabase) map[types.TokenTypeId]*types.TokenInfo

func GetVote

func GetVote(db StorageDatabase, gid types.Gid, addr types.Address) *types.VoteInfo

func GetVoteKey

func GetVoteKey(addr types.Address, gid types.Gid) []byte

func GetVoteList

func GetVoteList(db StorageDatabase, gid types.Gid, snapshotHash *types.Hash) []*types.VoteInfo

func IsActiveRegistration

func IsActiveRegistration(db StorageDatabase, name string, gid types.Gid) bool

func IsPledgeKey

func IsPledgeKey(key []byte) bool

func IsRegisterKey

func IsRegisterKey(key []byte) bool

func NewGid

func NewGid(accountAddress types.Address, accountBlockHeight uint64, prevBlockHash types.Hash, snapshotHash types.Hash) types.Gid

func NewTokenId

func NewTokenId(accountAddress types.Address, accountBlockHeight uint64, prevBlockHash types.Hash, snapshotHash types.Hash) types.TokenTypeId

func PackConsensusGroupConditionParam

func PackConsensusGroupConditionParam(conditionIdPrefix ConditionCode, conditionId uint8, params ...interface{}) ([]byte, error)

pack consensus group condition params by condition id

func PackMethodParam

func PackMethodParam(contractsAddr types.Address, methodName string, params ...interface{}) ([]byte, error)

pack method params to byte slice

Types

type ConditionCode

type ConditionCode uint8
const (
	RegisterConditionPrefix   ConditionCode = 10
	VoteConditionPrefix       ConditionCode = 20
	RegisterConditionOfPledge ConditionCode = 11
	VoteConditionOfDefault    ConditionCode = 21
	VoteConditionOfBalance    ConditionCode = 22
)

type ParamCancelPledge

type ParamCancelPledge struct {
	Beneficial types.Address
	Amount     *big.Int
}

type ParamCancelRegister

type ParamCancelRegister struct {
	Gid  types.Gid
	Name string
}

type ParamMintage

type ParamMintage struct {
	TokenId     types.TokenTypeId
	TokenName   string
	TokenSymbol string
	TotalSupply *big.Int
	Decimals    uint8
}

type ParamRegister

type ParamRegister struct {
	Gid      types.Gid
	Name     string
	NodeAddr types.Address
}

type ParamReward

type ParamReward struct {
	Gid            types.Gid
	Name           string
	BeneficialAddr types.Address
}

type ParamVote

type ParamVote struct {
	Gid      types.Gid
	NodeName string
}

type PledgeInfo

type PledgeInfo struct {
	Amount         *big.Int
	WithdrawHeight uint64
	BeneficialAddr types.Address
}

func GetPledgeInfoList

func GetPledgeInfoList(db StorageDatabase, addr types.Address) ([]*PledgeInfo, *big.Int)

type StorageDatabase

type StorageDatabase interface {
	GetStorageBySnapshotHash(addr *types.Address, key []byte, snapshotHash *types.Hash) []byte
	NewStorageIteratorBySnapshotHash(addr *types.Address, prefix []byte, snapshotHash *types.Hash) vmctxt_interface.StorageIterator
}

type VariableConditionRegisterOfPledge

type VariableConditionRegisterOfPledge struct {
	PledgeAmount *big.Int
	PledgeToken  types.TokenTypeId
	PledgeHeight uint64
}

type VariableConditionVoteOfKeepToken

type VariableConditionVoteOfKeepToken struct {
	KeepAmount *big.Int
	KeepToken  types.TokenTypeId
}

type VariablePledgeBeneficial

type VariablePledgeBeneficial struct {
	Amount *big.Int
}

Jump to

Keyboard shortcuts

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