systemcontract

package
v0.2.1-beta Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const AddressListABI = `` /* 1663-byte string literal not displayed */
View Source
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.

View Source
const NodeVotesABI = `` /* 8945-byte string literal not displayed */
View Source
const ProposalsABI = `` /* 11513-byte string literal not displayed */
View Source
const SysGovABI = `` /* 970-byte string literal not displayed */
View Source
const SystemRewardsABI = `` /* 8925-byte string literal not displayed */
View Source
const ValidatorsABI = `` /* 11029-byte string literal not displayed */

ValidatorsABI contains all methods to interactive with validator contracts.

Variables

View Source
var (
	BlackLastUpdatedNumberPosition = common.BytesToHash([]byte{0x07})
	RulesLastUpdatedNumberPosition = common.BytesToHash([]byte{0x08})
)
View Source
var (
	ValidatorsContractName    = "Validators"
	ProposalsContractName     = "Proposals"
	NodeVotesContractName     = "NodeVotes"
	SystemRewardsContractName = "SystemRewards"
	AddressListContractName   = "address_list"

	SysGovContractName = "governance"

	ValidatorsContractAddr    = common.HexToAddress("0x0000000000000000000000000000000000fff001")
	ProposalsContractAddr     = common.HexToAddress("0x0000000000000000000000000000000000fff002")
	NodeVotesContractAddr     = common.HexToAddress("0x0000000000000000000000000000000000fff003")
	SystemRewardsContractAddr = common.HexToAddress("0x0000000000000000000000000000000000fff004")
	AddressListContractAddr   = common.HexToAddress("0x0000000000000000000000000000000000fff005")
	SysGovContractAddr        = common.HexToAddress("0x0000000000000000000000000000000000fff006")

	// SysGovToAddr is the To address for the system governance transaction, NOT contract address
	SysGovToAddr = common.HexToAddress("0x000000000000000000000000000000000000ffff")
)
View Source
var (
	DevAdmin        = common.HexToAddress("0xA88548E97AF8809aFaC9dC7a930650c117951059")
	DevAdminTestnet = common.HexToAddress("0xA88548E97AF8809aFaC9dC7a930650c117951059")
)
View Source
var (
	InitValAddress = common.HexToAddress("0x1c0e8eaf42ec8d4010e960313248d2af95be7d34")
	InitRate       = uint8(70)
	InitDeposit    = new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1000))
)

using for Validators contract's initialize

Functions

func GetInteractiveABI

func GetInteractiveABI() map[string]abi.ABI

func GetValidatorAddr

func GetValidatorAddr(blockNum *big.Int, config *params.ChainConfig) *common.Address

Types

type Base

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

func NewBase

func NewBase() *Base

NewBase return Base contract instance

func (*Base) GetMinDeposit

func (b *Base) GetMinDeposit(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (*big.Int, error)

GetMinDeposit `MIN_DEPOSIT`

func (*Base) GetMinRate

func (b *Base) GetMinRate(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (uint8, error)

type EpochInfo

type EpochInfo struct {
	BlockReward    *big.Int
	Tvl            *big.Int
	ValidatorCount *big.Int
}

EpochInfo struct `epoch` in SystemRewards contract

type IUpgradeAction

type IUpgradeAction interface {
	GetName() string
	Update(config *params.ChainConfig, height *big.Int, state *state.StateDB) error
	Execute(state *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) error
}

type Proposals

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

func NewProposals

func NewProposals() *Proposals

NewProposals return Proposals contract instance

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)

func (*Proposals) InitProposal

func (p *Proposals) InitProposal(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig, value *big.Int, pType uint8, rate uint8, details string) error

InitProposal function initProposal

type SysContractVersion

type SysContractVersion int
const (
	SysContractV1 SysContractVersion = iota + 1
	SysContractV2
)

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

type ValidatorV0

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

func NewValidatorV0

func NewValidatorV0() *ValidatorV0

func (*ValidatorV0) GetTopValidators

func (v *ValidatorV0) GetTopValidators(statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) ([]common.Address, error)

func (*ValidatorV0) GetValidatorFeeAddr

func (v *ValidatorV0) GetValidatorFeeAddr(val common.Address, statedb *state.StateDB, header *types.Header, chainContext core.ChainContext, config *params.ChainConfig) (common.Address, error)

Jump to

Keyboard shortcuts

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