poll

package
v2.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 46 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ConsortiumManagementABI = "" /* 5003-byte string literal not displayed */

ConsortiumManagementABI is the input ABI used to generate the binding from.

Variables

View Source
var (
	// CandidateNamespace is a namespace to store raw candidate
	CandidateNamespace = "candidates"
	// ProbationNamespace is a namespace to store probationlist
	ProbationNamespace = "kickout"
	// ErrIndexerNotExist is an error that shows not exist in candidate indexer DB
	ErrIndexerNotExist = errors.New("not exist in DB")
)
View Source
var (
	// ErrNoData is an error that there's no data in the contract
	ErrNoData = errors.New("no data")
	// ErrEndOfData is an error that reaching end of data in the contract
	ErrEndOfData = errors.New("end of data")
	// ErrWrongData is an error that data is wrong
	ErrWrongData = errors.New("wrong data")
)
View Source
var ErrDelegatesNotAsExpected = errors.New("delegates are not as expected")

ErrDelegatesNotAsExpected is an error that the delegates are not as expected

View Source
var ErrDelegatesNotExist = errors.New("delegates cannot be found")

ErrDelegatesNotExist is an error that the delegates cannot be prepared

View Source
var ErrInconsistentHeight = errors.New("data is inconsistent because the state height has been changed")

ErrInconsistentHeight is an error that result of "readFromStateDB" is not consistent with others

View Source
var ErrNoElectionCommittee = errors.New("no election committee specified")

ErrNoElectionCommittee is an error that the election committee is not specified

View Source
var ErrProposedDelegatesLength = errors.New("the proposed delegate list length")

ErrProposedDelegatesLength is an error that the proposed delegate list length is not right

View Source
var NsAbi = `` /* 12350-byte string literal not displayed */

NsAbi is the ABI of native staking contract

Functions

func ProtocolAddr

func ProtocolAddr() address.Address

ProtocolAddr returns the address generated from protocol id

Types

type BlockMeta

type BlockMeta struct {
	Height   uint64
	Producer string
	MintTime time.Time
}

BlockMeta is a struct to store block metadata

func NewBlockMeta

func NewBlockMeta(height uint64, producer string, mintTime time.Time) *BlockMeta

NewBlockMeta constructs new blockmeta struct with given fieldss

func (*BlockMeta) Decode added in v2.3.0

func (bm *BlockMeta) Decode(data systemcontracts.GenericValue) error

Decode decodes a GenericValue into BlockMeta

func (*BlockMeta) Deserialize

func (bm *BlockMeta) Deserialize(buf []byte) error

Deserialize deserializes bytes to blockMeta

func (*BlockMeta) Encode added in v2.3.0

func (bm *BlockMeta) Encode() (systemcontracts.GenericValue, error)

Encode encodes BlockMeta into a GenericValue

func (*BlockMeta) LoadProto

func (bm *BlockMeta) LoadProto(pb *blockmetapb.BlockMeta) error

LoadProto loads blockMeta from proto

func (*BlockMeta) Proto

func (bm *BlockMeta) Proto() (*blockmetapb.BlockMeta, error)

Proto converts the BlockMeta struct to a protobuf message

func (*BlockMeta) Serialize

func (bm *BlockMeta) Serialize() ([]byte, error)

Serialize serializes BlockMeta struct to bytes

type CandidateIndexer

type CandidateIndexer struct {
	// contains filtered or unexported fields
}

CandidateIndexer is an indexer to store candidate/probationList by given height

func NewCandidateIndexer

func NewCandidateIndexer(kv db.KVStore) (*CandidateIndexer, error)

NewCandidateIndexer creates a new CandidateIndexer

func (*CandidateIndexer) CandidateList

func (cd *CandidateIndexer) CandidateList(height uint64) (state.CandidateList, error)

CandidateList gets candidate list from indexer given epoch start height

func (*CandidateIndexer) ProbationList

func (cd *CandidateIndexer) ProbationList(height uint64) (*vote.ProbationList, error)

ProbationList gets probation list from indexer given epoch start height

func (*CandidateIndexer) PutCandidateList

func (cd *CandidateIndexer) PutCandidateList(height uint64, candidates *state.CandidateList) error

PutCandidateList puts candidate list into indexer

func (*CandidateIndexer) PutProbationList

func (cd *CandidateIndexer) PutProbationList(height uint64, probationList *vote.ProbationList) error

PutProbationList puts probation list into indexer

func (*CandidateIndexer) Start

func (cd *CandidateIndexer) Start(ctx context.Context) error

Start starts the indexer

func (*CandidateIndexer) Stop

func (cd *CandidateIndexer) Stop(ctx context.Context) error

Stop stops the indexer

type ConsortiumManagement

type ConsortiumManagement struct {
	ConsortiumManagementCaller     // Read-only binding to the contract
	ConsortiumManagementTransactor // Write-only binding to the contract
	ConsortiumManagementFilterer   // Log filterer for contract events
}

ConsortiumManagement is an auto generated Go binding around an Ethereum contract.

func NewConsortiumManagement

func NewConsortiumManagement(address common.Address, backend bind.ContractBackend) (*ConsortiumManagement, error)

NewConsortiumManagement creates a new instance of ConsortiumManagement, bound to a specific deployed contract.

type ConsortiumManagementAddOperator

type ConsortiumManagementAddOperator struct {
	Member   common.Address
	Operator common.Address
	Endpoint string
	Raw      types.Log // Blockchain specific contextual infos
}

ConsortiumManagementAddOperator represents a AddOperator event raised by the ConsortiumManagement contract.

type ConsortiumManagementAddOperatorIterator

type ConsortiumManagementAddOperatorIterator struct {
	Event *ConsortiumManagementAddOperator // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

ConsortiumManagementAddOperatorIterator is returned from FilterAddOperator and is used to iterate over the raw logs and unpacked data for AddOperator events raised by the ConsortiumManagement contract.

func (*ConsortiumManagementAddOperatorIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*ConsortiumManagementAddOperatorIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*ConsortiumManagementAddOperatorIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type ConsortiumManagementCaller

type ConsortiumManagementCaller struct {
	// contains filtered or unexported fields
}

ConsortiumManagementCaller is an auto generated read-only Go binding around an Ethereum contract.

func NewConsortiumManagementCaller

func NewConsortiumManagementCaller(address common.Address, caller bind.ContractCaller) (*ConsortiumManagementCaller, error)

NewConsortiumManagementCaller creates a new read-only instance of ConsortiumManagement, bound to a specific deployed contract.

func (*ConsortiumManagementCaller) Delegates

func (_ConsortiumManagement *ConsortiumManagementCaller) Delegates(opts *bind.CallOpts) ([]common.Address, error)

Delegates is a free data retrieval call binding the contract method 0x6138b19e.

Solidity: function delegates() view returns(address[])

func (*ConsortiumManagementCaller) HealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementCaller) HealthEndpoint(opts *bind.CallOpts, operator common.Address) (string, error)

HealthEndpoint is a free data retrieval call binding the contract method 0xb44d5fc7.

Solidity: function healthEndpoint(address operator) view returns(string)

func (*ConsortiumManagementCaller) IsMember

func (_ConsortiumManagement *ConsortiumManagementCaller) IsMember(opts *bind.CallOpts, addr common.Address) (bool, error)

IsMember is a free data retrieval call binding the contract method 0xa230c524.

Solidity: function isMember(address addr) view returns(bool)

func (*ConsortiumManagementCaller) Members

func (_ConsortiumManagement *ConsortiumManagementCaller) Members(opts *bind.CallOpts) ([]common.Address, error)

Members is a free data retrieval call binding the contract method 0xbdd4d18d.

Solidity: function members() view returns(address[])

func (*ConsortiumManagementCaller) Operators

func (_ConsortiumManagement *ConsortiumManagementCaller) Operators(opts *bind.CallOpts, addr common.Address) ([]common.Address, error)

Operators is a free data retrieval call binding the contract method 0x13e7c9d8.

Solidity: function operators(address addr) view returns(address[])

func (*ConsortiumManagementCaller) Proposal

func (_ConsortiumManagement *ConsortiumManagementCaller) Proposal(opts *bind.CallOpts) (struct {
	Id          *big.Int
	Proposer    common.Address
	Ptype       uint8
	Member      common.Address
	Capacity    uint8
	Approves    []common.Address
	Disapproves []common.Address
}, error)

Proposal is a free data retrieval call binding the contract method 0x753ec103.

Solidity: function proposal() view returns(uint256 id, address proposer, uint8 ptype, address member, uint8 capacity, address[] approves, address[] disapproves)

type ConsortiumManagementCallerRaw

type ConsortiumManagementCallerRaw struct {
	Contract *ConsortiumManagementCaller // Generic read-only contract binding to access the raw methods on
}

ConsortiumManagementCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.

func (*ConsortiumManagementCallerRaw) Call

func (_ConsortiumManagement *ConsortiumManagementCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

type ConsortiumManagementCallerSession

type ConsortiumManagementCallerSession struct {
	Contract *ConsortiumManagementCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts               // Call options to use throughout this session
}

ConsortiumManagementCallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.

func (*ConsortiumManagementCallerSession) Delegates

func (_ConsortiumManagement *ConsortiumManagementCallerSession) Delegates() ([]common.Address, error)

Delegates is a free data retrieval call binding the contract method 0x6138b19e.

Solidity: function delegates() view returns(address[])

func (*ConsortiumManagementCallerSession) HealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementCallerSession) HealthEndpoint(operator common.Address) (string, error)

HealthEndpoint is a free data retrieval call binding the contract method 0xb44d5fc7.

Solidity: function healthEndpoint(address operator) view returns(string)

func (*ConsortiumManagementCallerSession) IsMember

func (_ConsortiumManagement *ConsortiumManagementCallerSession) IsMember(addr common.Address) (bool, error)

IsMember is a free data retrieval call binding the contract method 0xa230c524.

Solidity: function isMember(address addr) view returns(bool)

func (*ConsortiumManagementCallerSession) Members

func (_ConsortiumManagement *ConsortiumManagementCallerSession) Members() ([]common.Address, error)

Members is a free data retrieval call binding the contract method 0xbdd4d18d.

Solidity: function members() view returns(address[])

func (*ConsortiumManagementCallerSession) Operators

func (_ConsortiumManagement *ConsortiumManagementCallerSession) Operators(addr common.Address) ([]common.Address, error)

Operators is a free data retrieval call binding the contract method 0x13e7c9d8.

Solidity: function operators(address addr) view returns(address[])

func (*ConsortiumManagementCallerSession) Proposal

func (_ConsortiumManagement *ConsortiumManagementCallerSession) Proposal() (struct {
	Id          *big.Int
	Proposer    common.Address
	Ptype       uint8
	Member      common.Address
	Capacity    uint8
	Approves    []common.Address
	Disapproves []common.Address
}, error)

Proposal is a free data retrieval call binding the contract method 0x753ec103.

Solidity: function proposal() view returns(uint256 id, address proposer, uint8 ptype, address member, uint8 capacity, address[] approves, address[] disapproves)

type ConsortiumManagementFilterer

type ConsortiumManagementFilterer struct {
	// contains filtered or unexported fields
}

ConsortiumManagementFilterer is an auto generated log filtering Go binding around an Ethereum contract events.

func NewConsortiumManagementFilterer

func NewConsortiumManagementFilterer(address common.Address, filterer bind.ContractFilterer) (*ConsortiumManagementFilterer, error)

NewConsortiumManagementFilterer creates a new log filterer instance of ConsortiumManagement, bound to a specific deployed contract.

func (*ConsortiumManagementFilterer) FilterAddOperator

func (_ConsortiumManagement *ConsortiumManagementFilterer) FilterAddOperator(opts *bind.FilterOpts) (*ConsortiumManagementAddOperatorIterator, error)

FilterAddOperator is a free log retrieval operation binding the contract event 0xc1ad0c93e1873e80f0551582678c47e2e3cd93d9f12f18b1012ed1ad51654d74.

Solidity: event AddOperator(address member, address operator, string endpoint)

func (*ConsortiumManagementFilterer) FilterPropose

func (_ConsortiumManagement *ConsortiumManagementFilterer) FilterPropose(opts *bind.FilterOpts) (*ConsortiumManagementProposeIterator, error)

FilterPropose is a free log retrieval operation binding the contract event 0x8665d2ae7d62e4273cdfc40af1cbbea2232b315ca2a2e244c833366f2b8ae9eb.

Solidity: event Propose(uint256 id, address proposer, uint8 ptype, address member, uint8 capacity)

func (*ConsortiumManagementFilterer) FilterRemoveOperator

func (_ConsortiumManagement *ConsortiumManagementFilterer) FilterRemoveOperator(opts *bind.FilterOpts) (*ConsortiumManagementRemoveOperatorIterator, error)

FilterRemoveOperator is a free log retrieval operation binding the contract event 0xb157cf3e9ae29eb366b3bdda54b41d4738ada5daa73f8d2f1bef6280bb1418e4.

Solidity: event RemoveOperator(address member, address operator)

func (*ConsortiumManagementFilterer) FilterSettleProposal

func (_ConsortiumManagement *ConsortiumManagementFilterer) FilterSettleProposal(opts *bind.FilterOpts) (*ConsortiumManagementSettleProposalIterator, error)

FilterSettleProposal is a free log retrieval operation binding the contract event 0xf412ee5dcd836b3a4fa40ae9d7e90eeea743a32f4e0ba26c91c7cbc8c3d8b44b.

Solidity: event SettleProposal(uint256 id, bool success)

func (*ConsortiumManagementFilterer) FilterUpdateOperatorHealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementFilterer) FilterUpdateOperatorHealthEndpoint(opts *bind.FilterOpts) (*ConsortiumManagementUpdateOperatorHealthEndpointIterator, error)

FilterUpdateOperatorHealthEndpoint is a free log retrieval operation binding the contract event 0x8daf704ffb23b2e479e9849d1bda8860345f6c15d43b68cd9cf8622952564895.

Solidity: event UpdateOperatorHealthEndpoint(address member, address operator, string endpoint)

func (*ConsortiumManagementFilterer) FilterVote

func (_ConsortiumManagement *ConsortiumManagementFilterer) FilterVote(opts *bind.FilterOpts) (*ConsortiumManagementVoteIterator, error)

FilterVote is a free log retrieval operation binding the contract event 0xcfa82ef0390c8f3e57ebe6c0665352a383667e792af012d350d9786ee5173d26.

Solidity: event Vote(uint256 id, address voter, bool approve)

func (*ConsortiumManagementFilterer) ParseAddOperator

func (_ConsortiumManagement *ConsortiumManagementFilterer) ParseAddOperator(log types.Log) (*ConsortiumManagementAddOperator, error)

ParseAddOperator is a log parse operation binding the contract event 0xc1ad0c93e1873e80f0551582678c47e2e3cd93d9f12f18b1012ed1ad51654d74.

Solidity: event AddOperator(address member, address operator, string endpoint)

func (*ConsortiumManagementFilterer) ParsePropose

func (_ConsortiumManagement *ConsortiumManagementFilterer) ParsePropose(log types.Log) (*ConsortiumManagementPropose, error)

ParsePropose is a log parse operation binding the contract event 0x8665d2ae7d62e4273cdfc40af1cbbea2232b315ca2a2e244c833366f2b8ae9eb.

Solidity: event Propose(uint256 id, address proposer, uint8 ptype, address member, uint8 capacity)

func (*ConsortiumManagementFilterer) ParseRemoveOperator

func (_ConsortiumManagement *ConsortiumManagementFilterer) ParseRemoveOperator(log types.Log) (*ConsortiumManagementRemoveOperator, error)

ParseRemoveOperator is a log parse operation binding the contract event 0xb157cf3e9ae29eb366b3bdda54b41d4738ada5daa73f8d2f1bef6280bb1418e4.

Solidity: event RemoveOperator(address member, address operator)

func (*ConsortiumManagementFilterer) ParseSettleProposal

func (_ConsortiumManagement *ConsortiumManagementFilterer) ParseSettleProposal(log types.Log) (*ConsortiumManagementSettleProposal, error)

ParseSettleProposal is a log parse operation binding the contract event 0xf412ee5dcd836b3a4fa40ae9d7e90eeea743a32f4e0ba26c91c7cbc8c3d8b44b.

Solidity: event SettleProposal(uint256 id, bool success)

func (*ConsortiumManagementFilterer) ParseUpdateOperatorHealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementFilterer) ParseUpdateOperatorHealthEndpoint(log types.Log) (*ConsortiumManagementUpdateOperatorHealthEndpoint, error)

ParseUpdateOperatorHealthEndpoint is a log parse operation binding the contract event 0x8daf704ffb23b2e479e9849d1bda8860345f6c15d43b68cd9cf8622952564895.

Solidity: event UpdateOperatorHealthEndpoint(address member, address operator, string endpoint)

func (*ConsortiumManagementFilterer) ParseVote

func (_ConsortiumManagement *ConsortiumManagementFilterer) ParseVote(log types.Log) (*ConsortiumManagementVote, error)

ParseVote is a log parse operation binding the contract event 0xcfa82ef0390c8f3e57ebe6c0665352a383667e792af012d350d9786ee5173d26.

Solidity: event Vote(uint256 id, address voter, bool approve)

func (*ConsortiumManagementFilterer) WatchAddOperator

func (_ConsortiumManagement *ConsortiumManagementFilterer) WatchAddOperator(opts *bind.WatchOpts, sink chan<- *ConsortiumManagementAddOperator) (event.Subscription, error)

WatchAddOperator is a free log subscription operation binding the contract event 0xc1ad0c93e1873e80f0551582678c47e2e3cd93d9f12f18b1012ed1ad51654d74.

Solidity: event AddOperator(address member, address operator, string endpoint)

func (*ConsortiumManagementFilterer) WatchPropose

func (_ConsortiumManagement *ConsortiumManagementFilterer) WatchPropose(opts *bind.WatchOpts, sink chan<- *ConsortiumManagementPropose) (event.Subscription, error)

WatchPropose is a free log subscription operation binding the contract event 0x8665d2ae7d62e4273cdfc40af1cbbea2232b315ca2a2e244c833366f2b8ae9eb.

Solidity: event Propose(uint256 id, address proposer, uint8 ptype, address member, uint8 capacity)

func (*ConsortiumManagementFilterer) WatchRemoveOperator

func (_ConsortiumManagement *ConsortiumManagementFilterer) WatchRemoveOperator(opts *bind.WatchOpts, sink chan<- *ConsortiumManagementRemoveOperator) (event.Subscription, error)

WatchRemoveOperator is a free log subscription operation binding the contract event 0xb157cf3e9ae29eb366b3bdda54b41d4738ada5daa73f8d2f1bef6280bb1418e4.

Solidity: event RemoveOperator(address member, address operator)

func (*ConsortiumManagementFilterer) WatchSettleProposal

func (_ConsortiumManagement *ConsortiumManagementFilterer) WatchSettleProposal(opts *bind.WatchOpts, sink chan<- *ConsortiumManagementSettleProposal) (event.Subscription, error)

WatchSettleProposal is a free log subscription operation binding the contract event 0xf412ee5dcd836b3a4fa40ae9d7e90eeea743a32f4e0ba26c91c7cbc8c3d8b44b.

Solidity: event SettleProposal(uint256 id, bool success)

func (*ConsortiumManagementFilterer) WatchUpdateOperatorHealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementFilterer) WatchUpdateOperatorHealthEndpoint(opts *bind.WatchOpts, sink chan<- *ConsortiumManagementUpdateOperatorHealthEndpoint) (event.Subscription, error)

WatchUpdateOperatorHealthEndpoint is a free log subscription operation binding the contract event 0x8daf704ffb23b2e479e9849d1bda8860345f6c15d43b68cd9cf8622952564895.

Solidity: event UpdateOperatorHealthEndpoint(address member, address operator, string endpoint)

func (*ConsortiumManagementFilterer) WatchVote

func (_ConsortiumManagement *ConsortiumManagementFilterer) WatchVote(opts *bind.WatchOpts, sink chan<- *ConsortiumManagementVote) (event.Subscription, error)

WatchVote is a free log subscription operation binding the contract event 0xcfa82ef0390c8f3e57ebe6c0665352a383667e792af012d350d9786ee5173d26.

Solidity: event Vote(uint256 id, address voter, bool approve)

type ConsortiumManagementPropose

type ConsortiumManagementPropose struct {
	Id       *big.Int
	Proposer common.Address
	Ptype    uint8
	Member   common.Address
	Capacity uint8
	Raw      types.Log // Blockchain specific contextual infos
}

ConsortiumManagementPropose represents a Propose event raised by the ConsortiumManagement contract.

type ConsortiumManagementProposeIterator

type ConsortiumManagementProposeIterator struct {
	Event *ConsortiumManagementPropose // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

ConsortiumManagementProposeIterator is returned from FilterPropose and is used to iterate over the raw logs and unpacked data for Propose events raised by the ConsortiumManagement contract.

func (*ConsortiumManagementProposeIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*ConsortiumManagementProposeIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*ConsortiumManagementProposeIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type ConsortiumManagementRaw

type ConsortiumManagementRaw struct {
	Contract *ConsortiumManagement // Generic contract binding to access the raw methods on
}

ConsortiumManagementRaw is an auto generated low-level Go binding around an Ethereum contract.

func (*ConsortiumManagementRaw) Call

func (_ConsortiumManagement *ConsortiumManagementRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*ConsortiumManagementRaw) Transact

func (_ConsortiumManagement *ConsortiumManagementRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*ConsortiumManagementRaw) Transfer

func (_ConsortiumManagement *ConsortiumManagementRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type ConsortiumManagementRemoveOperator

type ConsortiumManagementRemoveOperator struct {
	Member   common.Address
	Operator common.Address
	Raw      types.Log // Blockchain specific contextual infos
}

ConsortiumManagementRemoveOperator represents a RemoveOperator event raised by the ConsortiumManagement contract.

type ConsortiumManagementRemoveOperatorIterator

type ConsortiumManagementRemoveOperatorIterator struct {
	Event *ConsortiumManagementRemoveOperator // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

ConsortiumManagementRemoveOperatorIterator is returned from FilterRemoveOperator and is used to iterate over the raw logs and unpacked data for RemoveOperator events raised by the ConsortiumManagement contract.

func (*ConsortiumManagementRemoveOperatorIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*ConsortiumManagementRemoveOperatorIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*ConsortiumManagementRemoveOperatorIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type ConsortiumManagementSession

type ConsortiumManagementSession struct {
	Contract     *ConsortiumManagement // Generic contract binding to set the session for
	CallOpts     bind.CallOpts         // Call options to use throughout this session
	TransactOpts bind.TransactOpts     // Transaction auth options to use throughout this session
}

ConsortiumManagementSession is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.

func (*ConsortiumManagementSession) AddOperator

func (_ConsortiumManagement *ConsortiumManagementSession) AddOperator(operator common.Address, endpoint string) (*types.Transaction, error)

AddOperator is a paid mutator transaction binding the contract method 0x2430df89.

Solidity: function addOperator(address operator, string endpoint) returns()

func (*ConsortiumManagementSession) Approve

func (_ConsortiumManagement *ConsortiumManagementSession) Approve(id *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0xb759f954.

Solidity: function approve(uint256 id) returns()

func (*ConsortiumManagementSession) Delegates

func (_ConsortiumManagement *ConsortiumManagementSession) Delegates() ([]common.Address, error)

Delegates is a free data retrieval call binding the contract method 0x6138b19e.

Solidity: function delegates() view returns(address[])

func (*ConsortiumManagementSession) Disapprove

func (_ConsortiumManagement *ConsortiumManagementSession) Disapprove(id *big.Int) (*types.Transaction, error)

Disapprove is a paid mutator transaction binding the contract method 0x8008df4f.

Solidity: function disapprove(uint256 id) returns()

func (*ConsortiumManagementSession) HealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementSession) HealthEndpoint(operator common.Address) (string, error)

HealthEndpoint is a free data retrieval call binding the contract method 0xb44d5fc7.

Solidity: function healthEndpoint(address operator) view returns(string)

func (*ConsortiumManagementSession) IsMember

func (_ConsortiumManagement *ConsortiumManagementSession) IsMember(addr common.Address) (bool, error)

IsMember is a free data retrieval call binding the contract method 0xa230c524.

Solidity: function isMember(address addr) view returns(bool)

func (*ConsortiumManagementSession) Members

func (_ConsortiumManagement *ConsortiumManagementSession) Members() ([]common.Address, error)

Members is a free data retrieval call binding the contract method 0xbdd4d18d.

Solidity: function members() view returns(address[])

func (*ConsortiumManagementSession) Operators

func (_ConsortiumManagement *ConsortiumManagementSession) Operators(addr common.Address) ([]common.Address, error)

Operators is a free data retrieval call binding the contract method 0x13e7c9d8.

Solidity: function operators(address addr) view returns(address[])

func (*ConsortiumManagementSession) Proposal

func (_ConsortiumManagement *ConsortiumManagementSession) Proposal() (struct {
	Id          *big.Int
	Proposer    common.Address
	Ptype       uint8
	Member      common.Address
	Capacity    uint8
	Approves    []common.Address
	Disapproves []common.Address
}, error)

Proposal is a free data retrieval call binding the contract method 0x753ec103.

Solidity: function proposal() view returns(uint256 id, address proposer, uint8 ptype, address member, uint8 capacity, address[] approves, address[] disapproves)

func (*ConsortiumManagementSession) ProposeMemberDeletion

func (_ConsortiumManagement *ConsortiumManagementSession) ProposeMemberDeletion(addr common.Address) (*types.Transaction, error)

ProposeMemberDeletion is a paid mutator transaction binding the contract method 0x555ed8bb.

Solidity: function proposeMemberDeletion(address addr) returns()

func (*ConsortiumManagementSession) ProposeMemberModification

func (_ConsortiumManagement *ConsortiumManagementSession) ProposeMemberModification(addr common.Address, capacity uint8) (*types.Transaction, error)

ProposeMemberModification is a paid mutator transaction binding the contract method 0xa03eb838.

Solidity: function proposeMemberModification(address addr, uint8 capacity) returns()

func (*ConsortiumManagementSession) ProposeNewMember

func (_ConsortiumManagement *ConsortiumManagementSession) ProposeNewMember(addr common.Address, capacity uint8) (*types.Transaction, error)

ProposeNewMember is a paid mutator transaction binding the contract method 0x0f6d17f9.

Solidity: function proposeNewMember(address addr, uint8 capacity) returns()

func (*ConsortiumManagementSession) RemoveOperator

func (_ConsortiumManagement *ConsortiumManagementSession) RemoveOperator(operator common.Address) (*types.Transaction, error)

RemoveOperator is a paid mutator transaction binding the contract method 0xac8a584a.

Solidity: function removeOperator(address operator) returns()

func (*ConsortiumManagementSession) UpdateHealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementSession) UpdateHealthEndpoint(operator common.Address, endpoint string) (*types.Transaction, error)

UpdateHealthEndpoint is a paid mutator transaction binding the contract method 0xe1d1f053.

Solidity: function updateHealthEndpoint(address operator, string endpoint) returns()

type ConsortiumManagementSettleProposal

type ConsortiumManagementSettleProposal struct {
	Id      *big.Int
	Success bool
	Raw     types.Log // Blockchain specific contextual infos
}

ConsortiumManagementSettleProposal represents a SettleProposal event raised by the ConsortiumManagement contract.

type ConsortiumManagementSettleProposalIterator

type ConsortiumManagementSettleProposalIterator struct {
	Event *ConsortiumManagementSettleProposal // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

ConsortiumManagementSettleProposalIterator is returned from FilterSettleProposal and is used to iterate over the raw logs and unpacked data for SettleProposal events raised by the ConsortiumManagement contract.

func (*ConsortiumManagementSettleProposalIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*ConsortiumManagementSettleProposalIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*ConsortiumManagementSettleProposalIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type ConsortiumManagementTransactor

type ConsortiumManagementTransactor struct {
	// contains filtered or unexported fields
}

ConsortiumManagementTransactor is an auto generated write-only Go binding around an Ethereum contract.

func NewConsortiumManagementTransactor

func NewConsortiumManagementTransactor(address common.Address, transactor bind.ContractTransactor) (*ConsortiumManagementTransactor, error)

NewConsortiumManagementTransactor creates a new write-only instance of ConsortiumManagement, bound to a specific deployed contract.

func (*ConsortiumManagementTransactor) AddOperator

func (_ConsortiumManagement *ConsortiumManagementTransactor) AddOperator(opts *bind.TransactOpts, operator common.Address, endpoint string) (*types.Transaction, error)

AddOperator is a paid mutator transaction binding the contract method 0x2430df89.

Solidity: function addOperator(address operator, string endpoint) returns()

func (*ConsortiumManagementTransactor) Approve

func (_ConsortiumManagement *ConsortiumManagementTransactor) Approve(opts *bind.TransactOpts, id *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0xb759f954.

Solidity: function approve(uint256 id) returns()

func (*ConsortiumManagementTransactor) Disapprove

func (_ConsortiumManagement *ConsortiumManagementTransactor) Disapprove(opts *bind.TransactOpts, id *big.Int) (*types.Transaction, error)

Disapprove is a paid mutator transaction binding the contract method 0x8008df4f.

Solidity: function disapprove(uint256 id) returns()

func (*ConsortiumManagementTransactor) ProposeMemberDeletion

func (_ConsortiumManagement *ConsortiumManagementTransactor) ProposeMemberDeletion(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error)

ProposeMemberDeletion is a paid mutator transaction binding the contract method 0x555ed8bb.

Solidity: function proposeMemberDeletion(address addr) returns()

func (*ConsortiumManagementTransactor) ProposeMemberModification

func (_ConsortiumManagement *ConsortiumManagementTransactor) ProposeMemberModification(opts *bind.TransactOpts, addr common.Address, capacity uint8) (*types.Transaction, error)

ProposeMemberModification is a paid mutator transaction binding the contract method 0xa03eb838.

Solidity: function proposeMemberModification(address addr, uint8 capacity) returns()

func (*ConsortiumManagementTransactor) ProposeNewMember

func (_ConsortiumManagement *ConsortiumManagementTransactor) ProposeNewMember(opts *bind.TransactOpts, addr common.Address, capacity uint8) (*types.Transaction, error)

ProposeNewMember is a paid mutator transaction binding the contract method 0x0f6d17f9.

Solidity: function proposeNewMember(address addr, uint8 capacity) returns()

func (*ConsortiumManagementTransactor) RemoveOperator

func (_ConsortiumManagement *ConsortiumManagementTransactor) RemoveOperator(opts *bind.TransactOpts, operator common.Address) (*types.Transaction, error)

RemoveOperator is a paid mutator transaction binding the contract method 0xac8a584a.

Solidity: function removeOperator(address operator) returns()

func (*ConsortiumManagementTransactor) UpdateHealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementTransactor) UpdateHealthEndpoint(opts *bind.TransactOpts, operator common.Address, endpoint string) (*types.Transaction, error)

UpdateHealthEndpoint is a paid mutator transaction binding the contract method 0xe1d1f053.

Solidity: function updateHealthEndpoint(address operator, string endpoint) returns()

type ConsortiumManagementTransactorRaw

type ConsortiumManagementTransactorRaw struct {
	Contract *ConsortiumManagementTransactor // Generic write-only contract binding to access the raw methods on
}

ConsortiumManagementTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.

func (*ConsortiumManagementTransactorRaw) Transact

func (_ConsortiumManagement *ConsortiumManagementTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*ConsortiumManagementTransactorRaw) Transfer

func (_ConsortiumManagement *ConsortiumManagementTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type ConsortiumManagementTransactorSession

type ConsortiumManagementTransactorSession struct {
	Contract     *ConsortiumManagementTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts               // Transaction auth options to use throughout this session
}

ConsortiumManagementTransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.

func (*ConsortiumManagementTransactorSession) AddOperator

func (_ConsortiumManagement *ConsortiumManagementTransactorSession) AddOperator(operator common.Address, endpoint string) (*types.Transaction, error)

AddOperator is a paid mutator transaction binding the contract method 0x2430df89.

Solidity: function addOperator(address operator, string endpoint) returns()

func (*ConsortiumManagementTransactorSession) Approve

func (_ConsortiumManagement *ConsortiumManagementTransactorSession) Approve(id *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0xb759f954.

Solidity: function approve(uint256 id) returns()

func (*ConsortiumManagementTransactorSession) Disapprove

func (_ConsortiumManagement *ConsortiumManagementTransactorSession) Disapprove(id *big.Int) (*types.Transaction, error)

Disapprove is a paid mutator transaction binding the contract method 0x8008df4f.

Solidity: function disapprove(uint256 id) returns()

func (*ConsortiumManagementTransactorSession) ProposeMemberDeletion

func (_ConsortiumManagement *ConsortiumManagementTransactorSession) ProposeMemberDeletion(addr common.Address) (*types.Transaction, error)

ProposeMemberDeletion is a paid mutator transaction binding the contract method 0x555ed8bb.

Solidity: function proposeMemberDeletion(address addr) returns()

func (*ConsortiumManagementTransactorSession) ProposeMemberModification

func (_ConsortiumManagement *ConsortiumManagementTransactorSession) ProposeMemberModification(addr common.Address, capacity uint8) (*types.Transaction, error)

ProposeMemberModification is a paid mutator transaction binding the contract method 0xa03eb838.

Solidity: function proposeMemberModification(address addr, uint8 capacity) returns()

func (*ConsortiumManagementTransactorSession) ProposeNewMember

func (_ConsortiumManagement *ConsortiumManagementTransactorSession) ProposeNewMember(addr common.Address, capacity uint8) (*types.Transaction, error)

ProposeNewMember is a paid mutator transaction binding the contract method 0x0f6d17f9.

Solidity: function proposeNewMember(address addr, uint8 capacity) returns()

func (*ConsortiumManagementTransactorSession) RemoveOperator

func (_ConsortiumManagement *ConsortiumManagementTransactorSession) RemoveOperator(operator common.Address) (*types.Transaction, error)

RemoveOperator is a paid mutator transaction binding the contract method 0xac8a584a.

Solidity: function removeOperator(address operator) returns()

func (*ConsortiumManagementTransactorSession) UpdateHealthEndpoint

func (_ConsortiumManagement *ConsortiumManagementTransactorSession) UpdateHealthEndpoint(operator common.Address, endpoint string) (*types.Transaction, error)

UpdateHealthEndpoint is a paid mutator transaction binding the contract method 0xe1d1f053.

Solidity: function updateHealthEndpoint(address operator, string endpoint) returns()

type ConsortiumManagementUpdateOperatorHealthEndpoint

type ConsortiumManagementUpdateOperatorHealthEndpoint struct {
	Member   common.Address
	Operator common.Address
	Endpoint string
	Raw      types.Log // Blockchain specific contextual infos
}

ConsortiumManagementUpdateOperatorHealthEndpoint represents a UpdateOperatorHealthEndpoint event raised by the ConsortiumManagement contract.

type ConsortiumManagementUpdateOperatorHealthEndpointIterator

type ConsortiumManagementUpdateOperatorHealthEndpointIterator struct {
	Event *ConsortiumManagementUpdateOperatorHealthEndpoint // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

ConsortiumManagementUpdateOperatorHealthEndpointIterator is returned from FilterUpdateOperatorHealthEndpoint and is used to iterate over the raw logs and unpacked data for UpdateOperatorHealthEndpoint events raised by the ConsortiumManagement contract.

func (*ConsortiumManagementUpdateOperatorHealthEndpointIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*ConsortiumManagementUpdateOperatorHealthEndpointIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*ConsortiumManagementUpdateOperatorHealthEndpointIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type ConsortiumManagementVote

type ConsortiumManagementVote struct {
	Id      *big.Int
	Voter   common.Address
	Approve bool
	Raw     types.Log // Blockchain specific contextual infos
}

ConsortiumManagementVote represents a Vote event raised by the ConsortiumManagement contract.

type ConsortiumManagementVoteIterator

type ConsortiumManagementVoteIterator struct {
	Event *ConsortiumManagementVote // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

ConsortiumManagementVoteIterator is returned from FilterVote and is used to iterate over the raw logs and unpacked data for Vote events raised by the ConsortiumManagement contract.

func (*ConsortiumManagementVoteIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*ConsortiumManagementVoteIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*ConsortiumManagementVoteIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type GetBlockTime

type GetBlockTime func(uint64) (time.Time, error)

GetBlockTime defines a function to get block creation time

type GetCandidates

type GetCandidates func(protocol.StateReader, uint64, bool, bool) ([]*state.Candidate, uint64, error)

GetCandidates returns the current candidates

type GetProbationList

type GetProbationList func(protocol.StateReader, bool) (*vote.ProbationList, uint64, error)

GetProbationList returns current the ProbationList

type GetUnproductiveDelegate

type GetUnproductiveDelegate func(protocol.StateReader) (*vote.UnproductiveDelegate, error)

GetUnproductiveDelegate returns unproductiveDelegate struct which contains a cache of upd info by epochs

type NativeStaking

type NativeStaking struct {
	// contains filtered or unexported fields
}

NativeStaking represents native staking struct

func NewNativeStaking

func NewNativeStaking(readContract ReadContract) (*NativeStaking, error)

NewNativeStaking creates a NativeStaking instance

func (*NativeStaking) SetContract

func (ns *NativeStaking) SetContract(contract string)

SetContract sets the contract address

func (*NativeStaking) Votes

func (ns *NativeStaking) Votes(ctx context.Context, ts time.Time, correctGas bool) (*VoteTally, error)

Votes returns the votes on height

type Productivity

type Productivity func(uint64, uint64) (map[string]uint64, error)

Productivity returns the number of produced blocks per producer

type Protocol

type Protocol interface {
	protocol.Protocol
	protocol.ActionValidator
	protocol.GenesisStateCreator
	Delegates(context.Context, protocol.StateReader) (state.CandidateList, error)
	NextDelegates(context.Context, protocol.StateReader) (state.CandidateList, error)
	Candidates(context.Context, protocol.StateReader) (state.CandidateList, error)
	NextCandidates(context.Context, protocol.StateReader) (state.CandidateList, error)
	// CalculateCandidatesByHeight calculates candidate and returns candidates by chain height
	// TODO: remove height, and read it from state reader
	CalculateCandidatesByHeight(context.Context, protocol.StateReader, uint64) (state.CandidateList, error)
	// CalculateUnproductiveDelegates calculates unproductive delegate on current epoch
	CalculateUnproductiveDelegates(context.Context, protocol.StateReader) (map[string]uint64, error)
}

Protocol defines the protocol of handling votes

func FindProtocol

func FindProtocol(registry *protocol.Registry) Protocol

FindProtocol finds the registered protocol from registry

func MustGetProtocol

func MustGetProtocol(registry *protocol.Registry) Protocol

MustGetProtocol return a registered protocol from registry

func NewConsortiumCommittee

func NewConsortiumCommittee(indexer *CandidateIndexer, readContract ReadContract, _ evm.GetBlockHash) (Protocol, error)

NewConsortiumCommittee creates a committee for consorium chain TODO: remove unused getBlockHash

func NewGovernanceChainCommitteeProtocol

func NewGovernanceChainCommitteeProtocol(
	candidatesIndexer *CandidateIndexer,
	electionCommittee committee.Committee,
	initGravityChainHeight uint64,
	_ GetBlockTime,
	initialCandidatesInterval time.Duration,
	sh *Slasher,
) (Protocol, error)

NewGovernanceChainCommitteeProtocol creates a Poll Protocol which fetch result from governance chain TODO: remove getBlockTime

func NewLifeLongDelegatesProtocol

func NewLifeLongDelegatesProtocol(delegates []genesis.Delegate) Protocol

NewLifeLongDelegatesProtocol creates a poll protocol with life long delegates

func NewProtocol

func NewProtocol(
	scheme string,
	chainConfig blockchain.Config,
	genesisConfig genesis.Genesis,
	candidateIndexer *CandidateIndexer,
	readContract ReadContract,
	getCandidates GetCandidates,
	getProbationList GetProbationList,
	getUnproductiveDelegate GetUnproductiveDelegate,
	electionCommittee committee.Committee,
	stakingProto *staking.Protocol,
	_ GetBlockTime,
	productivity Productivity,
	_ evm.GetBlockHash,
	_ evm.GetBlockTime,
) (Protocol, error)

NewProtocol instantiates a rewarding protocol instance.

func NewStakingCommand

func NewStakingCommand(stkV1 Protocol, stkV2 Protocol) (Protocol, error)

NewStakingCommand creates a staking command center to manage staking committee and new native staking

func NewStakingCommittee

func NewStakingCommittee(
	ec committee.Committee,
	gs Protocol,
	readContract ReadContract,
	nativeStakingContractAddress string,
	nativeStakingContractCode string,
	scoreThreshold *big.Int,
) (Protocol, error)

NewStakingCommittee creates a staking committee which fetch result from governance chain and native staking

type ReadContract

type ReadContract func(context.Context, string, []byte, bool) ([]byte, error)

ReadContract defines a callback function to read contract

type Slasher

type Slasher struct {
	// contains filtered or unexported fields
}

Slasher is the module to slash candidates

func NewSlasher

func NewSlasher(
	productivity Productivity,
	getCandidates GetCandidates,
	getProbationList GetProbationList,
	getUnprodDelegate GetUnproductiveDelegate,
	indexer *CandidateIndexer,
	numCandidateDelegates, numDelegates, thres, koPeriod, maxKoPeriod uint64,
	koIntensity uint32,
) (*Slasher, error)

NewSlasher returns a new Slasher

func (*Slasher) CalculateProbationList

func (sh *Slasher) CalculateProbationList(
	ctx context.Context,
	sm protocol.StateManager,
	epochNum uint64,
) (*vote.ProbationList, error)

CalculateProbationList calculates probation list according to productivity

func (*Slasher) CreateGenesisStates

func (sh *Slasher) CreateGenesisStates(ctx context.Context, sm protocol.StateManager, indexer *CandidateIndexer) error

CreateGenesisStates creates genesis state for slasher

func (*Slasher) CreatePreStates

func (sh *Slasher) CreatePreStates(ctx context.Context, sm protocol.StateManager, indexer *CandidateIndexer) error

CreatePreStates is to setup probation list

func (*Slasher) GetABPFromIndexer

func (sh *Slasher) GetABPFromIndexer(ctx context.Context, epochStartHeight uint64) (state.CandidateList, error)

GetABPFromIndexer returns active BP list from indexer

func (*Slasher) GetActiveBlockProducers

func (sh *Slasher) GetActiveBlockProducers(ctx context.Context, sr protocol.StateReader, readFromNext bool) (state.CandidateList, uint64, error)

GetActiveBlockProducers returns active BP list

func (*Slasher) GetBPFromIndexer

func (sh *Slasher) GetBPFromIndexer(ctx context.Context, epochStartHeight uint64) (state.CandidateList, error)

GetBPFromIndexer returns BP list from indexer

func (*Slasher) GetBlockProducers

func (sh *Slasher) GetBlockProducers(ctx context.Context, sr protocol.StateReader, readFromNext bool) (state.CandidateList, uint64, error)

GetBlockProducers returns BP list

func (*Slasher) GetCandidates

func (sh *Slasher) GetCandidates(ctx context.Context, sr protocol.StateReader, readFromNext bool) (state.CandidateList, uint64, error)

GetCandidates returns filtered candidate list

func (*Slasher) GetCandidatesFromIndexer

func (sh *Slasher) GetCandidatesFromIndexer(ctx context.Context, epochStartHeight uint64) (state.CandidateList, error)

GetCandidatesFromIndexer returns candidate list from indexer

func (*Slasher) GetProbationList

func (sh *Slasher) GetProbationList(ctx context.Context, sr protocol.StateReader, readFromNext bool) (*vote.ProbationList, uint64, error)

GetProbationList returns the probation list at given epoch

func (*Slasher) ReadState

func (sh *Slasher) ReadState(
	ctx context.Context,
	sr protocol.StateReader,
	indexer *CandidateIndexer,
	method []byte,
	args ...[]byte,
) ([]byte, uint64, error)

ReadState defines slasher's read methods.

type VoteTally

type VoteTally struct {
	Candidates map[[12]byte]*state.Candidate
	Buckets    []*types.Bucket
}

VoteTally is a map of candidates on native chain

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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