system

package
v1.0.0-release Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SystemInteractiveABI contains all methods to interactive with system contracts.
	SystemInteractiveABI = `` /* 3777-byte string literal not displayed */

	OnChainDaoInteractiveABI = `` /* 2954-byte string literal not displayed */

	CommunityPoolInteractiveABI = `` /* 247-byte string literal not displayed */

	AddrListInteractiveABI = `` /* 1351-byte string literal not displayed */

)
View Source
const (
	SysContractName           = "SystemContract"
	OnChainDaoContractName    = "OnChainDaoContract"
	AddressListContractName   = "AddressListContract"
	CommunityPoolContractName = "CommunityPoolContract"
)
View Source
const (
	ContractV0 = iota // 0
	ContractV1        // 1
	ContractV2        // 2
	ContractV3        // 3
	ContractV4        // 4
	ContractV5        // 5
)
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;
	  bool public checkInnerCreation;
   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`, `devVerifyEnabled`, `checkInnerCreation` and `admin` will be packed, and stores at slot 0, `pendingAdmin` stores at slot 1, so the position for `devs` is 2.

Variables

View Source
var (
	BlackLastUpdatedNumberPosition = common.BytesToHash([]byte{0x07})
	RulesLastUpdatedNumberPosition = common.BytesToHash([]byte{0x08})
)
View Source
var (
	MaxValidators        = uint8(21)
	MinSelfStake         = big.NewInt(100)
	ShareOutBonusPercent = uint8(80)
	LocalAddress         = common.HexToAddress("0x0000000000000000000000000000000000000000")
)
View Source
var (
	SystemContract        = common.HexToAddress("0x000000000000000000000000000000000000F000")
	OnChainDaoContract    = common.HexToAddress("0x000000000000000000000000000000000000F001")
	AddressListContract   = common.HexToAddress("0x000000000000000000000000000000000000F002")
	CommunityPoolContract = common.HexToAddress("0x000000000000000000000000000000000000F003")
)
View Source
var (
	AdminForDevelopChain common.Address
)

Functions

func ABI

func ABI(contractName string, version uint8) abi.ABI

ABI return abi for given contract calling

func ABIPack

func ABIPack(contractName string, version uint8, method string, args ...interface{}) ([]byte, error)

ABIPack generates the data field for given contract calling

func GetContractAddress

func GetContractAddress(contractName string, version uint8) common.Address

func GetContractAddressByConfig

func GetContractAddressByConfig(contractName string, blockNum *big.Int, config *params.ChainConfig) common.Address

func GetContractVersion

func GetContractVersion(contractName string, blockNum *big.Int, config *params.ChainConfig) uint8

Types

type ContractInfo

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

type SysContractVersion

type SysContractVersion int
const (
	GenesisVersion SysContractVersion = iota
	EarthVersion
)

func GetSysContractVersion

func GetSysContractVersion(blockNum *big.Int, config *params.ChainConfig) SysContractVersion

Jump to

Keyboard shortcuts

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