contracts

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EscrowsAddrKey        = "escrows_addr_key"
	InterchainSwapAddrKey = "interchain_swap_addr_key"
	ProxyAddrKey          = "proxy_addr_key"
	EthTxHashPrefix       = "eth-hash"
)
View Source
const (
	PROPOSAL_PREFIX = "proposal-"

	AppchainMgr         ProposalType = "AppchainMgr"
	RuleMgr             ProposalType = "RuleMgr"
	NodeMgr             ProposalType = "NodeMgr"
	ServiceMgr          ProposalType = "ServiceMgr"
	RoleMgr             ProposalType = "RoleMgr"
	ProposalStrategyMgr ProposalType = "ProposalStrategyMgr"

	PROPOSED ProposalStatus = "proposed"
	APPOVED  ProposalStatus = "approve"
	REJECTED ProposalStatus = "reject"
	PAUSED   ProposalStatus = "pause"

	BallotApprove = "approve"
	BallotReject  = "reject"

	NormalReason     EndReason = "end of normal voting"
	WithdrawnReason  EndReason = "withdrawn by the proposal sponsor"
	PriorityReason   EndReason = "forced shut down by a high-priority proposal"
	ElectorateReason EndReason = "not enough valid electorate"
)
View Source
const (
	InCounterKey       = "InCounter"
	OutCounterKey      = "OutCounter"
	CallbackCounterKey = "CallbackCounter"
)
View Source
const (
	BitXHubID                  = "bitxhub-id"
	CurAppchainNotAvailable    = "current appchain not available"
	TargetAppchainNotAvailable = "target appchain not available"
	AppchainNotAvailable       = "the appchain is not available"
	ServiceNotAvailable        = "the service is not available"
	InvalidIBTP                = "invalid ibtp"
	InvalidTargetService       = "invalid target service"
	TargetServiceNotAvailable  = "target service not available"

	DEFAULT_UNION_PIER_ID = "default_union_pier_id"
)
View Source
const (
	ServicePreKey = "service-"

	REGISTERED = 0
	APPROVED   = 1
)
View Source
const (
	PREFIX         = "tx"
	TIMEOUT_PREFIX = "timeout"
)
View Source
const MinimumVPNode = 4

Variables

View Source
var SpecialProposalProposalType = []ProposalType{
	RoleMgr,
	ProposalStrategyMgr,
}

Functions

func EthTxKey added in v1.10.0

func EthTxKey(hash string) string

func NewServiceMng added in v1.12.0

func NewServiceMng() agency.Contract

func ProposalKey added in v1.6.0

func ProposalKey(id string) string

Key ====================================================================

func RuleKey added in v1.0.1

func RuleKey(id string) string

func ServiceKey added in v1.12.0

func ServiceKey(id string) string

func TimeoutKey added in v1.12.0

func TimeoutKey(height uint64) string

func TxInfoKey added in v1.12.0

func TxInfoKey(id string) string

Types

type AppchainManager

type AppchainManager struct {
	boltvm.Stub
	appchainMgr.AppchainManager
}

func (*AppchainManager) ActivateAppchain added in v1.6.1

func (am *AppchainManager) ActivateAppchain(id, reason string) *boltvm.Response

ActivateAppchain activate freezing appchain

func (*AppchainManager) Appchains

func (am *AppchainManager) Appchains() *boltvm.Response

Appchains returns all appchains

func (*AppchainManager) CountAppchains

func (am *AppchainManager) CountAppchains() *boltvm.Response

CountAppchains counts all appchains including approved, rejected or registered

func (*AppchainManager) CountAvailableAppchains added in v1.6.0

func (am *AppchainManager) CountAvailableAppchains() *boltvm.Response

CountAvailableAppchains counts all available appchains

func (*AppchainManager) DeleteAppchain

func (am *AppchainManager) DeleteAppchain(toDeleteMethod string) *boltvm.Response

func (*AppchainManager) FreezeAppchain added in v1.6.1

func (am *AppchainManager) FreezeAppchain(id, reason string) *boltvm.Response

FreezeAppchain freezes available appchain

func (*AppchainManager) GetAppchain

func (am *AppchainManager) GetAppchain(id string) *boltvm.Response

GetAppchain returns appchain info by appchain id

func (*AppchainManager) GetIdByAddr added in v1.9.0

func (am *AppchainManager) GetIdByAddr(addr string) *boltvm.Response

func (*AppchainManager) GetPubKeyByChainID

func (am *AppchainManager) GetPubKeyByChainID(id string) *boltvm.Response

GetPubKeyByChainID can get aim chain's public key using aim chain ID

func (*AppchainManager) IsAdmin

func (am *AppchainManager) IsAdmin() *boltvm.Response

func (*AppchainManager) IsAppchainAdmin added in v1.9.0

func (am *AppchainManager) IsAppchainAdmin() *boltvm.Response

GetAppchain returns appchain info by appchain id

func (*AppchainManager) IsAvailable added in v1.6.1

func (am *AppchainManager) IsAvailable(chainId string) *boltvm.Response

func (*AppchainManager) LogoutAppchain added in v1.6.1

func (am *AppchainManager) LogoutAppchain(id, reason string) *boltvm.Response

LogoutAppchain updates available appchain

func (*AppchainManager) Manage added in v1.8.0

func (am *AppchainManager) Manage(eventTyp string, proposalResult, lastStatus string, extra []byte) *boltvm.Response

extra: appchainMgr.Appchain

func (*AppchainManager) Register

func (am *AppchainManager) Register(appchainID string, docAddr, docHash, validators string,
	consensusType, chainType, name, desc, version, pubkey, reason string) *boltvm.Response

Register registers appchain info caller is the appchain manager address return appchain id, proposal id and error

func (*AppchainManager) UpdateAppchain

func (am *AppchainManager) UpdateAppchain(id, docAddr, docHash, validators string, consensusType, chainType,
	name, desc, version, pubkey, reason string) *boltvm.Response

UpdateAppchain updates available appchain

type Ballot added in v1.6.0

type Ballot struct {
	VoterAddr string `json:"voter_addr"`
	Approve   string `json:"approve"`
	Num       uint64 `json:"num"`
	Reason    string `json:"reason"`
	VoteTime  int64  `json:"vote_time"`
}

type BxhValidators added in v1.0.1

type BxhValidators struct {
	Addresses []string `json:"addresses"`
}

type ChainService added in v1.12.0

type ChainService struct {
	BxhId     string `json:"bxh_id"`
	ChainId   string `json:"chain_id"`
	ServiceId string `json:"service_id"`
	IsLocal   bool   `json:"is_local"`
}

type ContractAddr added in v1.10.0

type ContractAddr struct {
	Addr string `json:"addr"`
}

type EndReason added in v1.10.1

type EndReason string

type EthHeaderManager added in v1.10.0

type EthHeaderManager struct {
	boltvm.Stub
	// contains filtered or unexported fields
}

func NewEthHeaderManager added in v1.10.0

func NewEthHeaderManager(ropstenOracle *appchain.EthLightChainOracle) *EthHeaderManager

func (*EthHeaderManager) CurrentBlockHeader added in v1.10.0

func (ehm *EthHeaderManager) CurrentBlockHeader() *boltvm.Response

func (*EthHeaderManager) GetBlockHeader added in v1.10.0

func (ehm *EthHeaderManager) GetBlockHeader(hash string) *boltvm.Response

func (*EthHeaderManager) GetEscrowAddr added in v1.10.0

func (ehm *EthHeaderManager) GetEscrowAddr(pierAddr string) *boltvm.Response

func (*EthHeaderManager) GetInterchainSwapAddr added in v1.10.0

func (ehm *EthHeaderManager) GetInterchainSwapAddr() *boltvm.Response

func (*EthHeaderManager) GetPrefixedHash added in v1.10.0

func (ehm *EthHeaderManager) GetPrefixedHash(hash string) *boltvm.Response

func (*EthHeaderManager) GetProxyAddr added in v1.11.0

func (ehm *EthHeaderManager) GetProxyAddr() *boltvm.Response

func (*EthHeaderManager) InsertBlockHeaders added in v1.10.0

func (ehm *EthHeaderManager) InsertBlockHeaders(headersData []byte) *boltvm.Response

func (*EthHeaderManager) IsAdmin added in v1.10.0

func (ehm *EthHeaderManager) IsAdmin() *boltvm.Response

func (*EthHeaderManager) Mint added in v1.10.0

func (ehm *EthHeaderManager) Mint(receiptData []byte, proofData []byte) *boltvm.Response

func (*EthHeaderManager) SetEscrowAddr added in v1.10.0

func (ehm *EthHeaderManager) SetEscrowAddr(pierAddr string, addr string) *boltvm.Response

func (*EthHeaderManager) SetInterchainSwapAddr added in v1.10.0

func (ehm *EthHeaderManager) SetInterchainSwapAddr(addr string) *boltvm.Response

func (*EthHeaderManager) SetProxyAddr added in v1.11.0

func (ehm *EthHeaderManager) SetProxyAddr(addr string) *boltvm.Response

type Governance added in v1.6.0

type Governance struct {
	boltvm.Stub
}

func (*Governance) GetAgainst added in v1.6.0

func (g *Governance) GetAgainst(id string) *boltvm.Response

Get negative vote information

func (*Governance) GetAgainstNum added in v1.6.0

func (g *Governance) GetAgainstNum(id string) *boltvm.Response

Get the total number of negative votes

func (*Governance) GetApprove added in v1.6.0

func (g *Governance) GetApprove(id string) *boltvm.Response

Get affirmative vote information

func (*Governance) GetApproveNum added in v1.6.0

func (g *Governance) GetApproveNum(id string) *boltvm.Response

Get the total number of affirmative votes

func (*Governance) GetAvaliableElectorateNum added in v1.10.1

func (g *Governance) GetAvaliableElectorateNum(id string) *boltvm.Response

Get the number of total votes, include all votes cast and all votes not cast

func (*Governance) GetBallot added in v1.6.0

func (g *Governance) GetBallot(voterAddr, proposalId string) *boltvm.Response

func (*Governance) GetDes added in v1.6.0

func (g *Governance) GetDes(id string) *boltvm.Response

Get proposal description information

func (*Governance) GetNotClosedProposals added in v1.10.1

func (g *Governance) GetNotClosedProposals() *boltvm.Response

get proposal which is not closed (status is proposed or paused)

func (*Governance) GetPrimaryElectorateNum added in v1.10.1

func (g *Governance) GetPrimaryElectorateNum(id string) *boltvm.Response

Get the number of total votes, include all votes cast and all votes not cast

func (*Governance) GetProposal added in v1.6.0

func (g *Governance) GetProposal(id string) *boltvm.Response

GetProposal query proposal by id

func (*Governance) GetProposalStrategy added in v1.6.0

func (g *Governance) GetProposalStrategy(pt string) *boltvm.Response

func (*Governance) GetProposalStrategyType added in v1.6.0

func (g *Governance) GetProposalStrategyType(pt string) *boltvm.Response

func (*Governance) GetProposalsByFrom added in v1.6.0

func (g *Governance) GetProposalsByFrom(from string) *boltvm.Response

Query proposals by proposal type, returning a list of proposal for that type

func (*Governance) GetProposalsByObjId added in v1.8.0

func (g *Governance) GetProposalsByObjId(objId string) *boltvm.Response

Query proposals by the ID of the managed chain, returning a list of proposal for that type

func (*Governance) GetProposalsByStatus added in v1.6.0

func (g *Governance) GetProposalsByStatus(status string) *boltvm.Response

Query proposals based on proposal status, returning a list of proposal for that status

func (*Governance) GetProposalsByTyp added in v1.6.0

func (g *Governance) GetProposalsByTyp(typ string) *boltvm.Response

Query proposals by proposal type, returning a list of proposal for that type

func (*Governance) GetStatus added in v1.6.0

func (g *Governance) GetStatus(id string) *boltvm.Response

Get proposal status

func (*Governance) GetThresholdNum added in v1.6.0

func (g *Governance) GetThresholdNum(id string) *boltvm.Response

Get the minimum number of votes required for the current voting strategy

func (*Governance) GetTyp added in v1.6.0

func (g *Governance) GetTyp(id string) *boltvm.Response

Get Proposal Type

func (*Governance) GetUnvote added in v1.6.0

func (g *Governance) GetUnvote(id string) *boltvm.Response

Get Unvoted information

func (*Governance) GetUnvoteNum added in v1.6.0

func (g *Governance) GetUnvoteNum(id string) *boltvm.Response

Get Unvoted information

func (*Governance) GetVoted added in v1.6.0

func (g *Governance) GetVoted(id string) *boltvm.Response

Get voted information

func (*Governance) GetVotedNum added in v1.6.0

func (g *Governance) GetVotedNum(id string) *boltvm.Response

Get the number of people who have voted

func (*Governance) NewProposalStrategy added in v1.6.0

func (g *Governance) NewProposalStrategy(typ string, participateThreshold float64, extra []byte) *boltvm.Response

func (*Governance) SetProposalStrategy added in v1.6.0

func (g *Governance) SetProposalStrategy(pt string, psData []byte) *boltvm.Response

set proposal strategy for a proposal type

func (*Governance) SubmitProposal added in v1.6.0

func (g *Governance) SubmitProposal(from, eventTyp, des, typ, objId, objLastStatus, reason string, extra []byte) *boltvm.Response

func (*Governance) UpdateAvaliableElectorateNum added in v1.10.1

func (g *Governance) UpdateAvaliableElectorateNum(id string, num uint64) *boltvm.Response

Get the number of total votes, include all votes cast and all votes not cast

func (*Governance) Vote added in v1.6.0

func (g *Governance) Vote(id, approve string, reason string) *boltvm.Response

Add someone's voting information (each person can only vote once)

func (*Governance) WithdrawProposal added in v1.8.0

func (g *Governance) WithdrawProposal(id, reason string) *boltvm.Response

Withdraw the proposal

type InterBroker added in v1.12.0

type InterBroker struct {
	boltvm.Stub
}

InterBroker manages all interchain ibtp meta data produced on relaychain, similar to broker contract on appchain.

func (*InterBroker) EmitInterchain added in v1.12.0

func (ib *InterBroker) EmitInterchain(fromServiceId, toServiceId, funcs, args, argsCb, argsRb string) *boltvm.Response

func (*InterBroker) GetCallbackMeta added in v1.12.0

func (ib *InterBroker) GetCallbackMeta() *boltvm.Response

GetCallbackMeta returns map[string]map[string]uint64

func (*InterBroker) GetInMessage added in v1.12.0

func (ib *InterBroker) GetInMessage(from, to string, index uint64) *boltvm.Response

func (*InterBroker) GetInMeta added in v1.12.0

func (ib *InterBroker) GetInMeta() *boltvm.Response

GetInMeta returns map[string]map[string]uint64

func (*InterBroker) GetOutMessage added in v1.12.0

func (ib *InterBroker) GetOutMessage(from, to string, index uint64) *boltvm.Response

func (*InterBroker) GetOutMeta added in v1.12.0

func (ib *InterBroker) GetOutMeta() *boltvm.Response

GetOutMeta returns map[string]map[string]uint64

func (*InterBroker) InvokeInterchain added in v1.12.0

func (ib *InterBroker) InvokeInterchain(input []byte) *boltvm.Response

type InterchainInfo added in v1.6.3

type InterchainInfo struct {
	ChainId            string            `json:"chain_id"`
	InterchainCounter  uint64            `json:"interchain_counter"`
	ReceiptCounter     uint64            `json:"receipt_counter"`
	SendInterchains    []*InterchainMeta `json:"send_interchains"`
	ReceiptInterchains []*InterchainMeta `json:"receipt_interchains"`
}

type InterchainManager

type InterchainManager struct {
	boltvm.Stub
}

func (*InterchainManager) DeleteInterchain

func (x *InterchainManager) DeleteInterchain(id string) *boltvm.Response

func (*InterchainManager) GetIBTPByID

func (x *InterchainManager) GetIBTPByID(id string, isReq bool) *boltvm.Response

func (*InterchainManager) GetInterchain added in v1.0.1

func (x *InterchainManager) GetInterchain(id string) *boltvm.Response

GetInterchain returns information of the interchain count, Receipt count and SourceReceipt count by id

func (*InterchainManager) GetInterchainInfo added in v1.6.3

func (x *InterchainManager) GetInterchainInfo(chainId string) *boltvm.Response

func (*InterchainManager) HandleIBTP

func (x *InterchainManager) HandleIBTP(ibtp *pb.IBTP) *boltvm.Response

func (*InterchainManager) HandleIBTPData added in v1.12.0

func (x *InterchainManager) HandleIBTPData(input []byte) *boltvm.Response

func (*InterchainManager) Interchain

func (x *InterchainManager) Interchain(id string) *boltvm.Response

Interchain returns information of the interchain count, Receipt count and SourceReceipt count

func (*InterchainManager) ParseChainService added in v1.12.0

func (x *InterchainManager) ParseChainService(id string) *boltvm.Response

func (*InterchainManager) ProcessIBTP added in v1.0.1

func (x *InterchainManager) ProcessIBTP(ibtp *pb.IBTP, interchain *pb.Interchain) []byte

func (*InterchainManager) Register

func (x *InterchainManager) Register(chainServiceID string) *boltvm.Response

type InterchainMeta added in v1.6.3

type InterchainMeta struct {
	TargetChain string `json:"target_chain"`
	TxHash      string `json:"tx_hash"`
	Timestamp   int64  `json:"timestamp"`
}

type Item added in v1.12.0

type Item struct {
	Method     string   `json:"method"`      // method desc
	ArgType    []string `json:"arg_type"`    // method arg type
	ReturnType []string `json:"return_type"` // method return type
	Status     int32    `json:"status"`      // -1 => rejected, 1 => approved
}

type NodeManager added in v1.10.0

type NodeManager struct {
	boltvm.Stub
	node_mgr.NodeManager
}

func (*NodeManager) CountAvailableNodes added in v1.10.0

func (nm *NodeManager) CountAvailableNodes(nodeType string) *boltvm.Response

CountAvailableVPNodes counts all available node

func (*NodeManager) CountNodes added in v1.10.0

func (nm *NodeManager) CountNodes(nodeType string) *boltvm.Response

CountNodes counts all nodes

func (*NodeManager) GetNode added in v1.10.0

func (nm *NodeManager) GetNode(nodePid string) *boltvm.Response

GetNode returns node info by node id

func (*NodeManager) IsAvailable added in v1.10.0

func (nm *NodeManager) IsAvailable(nodePid string) *boltvm.Response

IsAvailable returns whether the node is available

func (*NodeManager) LogoutNode added in v1.10.0

func (nm *NodeManager) LogoutNode(nodePid, reason string) *boltvm.Response

LogoutNode logout available node

func (*NodeManager) Manage added in v1.10.0

func (nm *NodeManager) Manage(eventTyp string, proposalResult, lastStatus string, extra []byte) *boltvm.Response

extra: nodeMgr.Node

func (*NodeManager) Nodes added in v1.10.0

func (nm *NodeManager) Nodes(nodeType string) *boltvm.Response

Nodes returns all nodes

func (*NodeManager) RegisterNode added in v1.10.0

func (nm *NodeManager) RegisterNode(nodePid string, nodeVpId uint64, nodeAccount, nodeType, reason string) *boltvm.Response

Register registers node info caller is the bitxhub admin address return node pid, proposal id and error

type Permission added in v1.6.1

type Permission string

Permission manager

const (
	PermissionSelf      Permission = "PermissionSelf"
	PermissionAdmin     Permission = "PermissionAdmin"
	PermissionSelfAdmin Permission = "PermissionSelfAdmin"
	PermissionSpecific  Permission = "PermissionSpecific"
)

type Proposal added in v1.6.0

type Proposal struct {
	Id            string                      `json:"id"`
	Des           string                      `json:"des"`
	Typ           ProposalType                `json:"typ"`
	Status        ProposalStatus              `json:"status"`
	ObjId         string                      `json:"obj_id"`
	ObjLastStatus governance.GovernanceStatus `json:"obj_last_status"`
	// ballot information: voter address -> ballot
	BallotMap              map[string]Ballot    `json:"ballot_map"`
	ApproveNum             uint64               `json:"approve_num"`
	AgainstNum             uint64               `json:"against_num"`
	ElectorateList         []*Role              `json:"electorate_list"`
	InitialElectorateNum   uint64               `json:"initial_electorate_num"`
	AvaliableElectorateNum uint64               `json:"avaliable_electorate_num"`
	ThresholdElectorateNum uint64               `json:"threshold_electorate_num"`
	EventType              governance.EventType `json:"event_type"`
	EndReason              EndReason            `json:"end_reason"`
	LockProposalId         string               `json:"lock_proposal_id"`
	IsSpecial              bool                 `json:"is_special"`
	IsSuperAdminVoted      bool                 `json:"is_super_admin_voted"`
	SubmitReason           string               `json:"submit_reason"`
	WithdrawReason         string               `json:"withdraw_reason"`
	CreateTime             int64                `json:"create_time"`
	Extra                  []byte               `json:"extra"`
}

type ProposalStatus added in v1.6.0

type ProposalStatus string

type ProposalStrategy added in v1.6.0

type ProposalStrategy struct {
	Typ ProposalStrategyType `json:"typ"`
	// The minimum participation threshold.
	// Only when the number of voting participants reaches this proportion,
	// the proposal will take effect. That is, the proposal can be judged
	// according to the voting situation.
	ParticipateThreshold float64 `json:"participate_threshold"`
	Extra                []byte  `json:"extra"`
}

type ProposalStrategyType added in v1.6.0

type ProposalStrategyType string
const (
	SuperMajorityApprove ProposalStrategyType = "SuperMajorityApprove"
	SuperMajorityAgainst ProposalStrategyType = "SuperMajorityAgainst"
	SimpleMajority       ProposalStrategyType = "SimpleMajority"
)

type ProposalType added in v1.6.0

type ProposalType string

type Role

type Role struct {
	ID       string   `toml:"id" json:"id"`
	RoleType RoleType `toml:"role_type" json:"role_type"`

	// 	GovernanceAdmin info
	Weight uint64 `json:"weight" toml:"weight"`

	// AuditAdmin info
	NodePid string `toml:"pid" json:"pid"`

	Status governance.GovernanceStatus `toml:"status" json:"status"`
	FSM    *fsm.FSM                    `json:"fsm"`
}

type RoleManager added in v1.10.1

type RoleManager struct {
	boltvm.Stub
}

func (*RoleManager) ActivateRole added in v1.10.1

func (rm *RoleManager) ActivateRole(roleId, reason string) *boltvm.Response

ActivateRole updates frozen role

func (*RoleManager) CheckPermission added in v1.10.1

func (rm *RoleManager) CheckPermission(permission string, regulatedAddr string, regulatorAddr string, specificAddrsData []byte) *boltvm.Response

func (*RoleManager) FreezeRole added in v1.10.1

func (rm *RoleManager) FreezeRole(roleId, reason string) *boltvm.Response

FreezeRole freezes available role

func (*RoleManager) GetAdminRoles added in v1.10.1

func (rm *RoleManager) GetAdminRoles() *boltvm.Response

func (*RoleManager) GetAuditAdminRoles added in v1.10.1

func (rm *RoleManager) GetAuditAdminRoles() *boltvm.Response

func (*RoleManager) GetAvailableRoles added in v1.10.1

func (rm *RoleManager) GetAvailableRoles(roleTypesData []byte) *boltvm.Response

func (*RoleManager) GetRole added in v1.10.1

func (rm *RoleManager) GetRole() *boltvm.Response

GetRole return the role of the caller

func (*RoleManager) GetRoleByAddr added in v1.11.1

func (rm *RoleManager) GetRoleByAddr(addr string) *boltvm.Response

GetRole return the role of the caller

func (*RoleManager) GetRoleById added in v1.10.1

func (rm *RoleManager) GetRoleById(roleId string) *boltvm.Response

GetRole query a role by roleId

func (*RoleManager) GetRoleWeight added in v1.10.1

func (rm *RoleManager) GetRoleWeight(roleId string) *boltvm.Response

func (*RoleManager) IsAdmin added in v1.10.1

func (rm *RoleManager) IsAdmin(roleId string) *boltvm.Response

IsAdmin determines whether the role is GovernanceAdmin

func (*RoleManager) IsAnyAdmin added in v1.11.1

func (rm *RoleManager) IsAnyAdmin(roleId string) *boltvm.Response

func (*RoleManager) IsAuditAdmin added in v1.10.1

func (rm *RoleManager) IsAuditAdmin(roleId string) *boltvm.Response

IsAdmin determines whether the role is Audit Admin

func (*RoleManager) IsAvailable added in v1.10.1

func (rm *RoleManager) IsAvailable(roleId string) *boltvm.Response

IsAvailable determines whether the role is available

func (*RoleManager) IsSuperAdmin added in v1.10.1

func (rm *RoleManager) IsSuperAdmin(roleId string) *boltvm.Response

IsSuperAdmin determines whether the role is super GovernanceAdmin

func (*RoleManager) LogoutRole added in v1.10.1

func (rm *RoleManager) LogoutRole(roleId, reason string) *boltvm.Response

LogoutRole logout role

func (*RoleManager) Manage added in v1.10.1

func (rm *RoleManager) Manage(eventTyp string, proposalResult, lastStatus string, extra []byte) *boltvm.Response

extra: Role

func (*RoleManager) RegisterRole added in v1.10.1

func (rm *RoleManager) RegisterRole(roleId, roleType, nodePid, reason string) *boltvm.Response

Register registers role info caller is the bitxhub admin address return role id proposal id and error

func (*RoleManager) UpdateAuditAdminNode added in v1.10.1

func (rm *RoleManager) UpdateAuditAdminNode(roleId, nodePid, reason string) *boltvm.Response

UpdateAuditAdminNode updates nodeId of nvp role

type RoleType added in v1.10.1

type RoleType string
const (
	GenesisBalance = "genesis_balance"

	ROLEPREFIX = "role"

	GovernanceAdmin RoleType = "governanceAdmin"
	AuditAdmin      RoleType = "auditAdmin"
	AppchainAdmin   RoleType = "appchainAdmin"
	NoRole          RoleType = "none"
)

type RuleManager

type RuleManager struct {
	boltvm.Stub
	ruleMgr.RuleManager
}

RuleManager is the contract manage validation rules

func (*RuleManager) CountAvailableRules added in v1.8.0

func (rm *RuleManager) CountAvailableRules(chainId string) *boltvm.Response

CountAvailableRules counts all available rules (should be 0 or 1)

func (*RuleManager) CountRules added in v1.8.0

func (rm *RuleManager) CountRules(chainId string) *boltvm.Response

CountRules counts all rules of a chain

func (*RuleManager) DefaultRule added in v1.9.0

func (rm *RuleManager) DefaultRule(chainId string, ruleAddress string) *boltvm.Response

DefaultRule automatically adds default rules to the appchain after the appchain is registered successfully DefaultRule Adds default rules automatically. The rule will automatically bound if there is no master rule currently. All processes do not require vote. Possible situations: - Default validation rules are automatically added after successful application chain registration - It may be necessary to restore the identity of the master rule if it fails to freeze or logout

func (*RuleManager) GetAvailableRuleAddr added in v1.8.0

func (rm *RuleManager) GetAvailableRuleAddr(chainId string) *boltvm.Response

GetAvailableRuleAddr returns available rule address by appchain id and rule address

func (*RuleManager) GetMasterRule added in v1.9.0

func (rm *RuleManager) GetMasterRule(chainId string) *boltvm.Response

GetRuleByAddr returns rule by appchain id and rule address

func (*RuleManager) GetRuleByAddr added in v1.8.0

func (rm *RuleManager) GetRuleByAddr(chainId, ruleAddr string) *boltvm.Response

GetRuleByAddr returns rule by appchain id and rule address

func (*RuleManager) IsAvailableRule added in v1.8.0

func (rm *RuleManager) IsAvailableRule(chainId, ruleAddress string) *boltvm.Response

func (*RuleManager) LogoutRule added in v1.8.0

func (rm *RuleManager) LogoutRule(chainId string, ruleAddress string) *boltvm.Response

LogoutRule logout the validation rule address with the chain id

func (*RuleManager) Manage added in v1.8.0

func (rm *RuleManager) Manage(eventTyp string, proposalResult, lastStatus string, extra []byte) *boltvm.Response

extra: ruleMgr.rule

func (*RuleManager) RegisterRule

func (rm *RuleManager) RegisterRule(chainId string, ruleAddress, reason string) *boltvm.Response

Register records the rule, and then automatically binds the rule if there is no master validation rule

func (*RuleManager) Rules added in v1.8.0

func (rm *RuleManager) Rules(chainId string) *boltvm.Response

Rules returns all rules of a chain

func (*RuleManager) UpdateMasterRule added in v1.9.0

func (rm *RuleManager) UpdateMasterRule(chainId string, newMasterruleAddress, reason string) *boltvm.Response

BindRule binds the validation rule address with the chain id

type Service added in v1.12.0

type Service struct {
	ChainID    string              `json:"chain_id"`   // aoochain id
	ServiceID  string              `json:"service_id"` // service id
	Name       string              `json:"name"`       // service name
	Type       string              `json:"type"`       // service type
	Desc       string              `json:"desc"`       // service description
	Ordered    bool                `json:"ordered"`    // service should be in order or not
	Permission map[string]struct{} `json:"permission"` // counter party services which are allowed to call the service
	Items      map[string]Item     `json:"items"`      // service entities
	Status     int32               `json:"status"`     // 0 => registered, 1 => approved, -1 => rejected
}

type ServiceManager added in v1.12.0

type ServiceManager struct {
	boltvm.Stub
}

func (*ServiceManager) AddItems added in v1.12.0

func (sm *ServiceManager) AddItems(itemData []byte) *boltvm.Response

func (*ServiceManager) Audit added in v1.12.0

func (sm *ServiceManager) Audit(proposer string, isApproved int32, desc string) *boltvm.Response

func (*ServiceManager) AuditItem added in v1.12.0

func (sm *ServiceManager) AuditItem(proposer string, isApproved int32, method string, desc string) *boltvm.Response

func (*ServiceManager) Call added in v1.12.0

func (sm *ServiceManager) Call(data []byte) *boltvm.Response

func (*ServiceManager) DeleteService added in v1.12.0

func (sm *ServiceManager) DeleteService(id string) *boltvm.Response

func (*ServiceManager) GetServiceInfo added in v1.12.0

func (sm *ServiceManager) GetServiceInfo(id string) *boltvm.Response

func (*ServiceManager) GetServicesByAppchainID added in v1.12.0

func (sm *ServiceManager) GetServicesByAppchainID(appchainID string) *boltvm.Response

func (*ServiceManager) IsAdmin added in v1.12.0

func (sm *ServiceManager) IsAdmin() *boltvm.Response

func (*ServiceManager) ListService added in v1.12.0

func (sm *ServiceManager) ListService() *boltvm.Response

func (*ServiceManager) Register added in v1.12.0

func (sm *ServiceManager) Register(chainID, serviceID, name, desc, typ string, ordered bool, permit string, itemData []byte) *boltvm.Response

func (*ServiceManager) Update added in v1.12.0

func (sm *ServiceManager) Update(chainID, serviceID, name string, desc string, itemData []byte) *boltvm.Response

type Store

type Store struct {
	boltvm.Stub
}

func (*Store) Get

func (s *Store) Get(key string) *boltvm.Response

func (*Store) Set

func (s *Store) Set(key string, value string) *boltvm.Response

type TransactionInfo added in v1.0.1

type TransactionInfo struct {
	GlobalState pb.TransactionStatus
	ChildTxInfo map[string]pb.TransactionStatus
}

type TransactionManager added in v1.0.1

type TransactionManager struct {
	boltvm.Stub
}

func (*TransactionManager) Begin added in v1.0.1

func (t *TransactionManager) Begin(txId string, timeoutHeight uint64) *boltvm.Response

func (*TransactionManager) BeginMultiTXs added in v1.0.1

func (t *TransactionManager) BeginMultiTXs(globalId string, childTxIds ...string) *boltvm.Response

func (*TransactionManager) GetStatus added in v1.0.1

func (t *TransactionManager) GetStatus(txId string) *boltvm.Response

func (*TransactionManager) Report added in v1.0.1

func (t *TransactionManager) Report(txId string, result int32) *boltvm.Response

type TrustChain added in v1.12.0

type TrustChain struct {
	boltvm.Stub
}

func (*TrustChain) AddTrustMeta added in v1.12.0

func (t *TrustChain) AddTrustMeta(data []byte) *boltvm.Response

func (*TrustChain) GetTrustMeta added in v1.12.0

func (t *TrustChain) GetTrustMeta(key []byte) *boltvm.Response

type TrustMeta added in v1.12.0

type TrustMeta struct {
	ChainId           string `json:"chain_id"`
	TrustContractAddr string `json:"trust_contract_addr"`
	Method            string `json:"method"`
	Data              []byte `json:"data"`
}

Jump to

Keyboard shortcuts

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