predeploys

package
v0.0.0-...-1b5297f Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UUPSPlaceholder      = "0x2A00000000000000000000000000000000000000"
	L1Oracle             = "0x2A00000000000000000000000000000000000010"
	L2Portal             = "0x2A00000000000000000000000000000000000011"
	L2StandardBridge     = "0x2A00000000000000000000000000000000000012"
	L1FeeVault           = "0x2A00000000000000000000000000000000000020"
	L2BaseFeeVault       = "0x2A00000000000000000000000000000000000021"
	MintableERC20Factory = "0x2A000000000000000000000000000000000000f0"
)

TODO: This list should be generated from a configuration source

Variables

View Source
var (
	UUPSPlaceholderAddr      = common.HexToAddress(UUPSPlaceholder)
	L1OracleAddr             = common.HexToAddress(L1Oracle)
	L2PortalAddr             = common.HexToAddress(L2Portal)
	L2StandardBridgeAddr     = common.HexToAddress(L2StandardBridge)
	L1FeeVaultAddr           = common.HexToAddress(L1FeeVault)
	L2BaseFeeVaultAddr       = common.HexToAddress(L2BaseFeeVault)
	MintableERC20FactoryAddr = common.HexToAddress(MintableERC20Factory)

	Predeploys = make(map[string]*common.Address)
)
View Source
var (

	// bigL2PredeployNamespace represents the predeploy namespace as a big.Int
	BigL2PredeployNamespace = new(big.Int).SetBytes(l2PredeployNamespace.Bytes())

	// implementationSlot represents the EIP 1967 implementation storage slot
	ImplementationSlot = common.HexToHash("0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc")
	// adminSlot represents the EIP 1967 admin storage slot
	AdminSlot = common.HexToHash("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103")
	// predeployProxyCount represents the number of predeploy proxies in the namespace
	PredeployProxyCount uint64 = 2048
)

Functions

func AddressToCodeNamespace

func AddressToCodeNamespace(addr common.Address) (common.Address, error)

AddressToCodeNamespace takes a predeploy address and computes the implementation address that the implementation should be deployed at

func BuildSpecular

func BuildSpecular(ctx context.Context, predeploy PredeployConfigs) (DeploymentResults, DeploymentResults, error)

BuildSpecular will deploy the L2 predeploys so that their immutables are set correctly.

func IsL2Predeploy

func IsL2Predeploy(addr common.Address) bool

Types

type DeploymentResult

type DeploymentResult struct {
	Bytecode hexutil.Bytes
	Address  common.Address
}

type DeploymentResults

type DeploymentResults map[string]DeploymentResult

DeploymentResults represents the output of deploying each of the contracts so that the immutables can be set properly in the bytecode.

func BuildPredeployImpls

func BuildPredeployImpls(ctx context.Context, backend *backends.SimulatedBackend, predeploys PredeployConfigs) (DeploymentResults, error)

func BuildPredeployProxies

func BuildPredeployProxies(ctx context.Context, backend *backends.SimulatedBackend, predeploys PredeployConfigs, implDeploymentResults DeploymentResults) (DeploymentResults, error)

type PredeployConfig

type PredeployConfig struct {
	Proxied           bool
	ConstructorValues map[string]any
	Initializer       string
	InitializerValues map[string]any
	Storages          map[string]StorageConfig
}

type PredeployConfigs

type PredeployConfigs map[string]PredeployConfig

func (PredeployConfigs) Check

func (p PredeployConfigs) Check() error

type StorageConfig

type StorageConfig struct {
	ImplValue  any
	ProxyValue any
}

Jump to

Keyboard shortcuts

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