Documentation ¶
Index ¶
- Constants
- Variables
- type Blockchainer
- type ChainContext
- type Contract
- func (ac *Contract) Address() common.Address
- func (ac *Contract) AutonityContractCall(statedb *state.StateDB, header *types.Header, function string, ...) error
- func (ac *Contract) DeployAutonityContract(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB) (common.Address, error)
- func (ac *Contract) FinalizeAndGetCommittee(transactions types.Transactions, receipts types.Receipts, header *types.Header, ...) (types.Committee, *types.Receipt, error)
- func (ac *Contract) GetCommittee(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB) (types.Committee, error)
- func (ac *Contract) GetContractABI() string
- func (ac *Contract) GetMinimumGasPrice(block *types.Block, db *state.StateDB) (uint64, error)
- func (ac *Contract) GetWhitelist(block *types.Block, db *state.StateDB) (*types.Nodes, error)
- func (ac *Contract) MeasureMetricsOfNetworkEconomic(header *types.Header, stateDB *state.StateDB)
- func (ac *Contract) SetMinimumGasPrice(block *types.Block, db *state.StateDB, price *big.Int) error
- func (ac *Contract) UpdateAutonityContract(header *types.Header, statedb *state.StateDB, bytecode string, abi string, ...) error
- func (ac *Contract) UpdateEnodesWhitelist(state *state.StateDB, block *types.Block) error
- type ContractState
- type EconomicMetaData
- type EconomicMetrics
- type RewardDistributionMetaData
Constants ¶
View Source
const ( Participant uint8 = iota Stakeholder Validator )
View Source
const ( // gauge to track stake and balance in ETH for user. UserMetricIDTemplate = "contract/user/%s/%s/%s" // gauge which track the min gas price in GWei. GlobalMetricIDGasPrice = "contract/global/mingasprice" // gauge which track the global state supply in ETH. GlobalMetricIDStakeSupply = "contract/global/stakesupply" // gauge which track the network operator balance in ETH. GlobalOperatorBalanceMetricID = "contract/global/operator/balance" // gauge tracks the fraction of reward per block for stakeholders. BlockRewardDistributionMetricIDTemplate = "contract/block/%v/user/%s/%s/reward" // gauge tracks the reward/transactionfee of a specific block. BlockRewardBlockMetricID = "contract/block/%v/reward" RoleUnknown = "unknown" RoleValidator = "validator" RoleStakeHolder = "stakeholder" RoleParticipant = "participant" /* counter metrics which counts reward distribution for per block, cannot hold these counters from block0 to infinite block number in memory, so we apply a height/time window to keep the counters in reasonable range, for those counter which reported to TSDB could be removed for memory recycle. template: contract/block/number/user/common.address/[validator|stakeholder|participant]/reward */ BlockRewardHeightWindow = 3600 // 1 hour time window to keep those counters in memory. BlockRewardHeightWindowStepRange = 600 // each 10 minutes to shrink the window. )
View Source
const ABISPEC = "ABISPEC"
Variables ¶
View Source
var ErrAutonityContract = errors.New("could not call Autonity contract")
View Source
var ErrWrongParameter = errors.New("wrong parameter")
Functions ¶
This section is empty.
Types ¶
type Blockchainer ¶
type ChainContext ¶
type Contract ¶
type Contract struct { GetHashFn func(ref *types.Header, chain ChainContext) func(n uint64) common.Hash sync.RWMutex // contains filtered or unexported fields }
func NewAutonityContract ¶
func (*Contract) AutonityContractCall ¶ added in v0.4.0
func (*Contract) DeployAutonityContract ¶
func (ac *Contract) DeployAutonityContract(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB) (common.Address, error)
deployContract deploys the contract contained within the genesis field bytecode
func (*Contract) FinalizeAndGetCommittee ¶ added in v0.4.0
func (*Contract) GetCommittee ¶ added in v0.4.0
func (*Contract) GetContractABI ¶ added in v0.4.0
func (*Contract) GetMinimumGasPrice ¶
func (*Contract) GetWhitelist ¶
func (*Contract) MeasureMetricsOfNetworkEconomic ¶ added in v0.4.0
measure metrics of user's meta data by regarding of network economic.
func (*Contract) SetMinimumGasPrice ¶
func (*Contract) UpdateAutonityContract ¶ added in v0.4.0
type ContractState ¶ added in v0.4.0
type ContractState struct { Users []common.Address `abi:"users"` Enodes []string `abi:"enodes"` Types []*big.Int `abi:"types"` Stakes []*big.Int `abi:"stakes"` CommissionRates []*big.Int `abi:"commisionrates"` Operator common.Address `abi:"operator"` Deployer common.Address `abi:"deployer"` MinGasPrice *big.Int `abi:"mingasprice"` BondingPeriod *big.Int `abi:"bondingperiod"` }
* ContractState is a unified structure to represent the autonity contract state. * By using a unified structure, the new state meta introduced in the Autonity.sol * should be synced with this structure.
type EconomicMetaData ¶ added in v0.4.0
type EconomicMetaData struct { Accounts []common.Address `abi:"accounts"` Usertypes []uint8 `abi:"usertypes"` Stakes []*big.Int `abi:"stakes"` Commissionrates []*big.Int `abi:"commissionrates"` Mingasprice *big.Int `abi:"mingasprice"` Stakesupply *big.Int `abi:"stakesupply"` }
refer to autonity contract abt spec, keep in same meta.
type EconomicMetrics ¶ added in v0.4.0
type EconomicMetrics struct {
// contains filtered or unexported fields
}
func (*EconomicMetrics) SubmitEconomicMetrics ¶ added in v0.4.0
func (em *EconomicMetrics) SubmitEconomicMetrics(v *EconomicMetaData, stateDB *state.StateDB, height uint64, operator common.Address)
measure metrics of user's meta data by regarding of network economic.
func (*EconomicMetrics) SubmitRewardDistributionMetrics ¶ added in v0.4.0
func (em *EconomicMetrics) SubmitRewardDistributionMetrics(v *RewardDistributionMetaData, height uint64)
type RewardDistributionMetaData ¶ added in v0.4.0
type RewardDistributionMetaData struct { Result bool `abi:"result"` Holders []common.Address `abi:"stakeholders"` Rewardfractions []*big.Int `abi:"rewardfractions"` Amount *big.Int `abi:"amount"` }
refer to autonity contract abi spec, keep in same meta.
Click to show internal directories.
Click to hide internal directories.