ether

package
v0.0.0-...-23d24bf Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// BalanceSlot is an ordinal used to represent slots corresponding to PVM_ETH
	// balances in the state.
	BalanceSlot = 1

	// AllowanceSlot is an ordinal used to represent slots corresponding to PVM_ETH
	// allowances in the state.
	AllowanceSlot = 2
)

Variables

View Source
var (
	// AddressPreimagePrefix is the byte prefix of address preimages
	// in Geth's database.
	AddressPreimagePrefix = []byte("addr-preimage-")

	// ErrStopIteration will stop iterators early when returned from the
	// iterator's callback.
	ErrStopIteration = errors.New("iteration stopped")

	// MintTopic is the topic for mint events on PVM ETH.
	MintTopic = common.HexToHash("0x0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885")
)
View Source
var (
	// PVMETHAddress is the address of the PVM ETH predeploy.
	PVMETHAddress = common.HexToAddress("0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000")
)

Functions

func CalcAllowanceStorageKey

func CalcAllowanceStorageKey(owner common.Address, spender common.Address) common.Hash

CalcAllowanceStorageKey calculates the storage key of an allowance in PVM ETH.

func CalcPVMETHStorageKey

func CalcPVMETHStorageKey(addr common.Address) common.Hash

CalcPVMETHStorageKey calculates the storage key of an PVM ETH balance.

func CalcStorageKey

func CalcStorageKey(a, b BytesBacked) common.Hash

CalcStorageKey is a helper method to calculate storage keys.

func GetPVMETHBalance

func GetPVMETHBalance(db *state.StateDB, addr common.Address) *big.Int

GetPVMETHBalance gets a user's PVM ETH balance from state by querying the appropriate storage slot directly.

func GetPVMETHTotalSupplySlot

func GetPVMETHTotalSupplySlot() common.Hash

func IterateAddrList

func IterateAddrList(r io.Reader, cb AddressCB) error

IterateAddrList iterates over each address in an address list, calling the callback with the address.

func IterateAllowanceList

func IterateAllowanceList(r io.Reader, cb AllowanceCB) error

IterateAllowanceList iterates over each address in an allowance list, calling the callback with the owner and the spender.

func IterateDBAddresses

func IterateDBAddresses(db ethdb.Database, cb AddressCB) error

IterateDBAddresses iterates over each address in Geth's address preimage database, calling the callback with the address.

func IterateMintEvents

func IterateMintEvents(db ethdb.Database, headNum uint64, cb AddressCBWithHead, progressCb func(uint64)) error

IterateMintEvents iterates over each mint event in the database starting from head and stopping at genesis.

func MigrateBalances

func MigrateBalances(mutableDB *state.StateDB, dbFactory util.DBFactory, addresses []common.Address, allowances []*crossdomain.Allowance, chainID int, noCheck bool) error

MigrateBalances migrates all balances in the LegacyERC20ETH contract into state. It performs checks in parallel with mutations in order to reduce overall migration time.

func MustOpenDB

func MustOpenDB(dataDir string) ethdb.Database

MustOpenDB opens a Geth database, or panics. Note that the database must be opened with a freezer in order to properly read historical data.

func MustOpenDBWithCacheOpts

func MustOpenDBWithCacheOpts(dataDir string, cacheSize, handles int) ethdb.Database

MustOpenDBWithCacheOpts opens a Geth database or panics. Allows the caller to pass in LevelDB cache parameters.

func ReadGenesis

func ReadGenesis(r io.Reader) (*core.Genesis, error)

ReadGenesis reads a genesis object from an io.Reader.

func ReadGenesisFromFile

func ReadGenesisFromFile(path string) (*core.Genesis, error)

ReadGenesisFromFile reads a genesis object from a file.

Types

type AddressCB

type AddressCB func(address common.Address) error

type AddressCBWithHead

type AddressCBWithHead func(address common.Address, headNum uint64) error

type AllowanceCB

type AllowanceCB func(owner, spender common.Address) error

type BytesBacked

type BytesBacked interface {
	Bytes() []byte
}

BytesBacked is a re-export of the same interface in Geth, which is unfortunately private.

Jump to

Keyboard shortcuts

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