Documentation ¶
Index ¶
- Constants
- Variables
- func CalcAllowanceStorageKey(owner common.Address, spender common.Address) common.Hash
- func CalcPVMETHStorageKey(addr common.Address) common.Hash
- func CalcStorageKey(a, b BytesBacked) common.Hash
- func GetPVMETHBalance(db *state.StateDB, addr common.Address) *big.Int
- func GetPVMETHTotalSupplySlot() common.Hash
- func IterateAddrList(r io.Reader, cb AddressCB) error
- func IterateAllowanceList(r io.Reader, cb AllowanceCB) error
- func IterateDBAddresses(db ethdb.Database, cb AddressCB) error
- func IterateMintEvents(db ethdb.Database, headNum uint64, cb AddressCBWithHead, ...) error
- func MigrateBalances(mutableDB *state.StateDB, dbFactory util.DBFactory, addresses []common.Address, ...) error
- func MustOpenDB(dataDir string) ethdb.Database
- func MustOpenDBWithCacheOpts(dataDir string, cacheSize, handles int) ethdb.Database
- func ReadGenesis(r io.Reader) (*core.Genesis, error)
- func ReadGenesisFromFile(path string) (*core.Genesis, error)
- type AddressCB
- type AddressCBWithHead
- type AllowanceCB
- type BytesBacked
Constants ¶
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 ¶
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") )
var ( // PVMETHAddress is the address of the PVM ETH predeploy. PVMETHAddress = common.HexToAddress("0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000") )
Functions ¶
func CalcAllowanceStorageKey ¶
CalcAllowanceStorageKey calculates the storage key of an allowance in PVM ETH.
func CalcPVMETHStorageKey ¶
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 ¶
GetPVMETHBalance gets a user's PVM ETH balance from state by querying the appropriate storage slot directly.
func IterateAddrList ¶
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 ¶
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 ¶
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 ¶
MustOpenDBWithCacheOpts opens a Geth database or panics. Allows the caller to pass in LevelDB cache parameters.
func ReadGenesis ¶
ReadGenesis reads a genesis object from an io.Reader.
Types ¶
type AllowanceCB ¶
type BytesBacked ¶
type BytesBacked interface {
Bytes() []byte
}
BytesBacked is a re-export of the same interface in Geth, which is unfortunately private.