contracts

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: GPL-3.0 Imports: 35 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 (
	DappPrefix               = "dapp"
	OwnerPrefix              = "owner"
	DappOccupyNamePrefix     = "occupy-dapp-name"
	DappOccupyContractPrefix = "occupy-dapp-contract"
)
View Source
const (
	PROPOSAL_PREFIX       = "proposal"
	PROPOSALFREOM_PREFIX  = "from"
	PROPOSALOBJ_PREFIX    = "obj"
	PROPOSALTYPE_PREFIX   = "type"
	PROPOSALSTATUS_PREFIX = "status"

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

	PROPOSED ProposalStatus = "proposed"
	APPROVED 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"

	FALSE = "false"
	TRUE  = "true"
)
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"
	SrcBitXHubNotAvailable     = "source bitxhub not available"
	TargetBitXHubNotAvailable  = "target bitxhub not available"
	CurServiceNotAvailable     = "current service not available"
	TargetServiceNotAvailable  = "target service not available"
	InvalidIBTP                = "invalid ibtp"
	InvalidTargetService       = "invalid target service"

	DEFAULT_UNION_PIER_ID    = "default_union_pier_id"
	INTERCHAINSERVICE_PREFIX = "service"
	MULTITX_PREFIX           = "multitx"
)
View Source
const (
	GenesisBalance = "genesis_balance"

	RolePrefix              = "role"
	RoleTypePrefix          = "type"
	RoleAppchainAdminPrefix = "appchain"

	GovernanceAdmin      RoleType = "governanceAdmin"
	SuperGovernanceAdmin RoleType = "superGovernanceAdmin"
	AuditAdmin           RoleType = "auditAdmin"
	AppchainAdmin        RoleType = "appchainAdmin"
	NoRole               RoleType = "none"

	PermissionSelf     Permission = "PermissionSelf"
	PermissionAdmin    Permission = "PermissionAdmin"
	PermissionSpecific Permission = "PermissionSpecific"
)
View Source
const (
	PREFIX         = "tx"
	TIMEOUT_PREFIX = "timeout"
)
View Source
const (
	MinimumVPNode = 4
)

Variables

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

Functions

func CheckRuleAddress added in v1.15.0

func CheckRuleAddress(persister governance.Persister, addr, chainType string) *boltvm.Response

func DappKey added in v1.11.2

func DappKey(id string) string

func DappOccupyContractKey added in v1.15.0

func DappOccupyContractKey(addr string) string

func DappOccupyNameKey added in v1.15.0

func DappOccupyNameKey(name string) string

func EthTxKey added in v1.10.0

func EthTxKey(hash string) string

func GlobalTxInfoKey added in v1.15.0

func GlobalTxInfoKey(id string) string

func IndexMapKey added in v1.11.2

func IndexMapKey(id string) string

func IndexReceiptMapKey added in v1.14.0

func IndexReceiptMapKey(id string) string

func MultiTxNotifyKey added in v1.15.0

func MultiTxNotifyKey(height uint64) string

func OwnerKey added in v1.11.2

func OwnerKey(addr string) string

func ProposalFromKey added in v1.11.1

func ProposalFromKey(id string) string

func ProposalKey added in v1.6.0

func ProposalKey(id string) string

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

func ProposalObjKey added in v1.14.0

func ProposalObjKey(id string) string

func ProposalStatusKey added in v1.14.0

func ProposalStatusKey(status string) string

func ProposalTypKey added in v1.14.0

func ProposalTypKey(typ string) string

func RoleAppchainAdminKey added in v1.15.0

func RoleAppchainAdminKey(appchainID string) string

func RoleKey added in v1.13.0

func RoleKey(id string) string

func RoleTypeKey added in v1.13.0

func RoleTypeKey(typ 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 activates frozen 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 all status

func (*AppchainManager) CountAvailableAppchains added in v1.6.0

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

CountAvailableAppchains counts all available appchains

func (*AppchainManager) FreezeAppchain added in v1.6.1

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

=========== FreezeAppchain freezes appchain

func (*AppchainManager) GetAdminByChainId added in v1.15.0

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

func (*AppchainManager) GetAppchain

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

GetAppchain returns appchain info by appchain id

func (*AppchainManager) GetAppchainByName added in v1.15.0

func (am *AppchainManager) GetAppchainByName(name string) *boltvm.Response

GetAppchain returns appchain info by appchain id

func (*AppchainManager) GetBitXHubChainIDs added in v1.13.0

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

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 logouts appchain

func (*AppchainManager) Manage added in v1.8.0

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

=========== Manage does some subsequent operations when the proposal is over

func (*AppchainManager) PauseAppchain added in v1.11.2

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

=========== PauseAppchain freezes appchain without governance This function is triggered when the master rule is updating. Information about the appchain before the pause is returned

so that the appchain can be restored when unpause is invoked.

func (*AppchainManager) RegisterAppchain added in v1.13.0

func (am *AppchainManager) RegisterAppchain(chainID string, chainName string, chainType string, trustRoot []byte, broker string, desc, masterRuleAddr, masterRuleUrl, adminAddrs, reason string) *boltvm.Response

=========== RegisterAppchain registers appchain info, returns proposal id and error

func (*AppchainManager) UnPauseAppchain added in v1.11.2

func (am *AppchainManager) UnPauseAppchain(id, lastStatus string) *boltvm.Response

=========== UnPauseAppchain restores to the state before the appchain was suspended This exist when the rule is update successsfully

func (*AppchainManager) UpdateAppchain

func (am *AppchainManager) UpdateAppchain(id, name, desc string, trustRoot []byte, adminAddrs, reason string) *boltvm.Response

=========== UpdateAppchain updates appchain info. This is currently no need for voting governance.

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 CallFunc added in v1.14.0

type CallFunc struct {
	CallF string   `json:"call_f"`
	Args  []string `json:"args"`
}

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 Dapp added in v1.11.2

type Dapp struct {
	DappID       string              `json:"dapp_id"` // first owner address + num
	Name         string              `json:"name"`
	Type         DappType            `json:"type"`
	Desc         string              `json:"desc"`
	Url          string              `json:"url"`
	ContractAddr map[string]struct{} `json:"contract_addr"`
	Permission   map[string]struct{} `json:"permission"` // users which are not allowed to see the dapp
	OwnerAddr    string              `json:"owner_addr"`
	CreateTime   int64               `json:"create_time"`

	Score             float64                                 `json:"score"`
	EvaluationRecords map[string]*governance.EvaluationRecord `json:"evaluation_records"`
	TransferRecords   []*TransferRecord                       `json:"transfer_records"`

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

func (*Dapp) IsAvailable added in v1.11.2

func (d *Dapp) IsAvailable() bool

type DappManager added in v1.11.2

type DappManager struct {
	boltvm.Stub
}

func (*DappManager) ActivateDapp added in v1.11.2

func (dm *DappManager) ActivateDapp(id, reason string) *boltvm.Response

=========== ActivateDapp activates frozen dapp

func (*DappManager) ConfirmTransfer added in v1.11.2

func (dm *DappManager) ConfirmTransfer(id string) *boltvm.Response

func (*DappManager) EvaluateDapp added in v1.11.2

func (dm *DappManager) EvaluateDapp(id, desc string, score float64) *boltvm.Response

func (*DappManager) FreezeDapp added in v1.11.2

func (dm *DappManager) FreezeDapp(id, reason string) *boltvm.Response

=========== FreezeDapp freezes dapp

func (*DappManager) GetAllDapps added in v1.11.2

func (dm *DappManager) GetAllDapps() *boltvm.Response

GetAllDapps returns all dapps

func (*DappManager) GetDapp added in v1.11.2

func (dm *DappManager) GetDapp(id string) *boltvm.Response

========================== Query interface ======================== GetDapp returns dapp info by dapp id

func (*DappManager) GetDappsByOwner added in v1.11.2

func (dm *DappManager) GetDappsByOwner(ownerAddr string) *boltvm.Response

get dApps by owner addr, including dApps a person currently owns and the dApps they once owned

func (*DappManager) GetPermissionAvailableDapps added in v1.11.2

func (dm *DappManager) GetPermissionAvailableDapps(caller string) *boltvm.Response

GetPermissionAvailableDapps returns the available DApp that the caller is allowed to call

func (*DappManager) GetPermissionDapps added in v1.11.2

func (dm *DappManager) GetPermissionDapps(caller string) *boltvm.Response

GetPermissionDapps returns all the DApp that the caller is allowed to call

func (*DappManager) IsAvailable added in v1.11.2

func (dm *DappManager) IsAvailable(dappID string) *boltvm.Response

func (*DappManager) Manage added in v1.11.2

func (dm *DappManager) Manage(eventTyp, proposalResult, lastStatus, objId string, extra []byte) *boltvm.Response

========================== Governance interface ======================== =========== Manage does some subsequent operations when the proposal is over extra: update - dapp info, transfer - transfer record, register - dapp

func (*DappManager) RegisterDapp added in v1.11.2

func (dm *DappManager) RegisterDapp(name, typ, desc, url, conAddrs, permits, reason string) *boltvm.Response

=========== RegisterDapp registers dapp info, returns proposal id and error

func (*DappManager) TransferDapp added in v1.11.2

func (dm *DappManager) TransferDapp(id, newOwnerAddr, reason string) *boltvm.Response

=========== TransferDapp transfers dapp

func (*DappManager) UpdateDapp added in v1.11.2

func (dm *DappManager) UpdateDapp(id, name, desc, url, conAddrs, permits, reason string) *boltvm.Response

=========== UpdateDapp updates dapp info.

type DappType added in v1.11.2

type DappType string
var (
	DappTool        DappType = "tool"
	DappApplication DappType = "application"
	DappGame        DappType = "game"
	DappOthers      DappType = "others"
)

type Dapps added in v1.11.2

type Dapps []*Dapp

func (Dapps) Len added in v1.11.2

func (ds Dapps) Len() int

func (Dapps) Less added in v1.11.2

func (ds Dapps) Less(i, j int) bool

func (Dapps) Swap added in v1.11.2

func (ds Dapps) Swap(i, j int)

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) 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) 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) 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) GetProposalsByObjIdInCreateTimeOrder added in v1.11.2

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

Query proposals by the ID of the managed chain in create time order, 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) 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) 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) LockLowPriorityProposal added in v1.13.0

func (g *Governance) LockLowPriorityProposal(objId, eventTyp string) *boltvm.Response

Locks a suspended proposal for an object

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, typ, objId, objLastStatus, reason string, extra []byte) *boltvm.Response

func (*Governance) UnLockLowPriorityProposal added in v1.13.0

func (g *Governance) UnLockLowPriorityProposal(objId, eventTyp string) *boltvm.Response

Locks a suspended proposal for an object

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

func (*InterBroker) InvokeReceipt added in v1.14.0

func (ib *InterBroker) InvokeReceipt(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 InterchainInvoke added in v1.14.0

type InterchainInvoke struct {
	CallFunc CallFunc `json:"call_func"`
	Callback CallFunc `json:"callback"`
	Rollback CallFunc `json:"rollback"`
}

type InterchainManager

type InterchainManager struct {
	boltvm.Stub
}

func (*InterchainManager) DeleteInterchain

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

func (*InterchainManager) GetAllServiceIDs added in v1.15.0

func (x *InterchainManager) GetAllServiceIDs() *boltvm.Response

func (*InterchainManager) GetBitXHubID added in v1.13.0

func (x *InterchainManager) GetBitXHubID() *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

todo: the parameter name should be fullServiceID

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) 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 NodeManager added in v1.10.0

type NodeManager struct {
	boltvm.Stub
	nodemgr.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 node

func (*NodeManager) Manage added in v1.10.0

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

=========== Manage does some subsequent operations when the proposal is over extra: nil

func (*NodeManager) Nodes added in v1.10.0

func (nm *NodeManager) Nodes() *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

=========== RegisterNode registers node info, returns proposal id and error

type Permission added in v1.6.1

type Permission string

type Proposal added in v1.6.0

type Proposal struct {
	Id            string                      `json:"id"`
	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 Proposals added in v1.11.2

type Proposals []*Proposal

func (Proposals) Len added in v1.11.2

func (ps Proposals) Len() int

func (Proposals) Less added in v1.11.2

func (ps Proposals) Less(i, j int) bool

func (Proposals) Swap added in v1.11.2

func (ps Proposals) Swap(i, j int)

type RegisterAppchainInfo added in v1.15.0

type RegisterAppchainInfo struct {
	ChainInfo  *appchainMgr.Appchain `json:"chain_info"`
	MasterRule *ruleMgr.Rule         `json:"master_rule"`
	AdminAddrs string                `json:"admin_addrs"` // comma-separated list of addresses
}

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"`

	// Appchain info
	AppchainID string `toml:"appchain_id" json:"appchain_id"`

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

func (*Role) IsAvailable added in v1.13.0

func (role *Role) IsAvailable() bool

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) FreezeRole added in v1.10.1

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

=========== FreezeRole freezes role

func (*RoleManager) GetAllRoles added in v1.13.0

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

GetAllRoles query all roles

func (*RoleManager) GetAppchainAdmin added in v1.13.0

func (rm *RoleManager) GetAppchainAdmin(appchainID string) *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 addr

func (*RoleManager) GetRoleInfoById added in v1.13.0

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

GetRoleInfoById query a role info by roleId

func (*RoleManager) GetRoleWeight added in v1.10.1

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

func (*RoleManager) GetRolesByType added in v1.13.0

func (rm *RoleManager) GetRolesByType(roleType string) *boltvm.Response

func (*RoleManager) IsAnyAdmin added in v1.11.1

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

IsAdmin determines whether the role is GovernanceAdmin

func (*RoleManager) IsAnyAvailableAdmin added in v1.11.2

func (rm *RoleManager) IsAnyAvailableAdmin(roleId, roleType string) *boltvm.Response

IsAdmin determines whether the role is GovernanceAdmin

func (*RoleManager) IsAppchainAdmin added in v1.15.0

func (rm *RoleManager) IsAppchainAdmin(roleId, appchainId string) *boltvm.Response

IsAppchainAdmin determines whether the role is an appchain admin of the specifiec appchain admin 0 - false, 1 - true

func (*RoleManager) LogoutRole added in v1.10.1

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

=========== LogoutRole logouts role

func (*RoleManager) Manage added in v1.10.1

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

=========== Manage does some subsequent operations when the proposal is over extra: update - role info

func (*RoleManager) RegisterRole added in v1.10.1

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

=========== RegisterRole registers role info, returns proposal id and error

func (*RoleManager) UpdateAppchainAdmin added in v1.15.0

func (rm *RoleManager) UpdateAppchainAdmin(appchainID string, adminAddrs string) *boltvm.Response

=========== UpdateAppchainAdmin update appchain admin Only called after the appchain registration proposal has been voted through The admin addrs are checked(format is valid and registrable) before the call

and is checked when submitting appchain register proposal

type RoleType added in v1.10.1

type RoleType string

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) GetAllRules added in v1.15.0

func (rm *RuleManager) GetAllRules() *boltvm.Response

========================== Query interface ========================

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) HasMasterRule added in v1.13.0

func (rm *RuleManager) HasMasterRule(chainID 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, proposalResult, lastStatus, chainRuleID string, extra []byte) *boltvm.Response

=========== Manage does some subsequent operations when the proposal is over Currently here are only update master rule events extra: update :UpdateMasterRuleInfo

func (*RuleManager) PauseRule added in v1.13.0

func (rm *RuleManager) PauseRule(chainID string) *boltvm.Response

=========== PauseRule pause the proposals about rule of one chain. The rules management module only has updated proposals, which in this case are actually paused proposals.

func (*RuleManager) RegisterRule

func (rm *RuleManager) RegisterRule(chainID string, ruleAddress, ruleUrl string) *boltvm.Response

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

func (*RuleManager) RegisterRuleFirst added in v1.15.0

func (rm *RuleManager) RegisterRuleFirst(chainID, chainType, ruleAddress, ruleUrl string) *boltvm.Response

=========== RegisterRuleFirst registers the default rule and binds the specified master rule Only called after the appchain registration proposal has been voted through The master rule is checked(has deployed if not default) before the call

and is checked when submitting appchain register proposal

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) UnPauseRule added in v1.13.0

func (rm *RuleManager) UnPauseRule(chainID string) *boltvm.Response

=========== UnPauseRule unpause the proposals about rule of one chain.

func (*RuleManager) UpdateMasterRule added in v1.9.0

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

=========== UpdateMasterRule binds the validation rule address with the chain id and unbinds the master rule

type ServiceManager added in v1.12.0

type ServiceManager struct {
	boltvm.Stub
	servicemgr.ServiceManager
}

func (*ServiceManager) ActivateService added in v1.13.0

func (sm *ServiceManager) ActivateService(chainServiceID, reason string) *boltvm.Response

=========== ActivateService activates frozen service

func (*ServiceManager) EvaluateService added in v1.13.0

func (sm *ServiceManager) EvaluateService(chainServiceID, desc string, score float64) *boltvm.Response

func (*ServiceManager) FreezeService added in v1.13.0

func (sm *ServiceManager) FreezeService(chainServiceID, reason string) *boltvm.Response

=========== FreezeService freezes service

func (*ServiceManager) GetAllServices added in v1.13.0

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

GetAllServices returns all service

func (*ServiceManager) GetPermissionServices added in v1.13.0

func (sm *ServiceManager) GetPermissionServices(chainServiceId string) *boltvm.Response

GetPermissionServices returns all permission dapps

func (*ServiceManager) GetServiceInfo added in v1.12.0

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

========================== Query interface ======================== GetServiceInfo returns Service info by service id

func (*ServiceManager) GetServicesByAppchainID added in v1.12.0

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

GetServicesByAppchainID return services of an appchain

func (*ServiceManager) GetServicesByType added in v1.14.0

func (sm *ServiceManager) GetServicesByType(typ string) *boltvm.Response

GetServicesByAppchainID return services of an appchain

func (*ServiceManager) IsAvailable added in v1.13.0

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

func (*ServiceManager) LogoutService added in v1.13.0

func (sm *ServiceManager) LogoutService(chainServiceID, reason string) *boltvm.Response

=========== LogoutService logouts service

func (*ServiceManager) Manage added in v1.13.0

func (sm *ServiceManager) Manage(eventTyp, proposalResult, lastStatus, objId string, extra []byte) *boltvm.Response

========================== Governance interface ======================== =========== Manage does some subsequent operations when the proposal is over extra: update - service info,

func (*ServiceManager) PauseChainService added in v1.13.0

func (sm *ServiceManager) PauseChainService(chainID string) *boltvm.Response

=========== PauseChainService pauses services by chainID

func (*ServiceManager) RecordInvokeService added in v1.13.0

func (sm *ServiceManager) RecordInvokeService(fullServiceID, fromFullServiceID string, result bool) *boltvm.Response

func (*ServiceManager) RegisterService added in v1.13.0

func (sm *ServiceManager) RegisterService(chainID, serviceID, name, typ, intro string, ordered uint64, permits, details, reason string) *boltvm.Response

=========== RegisterService registers service info, returns proposal id and error

func (*ServiceManager) UnPauseChainService added in v1.13.0

func (sm *ServiceManager) UnPauseChainService(chainID string) *boltvm.Response

=========== UnPauseChainService resumes suspended services by chain id

func (*ServiceManager) UpdateService added in v1.13.0

func (sm *ServiceManager) UpdateService(chainServiceID, name, intro, permits, details, reason string) *boltvm.Response

=========== UpdateService updates service info. updata permits does not need proposal

type StatusChange added in v1.15.0

type StatusChange struct {
	PrevStatus   pb.TransactionStatus
	CurStatus    pb.TransactionStatus
	OtherIBTPIDs []string
}

func (*StatusChange) NotifyFlags added in v1.15.0

func (c *StatusChange) NotifyFlags() (bool, bool)

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 TransactionEvent added in v1.15.0

type TransactionEvent string
const (
	TransactionEvent_BEGIN         TransactionEvent = "begin"
	TransactionEvent_BEGIN_FAILURE TransactionEvent = "begin_failure"
	TransactionEvent_TIMEOUT       TransactionEvent = "timeout"
	TransactionEvent_FAILURE       TransactionEvent = "failure"
	TransactionEvent_SUCCESS       TransactionEvent = "success"
	TransactionEvent_ROLLBACK      TransactionEvent = "rollback"
	TransactionState_INIT                           = "init"
)

func (TransactionEvent) String added in v1.15.0

func (e TransactionEvent) String() string

type TransactionInfo added in v1.0.1

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

type TransactionManager added in v1.0.1

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

func (*TransactionManager) Begin added in v1.0.1

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

func (*TransactionManager) BeginMultiTXs added in v1.0.1

func (t *TransactionManager) BeginMultiTXs(globalID, ibtpID string, timeoutHeight uint64, isFailed bool, count uint64) *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 TransferRecord added in v1.11.2

type TransferRecord struct {
	From       string `json:"from"`
	To         string `json:"to"`
	Reason     string `json:"reason"`
	Confirm    bool   `json:"confirm"`
	CreateTime int64  `json:"create_time"`
}

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"`
}

type UpdateAppchainInfo added in v1.15.0

type UpdateAppchainInfo struct {
	Name       UpdateInfo `json:"name"`
	Desc       UpdateInfo `json:"desc"`
	TrustRoot  UpdateInfo `json:"trust_root"`
	AdminAddrs UpdateInfo `json:"admin_addrs"`
}

type UpdateDappInfo added in v1.11.2

type UpdateDappInfo struct {
	DappName     UpdateInfo    `json:"dapp_name"`
	Desc         UpdateInfo    `json:"desc"`
	Url          UpdateInfo    `json:"url"`
	ContractAddr UpdateMapInfo `json:"contract_addr"`
	Permission   UpdateMapInfo `json:"permission"`
}

type UpdateInfo added in v1.11.2

type UpdateInfo struct {
	OldInfo interface{}
	NewInfo interface{}
	IsEdit  bool
}

type UpdateMapInfo added in v1.11.2

type UpdateMapInfo struct {
	OldInfo map[string]struct{}
	NewInfo map[string]struct{}
	IsEdit  bool
}

type UpdateMasterRuleInfo added in v1.11.2

type UpdateMasterRuleInfo struct {
	OldRule      *ruleMgr.Rule         `json:"old_rule"`
	NewRule      *ruleMgr.Rule         `json:"new_rule"`
	AppchainInfo *appchainMgr.Appchain `json:"appchain_info"`
}

type UpdateServiceInfo added in v1.15.0

type UpdateServiceInfo struct {
	ServiceName UpdateInfo    `json:"service_name"`
	Intro       UpdateInfo    `json:"intro"`
	Details     UpdateInfo    `json:"details"`
	Permission  UpdateMapInfo `json:"permission"`
}

Jump to

Keyboard shortcuts

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