Documentation ¶
Index ¶
- Constants
- Variables
- func GetInteractiveABI() map[string]abi.ABI
- func GetValidatorAddr(blockNum *big.Int, config *params.ChainConfig) *common.Address
- func InitMigrateAddrBalance() ([]common.Address, []*big.Int)
- type Base
- type EpochInfo
- type MigrateAddrBalance
- type NodeVotes
- func (n *NodeVotes) PendingVoteRedeem(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (n *NodeVotes) PendingVoteReward(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (n *NodeVotes) TotalVotes(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (n *NodeVotes) VoteListLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (n *NodeVotes) VotesRewardRedeemInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*VotesRewardRedeemInfo, error)
- func (n *NodeVotes) VotesRewardRedeemInfoWithPage(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]VotesRewardRedeemInfo, error)
- type ProposalInfo
- type Proposals
- func (p *Proposals) AddressProposalCount(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (p *Proposals) AddressProposalSets(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([][4]byte, error)
- func (p *Proposals) AddressProposals(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]ProposalInfo, error)
- func (p *Proposals) AllProposalSets(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([][4]byte, error)
- func (p *Proposals) AllProposals(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]ProposalInfo, error)
- func (p *Proposals) GetProposal(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*ProposalInfo, error)
- func (p *Proposals) ProposalCount(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- type Punish
- type Reward
- type SysRewardsInfo
- type SystemRewards
- func (s *SystemRewards) GetEpochInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*EpochInfo, error)
- func (s *SystemRewards) GetValRewardInfoByEpoch(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*Reward, error)
- func (s *SystemRewards) KickoutInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]common.Address, error)
- func (s *SystemRewards) PendingValidatorReward(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, *big.Int, error)
- func (s *SystemRewards) PunishInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*Punish, error)
- func (s *SystemRewards) ValidatorRewardsInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*SysRewardsInfo, error)
- type Validator
- type Validators
- func (v *Validators) CancelQueueValidatorsLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (v *Validators) EffictiveValsLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (v *Validators) GetCancelQueueValidators(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]common.Address, error)
- func (v *Validators) GetCurrentEpochValidators(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]common.Address, error)
- func (v *Validators) GetEffictiveValidatorsWithPage(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]common.Address, error)
- func (v *Validators) GetInvalidValidatorsWithPage(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]common.Address, error)
- func (v *Validators) GetValidator(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*Validator, error)
- func (v *Validators) GetValidatorVoters(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) ([]common.Address, error)
- func (v *Validators) InvalidValsLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (v *Validators) IsEffictiveValidator(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (bool, error)
- func (v *Validators) TotalDeposit(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- func (v *Validators) ValidatorVotersLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, ...) (*big.Int, error)
- type VotesRewardRedeemInfo
Constants ¶
const AddressListABI = `` /* 1663-byte string literal not displayed */
const DevMappingPosition = 2
DevMappingPosition is the position of the state variable `devs`. Since the state variables are as follows:
bool public initialized; bool public devVerifyEnabled; address public admin; address public pendingAdmin; mapping(address => bool) private devs; //NOTE: make sure this list is not too large! address[] blacksFrom; address[] blacksTo; mapping(address => uint256) blacksFromMap; // address => index+1 mapping(address => uint256) blacksToMap; // address => index+1 uint256 public blackLastUpdatedNumber; // last block number when the black list is updated uint256 public rulesLastUpdatedNumber; // last block number when the rules are updated // event check rules EventCheckRule[] rules; mapping(bytes32 => mapping(uint128 => uint256)) rulesMap; // eventSig => checkIdx => indexInArray+1
according to [Layout of State Variables in Storage](https://docs.soliditylang.org/en/v0.8.4/internals/layout_in_storage.html), and after optimizer enabled, the `initialized`, `enabled` and `admin` will be packed, and stores at slot 0, `pendingAdmin` stores at slot 1, so the position for `devs` is 2.
const MigrateABI = `` /* 283-byte string literal not displayed */
const NodeVotesABI = `` /* 11179-byte string literal not displayed */
const ProposalsABI = `` /* 158-byte string literal not displayed */
const SysGovABI = `` /* 970-byte string literal not displayed */
const SystemRewardsABI = `` /* 10785-byte string literal not displayed */
const ValidatorProposalsABI = `` /* 12267-byte string literal not displayed */
ValidatorProposalsABI `Proposals` contract in systemContracts
const ValidatorsABI = `` /* 14272-byte string literal not displayed */
ValidatorsABI contains all methods to interactive with validator contracts.
Variables ¶
var ( BlackLastUpdatedNumberPosition = common.BytesToHash([]byte{0x07}) RulesLastUpdatedNumberPosition = common.BytesToHash([]byte{0x08}) )
var ( ValidatorsContractName = "Validators" ValidatorProposalsContractName = "ValidatorProposals" NodeVotesContractName = "NodeVotes" SystemRewardsContractName = "SystemRewards" MigrateContractName = "Migrate" ProposalsContractName = "Proposals" AddressListContractName = "address_list" SysGovContractName = "governance" ValidatorsContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff001") ValidatorProposalsContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff002") NodeVotesContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff003") SystemRewardsContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff004") MigrateContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff005") ProposalsContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff006") AddressListContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff007") SysGovContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff008") // SysGovToAddr is the To address for the system governance transaction, NOT contract address SysGovToAddr = common.HexToAddress("0x000000000000000000000000000000000000ffff") )
var ( InitRate = uint8(100) InitDeposit = new(big.Int).Mul(big.NewInt(1e18), big.NewInt(40000000)) InitName = "dxc-validator-1" // max bytes length: 100 InitDetails = "initialize validator" // max bytes length: 10000 )
using for Validators contract's initialize
var (
DevAdmin = common.HexToAddress("0xfd85c4d409a2625f9e18b3bb8182bc48f20603a4")
)
var MigrateOwner = common.HexToAddress("0x3fe93764c06bb5d712b73ad2a385b168d69d3984")
Functions ¶
func GetInteractiveABI ¶
func GetValidatorAddr ¶
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
func (*Base) GetBaseInfos ¶
type EpochInfo ¶
type EpochInfo struct { BlockReward *big.Int Tvl *big.Int ValidatorCount *big.Int EffictiveValCount *big.Int }
EpochInfo struct `epoch` in SystemRewards contract
type MigrateAddrBalance ¶
type MigrateAddrBalance struct { Address common.Address `json:"address"` Balance *math.HexOrDecimal256 `json:"balance"` }
type NodeVotes ¶
type NodeVotes struct {
// contains filtered or unexported fields
}
func (*NodeVotes) PendingVoteRedeem ¶
func (n *NodeVotes) PendingVoteRedeem(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, val common.Address, voter common.Address) (*big.Int, error)
PendingVoteRedeem function PendingRedeem
func (*NodeVotes) PendingVoteReward ¶
func (n *NodeVotes) PendingVoteReward(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, val common.Address, voter common.Address) (*big.Int, error)
PendingVoteReward function pendingReward
func (*NodeVotes) TotalVotes ¶
func (n *NodeVotes) TotalVotes(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (*big.Int, error)
TotalVotes function totalVotes
func (*NodeVotes) VoteListLength ¶
func (n *NodeVotes) VoteListLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, voter common.Address) (*big.Int, error)
VoteListLength function VoteListLength
func (*NodeVotes) VotesRewardRedeemInfo ¶
func (n *NodeVotes) VotesRewardRedeemInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, val common.Address, voter common.Address) (*VotesRewardRedeemInfo, error)
VotesRewardRedeemInfo function votesRewardRedeemInfo
func (*NodeVotes) VotesRewardRedeemInfoWithPage ¶
func (n *NodeVotes) VotesRewardRedeemInfoWithPage(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, voter common.Address, page *big.Int, size *big.Int) ([]VotesRewardRedeemInfo, error)
VotesRewardRedeemInfoWithPage function votesRewardRedeemInfoWithPage
type ProposalInfo ¶
type Proposals ¶
type Proposals struct {
// contains filtered or unexported fields
}
func (*Proposals) AddressProposalCount ¶
func (p *Proposals) AddressProposalCount(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address) (*big.Int, error)
AddressProposalCount function AddressProposalCount
func (*Proposals) AddressProposalSets ¶
func (p *Proposals) AddressProposalSets(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address, page *big.Int, size *big.Int) ([][4]byte, error)
AddressProposalSets function AddressProposalSets
func (*Proposals) AddressProposals ¶
func (p *Proposals) AddressProposals(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address, page *big.Int, size *big.Int) ([]ProposalInfo, error)
AddressProposals function AddressProposals
func (*Proposals) AllProposalSets ¶
func (p *Proposals) AllProposalSets(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, page *big.Int, size *big.Int) ([][4]byte, error)
AllProposalSets function AllProposalSets
func (*Proposals) AllProposals ¶
func (p *Proposals) AllProposals(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, page *big.Int, size *big.Int) ([]ProposalInfo, error)
AllProposals function AllProposals
func (*Proposals) GetProposal ¶
func (p *Proposals) GetProposal(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, id string) (*ProposalInfo, error)
GetProposal function GetProposal
func (*Proposals) ProposalCount ¶
func (p *Proposals) ProposalCount(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (*big.Int, error)
ProposalCount function ProposalCount
type SysRewardsInfo ¶
type SystemRewards ¶
type SystemRewards struct {
// contains filtered or unexported fields
}
func NewSystemRewards ¶
func NewSystemRewards() *SystemRewards
NewSystemRewards return SystemRewards contract instance
func (*SystemRewards) GetEpochInfo ¶
func (s *SystemRewards) GetEpochInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, epoch *big.Int) (*EpochInfo, error)
GetEpochInfo return epoch info
func (*SystemRewards) GetValRewardInfoByEpoch ¶
func (s *SystemRewards) GetValRewardInfoByEpoch(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address, epoch *big.Int) (*Reward, error)
GetValRewardInfoByEpoch return the address and the epoch reward info
func (*SystemRewards) KickoutInfo ¶
func (s *SystemRewards) KickoutInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, epoch *big.Int) ([]common.Address, error)
KickoutInfo return kickout addresses in epoch
func (*SystemRewards) PendingValidatorReward ¶
func (s *SystemRewards) PendingValidatorReward(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address) (*big.Int, *big.Int, error)
PendingValidatorReward return the address reward
func (*SystemRewards) PunishInfo ¶
func (s *SystemRewards) PunishInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address, epoch *big.Int) (*Punish, error)
PunishInfo punishInfo function of systemRewards contract
func (*SystemRewards) ValidatorRewardsInfo ¶
func (s *SystemRewards) ValidatorRewardsInfo(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address) (*SysRewardsInfo, error)
ValidatorRewardsInfo return the address sys rewards
type Validators ¶
type Validators struct {
// contains filtered or unexported fields
}
func NewValidators ¶
func NewValidators() *Validators
func (*Validators) CancelQueueValidatorsLength ¶
func (v *Validators) CancelQueueValidatorsLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (*big.Int, error)
CancelQueueValidatorsLength function CancelQueueValidatorsLength
func (*Validators) EffictiveValsLength ¶
func (v *Validators) EffictiveValsLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (*big.Int, error)
EffictiveValsLength function EffictiveValsLength
func (*Validators) GetCancelQueueValidators ¶
func (v *Validators) GetCancelQueueValidators(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) ([]common.Address, error)
GetCancelQueueValidators get canceling queue validators
func (*Validators) GetCurrentEpochValidators ¶
func (v *Validators) GetCurrentEpochValidators(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) ([]common.Address, error)
func (*Validators) GetEffictiveValidatorsWithPage ¶
func (*Validators) GetInvalidValidatorsWithPage ¶
func (v *Validators) GetInvalidValidatorsWithPage(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, page *big.Int, size *big.Int) ([]common.Address, error)
GetInvalidValidatorsWithPage get invalid validators
func (*Validators) GetValidator ¶
func (v *Validators) GetValidator(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address) (*Validator, error)
GetValidator function GetValidator
func (*Validators) GetValidatorVoters ¶
func (v *Validators) GetValidatorVoters(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address, page *big.Int, size *big.Int) ([]common.Address, error)
GetValidatorVoters get the address voters
func (*Validators) InvalidValsLength ¶
func (v *Validators) InvalidValsLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (*big.Int, error)
InvalidValsLength function InvalidValsLength
func (*Validators) IsEffictiveValidator ¶
func (v *Validators) IsEffictiveValidator(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address) (bool, error)
IsEffictiveValidator function IsEffictiveValidator
func (*Validators) TotalDeposit ¶
func (v *Validators) TotalDeposit(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (*big.Int, error)
TotalDeposit function TotalDeposit
func (*Validators) ValidatorVotersLength ¶
func (v *Validators) ValidatorVotersLength(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, addr common.Address) (*big.Int, error)
ValidatorVotersLength function validatorVotersLength