common

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ZeroAddress is a special address, no one has control
	ZeroAddress = "0x0000000000000000000000000000000000000000"

	// ProposalIDContractAddr is the contract to used to generate the proposal ID
	ProposalIDContractAddr = "0x0000000000000000000000000000000000001000"

	NodeManagerContractAddr    = "0x0000000000000000000000000000000000001001"
	CouncilManagerContractAddr = "0x0000000000000000000000000000000000001002"

	// Addr2NameContractAddr for unique name mapping to address
	Addr2NameContractAddr                = "0x0000000000000000000000000000000000001003"
	WhiteListContractAddr                = "0x0000000000000000000000000000000000001004"
	WhiteListProviderManagerContractAddr = "0x0000000000000000000000000000000000001005"
	NotFinishedProposalContractAddr      = "0x0000000000000000000000000000000000001006"

	// EpochManagerContractAddr is the contract to used to manager chain epoch info
	EpochManagerContractAddr = "0x0000000000000000000000000000000000001007"

	GasManagerContractAddr = "0x0000000000000000000000000000000000001008"
)

Variables

This section is empty.

Functions

func CalculateDynamicGas

func CalculateDynamicGas(bytes []byte) uint64

func GenerateSolidityStruct

func GenerateSolidityStruct(goStruct any) (string, error)

func IsInSlice

func IsInSlice[T ~uint8 | ~string](value T, slice []T) bool

func ParseContractCallArgs

func ParseContractCallArgs(contractAbi *abi.ABI, data []byte, methodSig2ArgsReceiverConstructor map[string]func() any) (any, *abi.Method, error)

func RemoveFirstMatchStrInSlice

func RemoveFirstMatchStrInSlice(slice []string, val string) []string

Types

type Log

type Log struct {
	Address *types.Address
	Topics  []*types.Hash
	Data    []byte
	Removed bool
}

type SystemContract

type SystemContract interface {
	// Reset the state of the system contract
	Reset(uint64, ledger.StateLedger)

	// Run the system contract
	Run(*vm.Message) (*vm.ExecutionResult, error)

	// EstimateGas estimate the gas cost of the system contract
	EstimateGas(*types.CallArgs) (uint64, error)
}

type SystemContractConfig

type SystemContractConfig struct {
	Logger logrus.FieldLogger
}

type SystemContractConstruct

type SystemContractConstruct func(cfg *SystemContractConfig) SystemContract

Jump to

Keyboard shortcuts

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