Documentation ¶
Index ¶
- Constants
- type BaseVoting
- type BigInt
- type Block
- type BlockStorage
- type ByAddress
- type ConstitutionVoting
- type ConstitutionVotingStorage
- type ContractRegistryAddressVoting
- type ContractRegistryAddressVotingStorage
- type ContractRegistryUpgradeVoting
- type ContractRegistryUpgradeVotingStorage
- type ContractRegistryVoting
- type ContractRegistryVotingStorage
- type CountEventsByAddress
- type CountVotingEvents
- type EmergencyUpdateVoting
- type EmergencyUpdateVotingStorage
- type EpdrMembershipVoting
- type EpdrMembershipVotingStorage
- type EpdrParametersVoting
- type EpdrParametersVotingStorage
- type EpqfiMembershipVoting
- type EpqfiMembershipVotingStorage
- type EpqfiParametersVoting
- type EpqfiParametersVotingStorage
- type EprsMembershipVoting
- type EprsMembershipVotingStorage
- type EprsParametersVoting
- type EprsParametersVotingStorage
- type FirstAndLastBlocksByAccount
- type GeneralUpdateVoting
- type GeneralUpdateVotingStorage
- type LayerZeroList
- type LayerZeroListStorage
- type MetricsByMiner
- type NodeAccountPair
- type NodeExclusion
- type NodeExclusionList
- type ObservedApproval
- type ObservedApprovals
- type Payment
- type PaymentsStorage
- type QTokenHolderVotesStorage
- type RootNodeApproval
- type RootNodeApprovalsStorage
- type RootNodeBreakdown
- type RootNodeList
- type RootNodeProposalsStorage
- type RootNodeVotesStorage
- type RootnodesSlashingVoting
- type RootnodesSlashingVotingStorage
- type RootsMembership
- type RootsMembershipStorage
- type RootsVoting
- type RootsVotingStorage
- type SelectBlocksParams
- type SelectPaymentsParams
- type SelectRootNodeApprovalParams
- type SelectRootsMembershipParams
- type SelectSummaryMetricsParams
- type SelectSysContractsParams
- type SelectTxsParams
- type SelectVotingEventsParams
- type SelectVotingsParams
- type Storage
- type SummaryMetrics
- type SummaryMetricsStorage
- type SummaryQuery
- type SystemContract
- type SystemContractsStorage
- type Transaction
- type TransactionStorage
- type ValidatorsSlashingVoting
- type ValidatorsSlashingVotingStorage
- type Variable
- type VariableStorage
- type Voting
- type VotingAgent
- type VotingAgentStorage
- type VotingEvent
- type VotingEventByAddress
- type VotingEventsStorage
- type VotingStorage
Constants ¶
const ( ListTypeExclusion = "exclusion-list" ListTypeRoot = "root-list" )
const (
ContractRegistryName = "contract-registry"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseVoting ¶ added in v1.1.0
type BaseVoting struct { ProposalId uint64 `db:"proposal_id"` VotingType string `db:"voting_type"` VotingStatus uint8 `db:"voting_status"` VotingStartTime uint64 `db:"voting_start_time"` CurrentQuorum string `db:"current_quorum"` RequiredQuorum string `db:"required_quorum"` RootNodesNumber uint64 `db:"root_nodes_number"` VetosNumber uint64 `db:"vetos_number"` // is not used in each voting, so we simply skip it during insert to db VotingEndTime uint64 `db:"voting_end_time"` VetoEndTime uint64 `db:"veto_end_time"` }
type BigInt ¶
BigInt is a wrapper for saving to db.
type Block ¶
type Block struct { Number uint64 `db:"id"` Hash string `db:"hash"` Parent string `db:"parent"` Signer string `db:"signer"` MainAccount string `db:"mainaccount"` Timestamp int64 `db:"timestamp"` InTurnSigner string `db:"inturn_signer"` Difficulty int64 `db:"difficulty"` }
Block of txs.
type BlockStorage ¶
type BlockStorage interface { Insert(block *Block) error GetByNumber(number uint64) (*Block, error) GetLatest() (*Block, error) GetBlockEarlierThan(timestamp int64) (*Block, error) Select(params *SelectBlocksParams) ([]Block, error) // Erase all history starting fromID inclusively. Erase(fromID uint64) error }
BlockStorage stores blocks.
type ByAddress ¶ added in v1.0.0
type ByAddress struct { Account string ObservedApprovals []ObservedApprovals }
type ConstitutionVoting ¶
type ConstitutionVoting struct { BaseVoting VotingSubType uint8 `db:"voting_subtype"` }
ConstitutionVoting voting.
type ConstitutionVotingStorage ¶
type ConstitutionVotingStorage interface { Insert(votings ...ConstitutionVoting) error GetLatest() (*ConstitutionVoting, error) GetEarliestUnfinishedVotings() ([]ConstitutionVoting, error) Update(voting *ConstitutionVoting) error }
ConstitutionVotingStorage stores constitution votings.
type ContractRegistryAddressVoting ¶
type ContractRegistryAddressVoting ContractRegistryVoting
ContractRegistryAddressVoting voting.
type ContractRegistryAddressVotingStorage ¶
type ContractRegistryAddressVotingStorage ContractRegistryVotingStorage
type ContractRegistryUpgradeVoting ¶
type ContractRegistryUpgradeVoting ContractRegistryVoting
ContractRegistryUpgradeVoting voting.
type ContractRegistryUpgradeVotingStorage ¶
type ContractRegistryUpgradeVotingStorage ContractRegistryVotingStorage
ContractRegistryUpgradeVotingStorage stores contract registry upgrade votings.
type ContractRegistryVoting ¶ added in v1.1.0
type ContractRegistryVoting struct { ProposalId uint64 `db:"proposal_id"` VotingType string `db:"voting_type"` VotingStatus uint8 `db:"voting_status"` VotingStartTime uint64 `db:"voting_start_time"` CurrentMajority string `db:"current_majority"` RequiredMajority string `db:"required_majority"` RootNodesNumber uint64 `db:"root_nodes_number"` VotesNumber uint64 `db:"votes_number"` VotingEndTime uint64 `db:"voting_end_time"` }
type ContractRegistryVotingStorage ¶ added in v1.1.0
type ContractRegistryVotingStorage interface { Insert(votings ...ContractRegistryVoting) error GetLatestId() (*int64, error) GetEarliestUnfinishedVotings() ([]ContractRegistryVoting, error) Update(voting *ContractRegistryVoting) error }
ContractRegistryVotingStorage stores contract registry votings.
type CountEventsByAddress ¶ added in v1.0.0
type CountVotingEvents ¶ added in v1.0.0
type CountVotingEvents struct { Total map[string]uint64 `json:"total"` ByAddress []CountEventsByAddress `json:"byAddress"` }
type EmergencyUpdateVotingStorage ¶
type EmergencyUpdateVotingStorage interface { Insert(votings ...EmergencyUpdateVoting) error GetLatest() (*EmergencyUpdateVoting, error) GetEarliestUnfinishedVotings() ([]EmergencyUpdateVoting, error) Update(voting *EmergencyUpdateVoting) error }
EmergencyUpdateVotingStorage stores emergency update votings.
type EpdrMembershipVotingStorage ¶
type EpdrMembershipVotingStorage interface { Insert(votings ...EpdrMembershipVoting) error GetLatest() (*EpdrMembershipVoting, error) GetEarliestUnfinishedVotings() ([]EpdrMembershipVoting, error) Update(voting *EpdrMembershipVoting) error }
EpdrMembershipVotingStorage stores epdr membership votings.
type EpdrParametersVotingStorage ¶
type EpdrParametersVotingStorage interface { Insert(votings ...EpdrParametersVoting) error GetLatest() (*EpdrParametersVoting, error) GetEarliestUnfinishedVotings() ([]EpdrParametersVoting, error) Update(voting *EpdrParametersVoting) error }
EpdrParametersVotingStorage stores epdr parameters votings.
type EpqfiMembershipVotingStorage ¶
type EpqfiMembershipVotingStorage interface { Insert(votings ...EpqfiMembershipVoting) error GetLatest() (*EpqfiMembershipVoting, error) GetEarliestUnfinishedVotings() ([]EpqfiMembershipVoting, error) Update(voting *EpqfiMembershipVoting) error }
EpqfiMembershipVotingStorage stores epqfi membership votings.
type EpqfiParametersVotingStorage ¶
type EpqfiParametersVotingStorage interface { Insert(votings ...EpqfiParametersVoting) error GetLatest() (*EpqfiParametersVoting, error) GetEarliestUnfinishedVotings() ([]EpqfiParametersVoting, error) Update(voting *EpqfiParametersVoting) error }
EpqfiParametersVotingStorage stores epqfi parameters votings.
type EprsMembershipVotingStorage ¶
type EprsMembershipVotingStorage interface { Insert(votings ...EprsMembershipVoting) error GetLatest() (*EprsMembershipVoting, error) GetEarliestUnfinishedVotings() ([]EprsMembershipVoting, error) Update(voting *EprsMembershipVoting) error }
EprsMembershipVotingStorage stores eprs membership votings.
type EprsParametersVotingStorage ¶
type EprsParametersVotingStorage interface { Insert(votings ...EprsParametersVoting) error GetLatest() (*EprsParametersVoting, error) GetEarliestUnfinishedVotings() ([]EprsParametersVoting, error) Update(voting *EprsParametersVoting) error }
EprsParametersVotingStorage stores eprs parameters votings.
type FirstAndLastBlocksByAccount ¶ added in v1.0.0
type GeneralUpdateVotingStorage ¶
type GeneralUpdateVotingStorage interface { Insert(votings ...GeneralUpdateVoting) error GetLatest() (*GeneralUpdateVoting, error) GetEarliestUnfinishedVotings() ([]GeneralUpdateVoting, error) Update(voting *GeneralUpdateVoting) error }
GeneralUpdateVotingStorage stores general update votings.
type LayerZeroList ¶ added in v1.0.0
type LayerZeroListStorage ¶ added in v1.0.0
type LayerZeroListStorage interface { GetExclusionList(status string) (NodeExclusionList, error) GetRootList(status string) (RootNodeList, error) GetCurrentRoots() ([]NodeAccountPair, error) SaveRootList(list RootNodeList) error SaveExclusionList(list NodeExclusionList) error OutdateList(listType, hash string) error Tx(fn func() error) error }
type MetricsByMiner ¶
type NodeAccountPair ¶ added in v1.0.0
type NodeAccountPair struct { Node string `db:"node"` MainAccount sql.NullString `db:"main_account"` }
type NodeExclusion ¶ added in v1.0.0
type NodeExclusion struct { NodeAccountPair StartBlock uint64 EndBlock sql.NullInt64 }
type NodeExclusionList ¶ added in v1.0.0
type NodeExclusionList struct { LayerZeroList ExclusionSet []NodeExclusion }
type ObservedApproval ¶ added in v1.0.0
type ObservedApprovals ¶ added in v1.0.0
type ObservedApprovals struct { Alias *string FirstObservedApproval ObservedApproval LastObservedApproval ObservedApproval }
type PaymentsStorage ¶
type PaymentsStorage interface { Insert(payments ...Payment) error Select(params *SelectPaymentsParams) ([]Payment, error) }
type QTokenHolderVotesStorage ¶ added in v1.0.0
type QTokenHolderVotesStorage interface { VotingEventsStorage }
QTokenHolderVotesStorage stores q token holder votes.
type RootNodeApproval ¶ added in v1.0.0
type RootNodeApproval struct { Id uint64 `db:"id"` Signature []byte `db:"signature"` Block uint64 `db:"block"` Signer string `db:"signer"` Alias *string `db:"alias"` }
RootNodeApproval .
type RootNodeApprovalsStorage ¶ added in v1.0.0
type RootNodeApprovalsStorage interface { Insert(approvals ...RootNodeApproval) error GetLatest() (*RootNodeApproval, error) Select(params SelectRootNodeApprovalParams, highestBlock uint64) (RootNodeBreakdown, error) }
RootNodeApprovalsStorage stores root node approvals.
type RootNodeBreakdown ¶ added in v1.0.0
type RootNodeList ¶ added in v1.0.0
type RootNodeList struct { LayerZeroList RootList []NodeAccountPair }
type RootNodeProposalsStorage ¶ added in v1.0.0
type RootNodeProposalsStorage interface { VotingEventsStorage }
RootNodeProposalsStorage stores root nodes proposals.
type RootNodeVotesStorage ¶ added in v1.0.0
type RootNodeVotesStorage interface { VotingEventsStorage }
RootNodeVotesStorage stores root nodes votes.
type RootnodesSlashingVoting ¶
type RootnodesSlashingVoting struct { BaseVoting Candidate string `db:"candidate"` }
RootnodesSlashingVoting voting.
type RootnodesSlashingVotingStorage ¶
type RootnodesSlashingVotingStorage interface { Insert(votings ...RootnodesSlashingVoting) error GetLatest() (*RootnodesSlashingVoting, error) GetEarliestUnfinishedVotings() ([]RootnodesSlashingVoting, error) Update(voting *RootnodesSlashingVoting) error }
RootnodesSlashingVotingStorage stores rootnodes slashing votings.
type RootsMembership ¶ added in v1.0.0
type RootsMembership struct { PeriodId uint64 `db:"period_id"` RootAddress string `db:"root_address"` StartBlock int64 `db:"start_block"` EndBlock int64 `db:"end_block"` StartTime time.Time `db:"start_time"` EndTime time.Time `db:"end_time"` }
RootsMembership .
type RootsMembershipStorage ¶ added in v1.0.0
type RootsMembershipStorage interface { Insert(rnMembership *RootsMembership) error GetLatest() (*RootsMembership, error) GetUnfinishedPeriodByAddress(rootAddress string) (*RootsMembership, error) FindNextPeriodByAddress(rootAddress string, startBlock int64) (*RootsMembership, error) GetUnfinishedPeriods() ([]RootsMembership, error) // SelectActiveRootAddresses returns list of active root node addresses in lowercase SelectActiveRootAddresses() ([]string, error) Update(rnMembership *RootsMembership) error Select(params *SelectRootsMembershipParams) ([]RootsMembership, error) // Erase all history starting fromID inclusively. Erase(fromID uint64) error }
RootsMembershipStorage stores roots membership periods.
type RootsVoting ¶
type RootsVoting struct { BaseVoting Candidate string `db:"candidate"` ReplaceDest string `db:"replace_dest"` }
RootsVoting voting.
type RootsVotingStorage ¶
type RootsVotingStorage interface { Insert(votings ...RootsVoting) error GetLatest() (*RootsVoting, error) GetEarliestUnfinishedVotingIds() ([]uint64, error) Update(voting *RootsVoting) error }
RootsVotingStorage stores roots votings.
type SelectBlocksParams ¶
type SelectPaymentsParams ¶
type SelectRootNodeApprovalParams ¶ added in v1.0.0
type SelectRootsMembershipParams ¶ added in v1.0.0
type SelectSysContractsParams ¶ added in v1.0.0
type SelectTxsParams ¶
type SelectTxsParams struct { Cursor *string Limit uint64 IsDesc bool Sender *string Recipient *string // Counterparty is either Sender or Recipient // and mutually exclusive to those filters Counterparty *string }
SelectTxsParams.
type SelectVotingEventsParams ¶ added in v1.0.0
type SelectVotingsParams ¶
type Storage ¶
type Storage interface { Clone() Storage ExecInTx(fn func() error) error Blocks() BlockStorage Transactions() TransactionStorage Payments() PaymentsStorage Votings() VotingStorage ConstitutionVotings() ConstitutionVotingStorage GeneralUpdateVotings() GeneralUpdateVotingStorage EmergencyUpdateVotings() EmergencyUpdateVotingStorage RootsVotings() RootsVotingStorage RootnodesSlashingVotings() RootnodesSlashingVotingStorage ValidatorsSlashingVotings() ValidatorsSlashingVotingStorage EpqfiMembershipVotings() EpqfiMembershipVotingStorage EpqfiParametersVotings() EpqfiParametersVotingStorage EpdrMembershipVotings() EpdrMembershipVotingStorage EpdrParametersVotings() EpdrParametersVotingStorage EprsMembershipVotings() EprsMembershipVotingStorage EprsParametersVotings() EprsParametersVotingStorage ContractRegistryAddressVotings() ContractRegistryAddressVotingStorage ContractRegistryUpgradeVotings() ContractRegistryUpgradeVotingStorage ContractRegistryVotings() ContractRegistryVotingStorage SystemContracts() SystemContractsStorage LayerZeroLists() LayerZeroListStorage RootsMembership() RootsMembershipStorage Variables() VariableStorage QTokenHolderVotes() QTokenHolderVotesStorage RootNodeVotes() RootNodeVotesStorage RootNodeProposals() RootNodeProposalsStorage VotingAgents() VotingAgentStorage RootNodeApprovals() RootNodeApprovalsStorage SummaryMetrics() SummaryMetricsStorage }
Storage.
type SummaryMetrics ¶
type SummaryMetrics struct { Number uint64 `db:"id"` MainAccount string `db:"mainaccount"` TotalDueBlocks uint64 `db:"totaldueblocks"` TotalInTurnBlocks uint64 `db:"totalinturnblocks"` TotalOutOfTurnBlocks uint64 `db:"totaloutofturnblocks"` MetricsByMiner map[string]MetricsByMiner `db:"metricsbyminer"` }
Block of summary of metrics.
type SummaryMetricsStorage ¶
type SummaryMetricsStorage interface {
Select(params *SelectSummaryMetricsParams) ([]SummaryMetrics, error)
}
SummaryMetricsStorage stores blocks.
type SummaryQuery ¶
type SystemContract ¶ added in v1.0.0
type SystemContract struct { ID uint64 `db:"id" structs:"-"` Contract string `db:"proxy" structs:"proxy"` Implementation sql.NullString `db:"implementation" structs:"implementation"` Key sql.NullString `db:"key" structs:"key"` }
type SystemContractsStorage ¶ added in v1.0.0
type SystemContractsStorage interface { Upsert(contracts ...SystemContract) error UpdateImplAddress(contract SystemContract) error Select(params SelectSysContractsParams) ([]SystemContract, error) GetContractRegistry() (*SystemContract, error) }
type Transaction ¶
type Transaction struct { Hash string `db:"hash"` Block uint64 `db:"block_id"` Sender string `db:"sender"` Recipient *string `db:"recipient"` Value *BigInt `db:"value"` Nonce uint64 `db:"nonce"` GasPrice *BigInt `db:"gas_price"` Gas uint64 `db:"gas"` Input []byte `db:"input"` Timestamp int64 `db:"timestamp"` }
Transaction.
type TransactionStorage ¶
type TransactionStorage interface { Insert(txs ...Transaction) error Get(hash string) (*Transaction, error) Select(params *SelectTxsParams) ([]Transaction, error) }
TransactionStorage.
type ValidatorsSlashingVoting ¶
type ValidatorsSlashingVoting BaseVoting
ValidatorsSlashingVoting voting.
type ValidatorsSlashingVotingStorage ¶
type ValidatorsSlashingVotingStorage interface { Insert(votings ...ValidatorsSlashingVoting) error GetLatest() (*ValidatorsSlashingVoting, error) GetEarliestUnfinishedVotings() ([]ValidatorsSlashingVoting, error) Update(voting *ValidatorsSlashingVoting) error }
ValidatorsSlashingVotingStorage stores validators slashing votings.
type VariableStorage ¶ added in v1.0.0
type VariableStorage interface { Insert(variable *Variable) error GetByName(name string) (*Variable, error) Update(variable *Variable) error // Erase all history starting fromID inclusively. Erase(name string) error }
VariableStorage stores variables.
type VotingAgent ¶ added in v1.0.0
type VotingAgent struct { Id uint64 `db:"id" structs:"-"` Address string `db:"address" structs:"address"` VotingAgent string `db:"voting_agent" structs:"voting_agent"` StartBlock uint64 `db:"start_block" structs:"start_block"` EndBlock uint64 `db:"end_block" structs:"end_block"` }
VotingAgent .
type VotingAgentStorage ¶ added in v1.0.0
type VotingAgentStorage interface { Insert(agents ...VotingAgent) error GetByVotingAgents(address ...string) ([]VotingAgent, error) GetLatestBlock() (int64, error) }
VotingAgentStorage stores voting agents.
type VotingEvent ¶ added in v1.0.0
type VotingEvent struct { Id uint64 `db:"id"` VotingType string `db:"voting_type"` AccountAddress string `db:"account_address"` ProposalId uint64 `db:"proposal_id"` BlockId uint64 `db:"block_id"` }
VotingEvent .
type VotingEventByAddress ¶ added in v1.0.0
type VotingEventsStorage ¶ added in v1.0.0
type VotingEventsStorage interface { Insert(votingEvents ...VotingEvent) error GetByLatestByType(votingType string) (*VotingEvent, error) Select(params SelectVotingEventsParams, addresses []string) ([]VotingEvent, error) SelectAggregated(params SelectVotingEventsParams) (CountVotingEvents, error) // Erase all history starting fromID inclusively. Erase(fromID uint64) error }
VotingEventsStorage stores voting events.
type VotingStorage ¶
type VotingStorage interface {
Select(params *SelectVotingsParams) ([]interface{}, error)
}
VotingsStorage stores votings.
Source Files ¶
- block.go
- constituionVoting.go
- contractRegistryAddressVoting.go
- contractRegistryUpgradeVoting.go
- emergencyUpdateVoting.go
- epdrMembershipVoting.go
- epdrParametersVoting.go
- epqfiMembershipVoting.go
- epqfiParametersVoting.go
- eprsMembershipVoting.go
- eprsParametersVoting.go
- generalUpdateVoting.go
- layer_zero_list.go
- metricssummary.go
- payment.go
- rootNodeApprovals.go
- rootnodesSlashingVoting.go
- rootsMembership.go
- rootsVoting.go
- storage.go
- system_contract.go
- transaction.go
- types.go
- validatorsSlashingVoting.go
- variables.go
- votingAgents.go
- votingEvents.go
- votings.go