abi

package
v2.1.4+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// Method names and variable names of consensus group
	MethodNameCreateConsensusGroup        = "CreateConsensusGroup"
	MethodNameCancelConsensusGroup        = "CancelConsensusGroup"
	MethodNameReCreateConsensusGroup      = "ReCreateConsensusGroup"
	VariableNameConsensusGroupInfo        = "consensusGroupInfo"
	VariableNameConditionRegisterOfPledge = "registerOfPledge"
	VariableNameConditionVoteOfKeepToken  = "voteOfKeepToken"

	// Method names and variable names of register
	MethodNameRegister           = "Register"
	MethodNameCancelRegister     = "CancelRegister"
	MethodNameReward             = "Reward"
	MethodNameUpdateRegistration = "UpdateRegistration"
	VariableNameRegistration     = "registration"
	VariableNameHisName          = "hisName"

	// Method names and variable names of vote
	MethodNameVote         = "Vote"
	MethodNameCancelVote   = "CancelVote"
	VariableNameVoteStatus = "voteStatus"
)
View Source
const (
	MethodNameCancelMintPledge = "CancelMintPledge"
	MethodNameMint             = "Mint"
	MethodNameIssue            = "Issue"
	MethodNameBurn             = "Burn"
	MethodNameTransferOwner    = "TransferOwner"
	MethodNameChangeTokenType  = "ChangeTokenType"
	MethodNameGetTokenInfo     = "GetTokenInfo"
	VariableNameTokenInfo      = "tokenInfo"
	VariableNameTokenNameIndex = "tokenNameIndex"
	EventNameMint              = "mint"
	EventNameIssue             = "issue"
	EventNameBurn              = "burn"
	EventNameTransferOwner     = "transferOwner"
	EventNameChangeTokenType   = "changeTokenType"
)
View Source
const (
	MethodNamePledge             = "Pledge"
	MethodNameCancelPledge       = "CancelPledge"
	MethodNameAgentPledge        = "AgentPledge"
	MethodNameAgentCancelPledge  = "AgentCancelPledge"
	VariableNamePledgeInfo       = "pledgeInfo"
	VariableNamePledgeBeneficial = "pledgeBeneficial"
)

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))
)

Functions

func AppendTokenId added in v1.3.0

func AppendTokenId(oldIdList []byte, tokenId types.TokenTypeId) []byte

func DeleteTokenId added in v1.3.0

func DeleteTokenId(oldIdList []byte, tokenId types.TokenTypeId) []byte

func GetActiveConsensusGroupList

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

func GetAddrFromVoteKey

func GetAddrFromVoteKey(key []byte) types.Address

func GetAllRegistrationList

func GetAllRegistrationList(db StorageDatabase, gid types.Gid) ([]*types.Registration, error)

func GetCandidateList

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

func GetConsensusGroup

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

func GetConsensusGroupKey

func GetConsensusGroupKey(gid types.Gid) []byte

Consensus group variable keys

func GetGidFromConsensusGroupKey

func GetGidFromConsensusGroupKey(key []byte) types.Gid

func GetHisNameKey

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

func GetIndexFromPledgeKey

func GetIndexFromPledgeKey(key []byte) uint64

func GetMintageKey

func GetMintageKey(tokenId types.TokenTypeId) []byte

func GetNextIndexKey

func GetNextIndexKey(tokenSymbol string) []byte

func GetOwnerTokenIdListKey added in v1.3.0

func GetOwnerTokenIdListKey(owner types.Address) []byte

func GetPledgeAddrFromPledgeKey added in v1.3.2

func GetPledgeAddrFromPledgeKey(key []byte) types.Address

func GetPledgeBeneficialAmount

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

func GetPledgeBeneficialKey

func GetPledgeBeneficialKey(beneficial types.Address) []byte

func GetPledgeKey

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

func GetPledgeKeyPrefix

func GetPledgeKeyPrefix(addr types.Address) []byte

func GetRegisterKey

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

Register variable keys

func GetRegistration

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

func GetRegistrationList

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

func GetTokenById

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

func GetTokenIdFromMintageKey

func GetTokenIdFromMintageKey(key []byte) types.TokenTypeId

func GetTokenMap

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

func GetTokenMapByOwner added in v1.3.0

func GetTokenMapByOwner(db StorageDatabase, owner types.Address) (tokenInfoMap map[types.TokenTypeId]*types.TokenInfo, err error)

func GetVote

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

Vote readers

func GetVoteKey

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

Vote variable keys

func GetVoteKeyPerfixByGid

func GetVoteKeyPerfixByGid(gid types.Gid) []byte

func GetVoteList

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

func IsActiveRegistration

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

Register readers

func IsMintageKey added in v1.3.0

func IsMintageKey(key []byte) 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

Consensus group readers

func NewTokenId

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

func ParseTokenInfo added in v1.3.0

func ParseTokenInfo(data []byte) (*types.TokenInfo, error)

Types

type ConditionCode

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

type ParamAgentCancelPledge

type ParamAgentCancelPledge struct {
	PledgeAddress types.Address
	Beneficial    types.Address
	Amount        *big.Int
	Bid           uint8
}

type ParamAgentPledge

type ParamAgentPledge struct {
	PledgeAddress types.Address
	Beneficial    types.Address
	Bid           uint8
}

type ParamCancelPledge

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

type ParamCancelRegister

type ParamCancelRegister struct {
	Gid  types.Gid
	Name string
}

type ParamIssue added in v1.3.0

type ParamIssue struct {
	TokenId    types.TokenTypeId
	Amount     *big.Int
	Beneficial types.Address
}

type ParamMintage

type ParamMintage struct {
	TokenName     string
	TokenSymbol   string
	TotalSupply   *big.Int
	Decimals      uint8
	MaxSupply     *big.Int
	OwnerBurnOnly bool
	IsReIssuable  bool
}

type ParamRegister

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

Structs of register

type ParamReward

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

type ParamTransferOwner added in v1.3.0

type ParamTransferOwner struct {
	TokenId  types.TokenTypeId
	NewOwner types.Address
}

type ParamVote

type ParamVote struct {
	Gid      types.Gid
	NodeName string
}

Structs of vote

type PledgeInfo

type PledgeInfo struct {
	Amount         *big.Int
	WithdrawHeight uint64
	BeneficialAddr types.Address
	Agent          bool
	AgentAddress   types.Address
	Bid            uint8
}

func GetPledgeInfoList

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

type StorageDatabase

type StorageDatabase interface {
	GetValue(key []byte) ([]byte, error)
	NewStorageIterator(prefix []byte) (interfaces.StorageIterator, error)
	Address() *types.Address
}

type VariableConditionRegisterOfPledge

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

Structs of consensus group

func GetRegisterOfPledgeInfo

func GetRegisterOfPledgeInfo(data []byte) (*VariableConditionRegisterOfPledge, error)

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