Documentation ¶
Index ¶
- Variables
- func DeployWithDeterministicDeployer(backend *backends.SimulatedBackend, contractName string) ([]byte, error)
- func NewBackendWithGenesisTimestamp(chainID *big.Int, ts uint64, shanghai bool, ...) (*backends.SimulatedBackend, error)
- func NewL1Backend() (*backends.SimulatedBackend, error)
- func NewL2Backend() (*backends.SimulatedBackend, error)
- func NewL2BackendWithChainIDAndPredeploys(chainID *big.Int, predeploys map[string]*common.Address) (*backends.SimulatedBackend, error)
- type Constructor
- type Deployer
- type Deployment
- type SuperchainPredeploy
Constants ¶
This section is empty.
Variables ¶
var ChainID = big.NewInt(1337)
ChainID is the chain id used for simulated backends
var TestAddress = crypto.PubkeyToAddress(TestKey.PublicKey)
var TestKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
TestKey is the same test key that geth uses
Functions ¶
func DeployWithDeterministicDeployer ¶ added in v1.4.0
func DeployWithDeterministicDeployer(backend *backends.SimulatedBackend, contractName string) ([]byte, error)
DeployWithDeterministicDeployer deploys a smart contract on a simulated Ethereum blockchain using a deterministic deployment proxy (Arachnid's).
Parameters: - backend: A pointer to backends.SimulatedBackend, representing the simulated Ethereum blockchain. Expected to have Arachnid's proxy deployer predeploys at 0x4e59b44847b379578588920cA78FbF26c0B4956C, NewL2BackendWithChainIDAndPredeploys handles this for you. - contractName: A string representing the name of the contract to be deployed.
Returns: - []byte: The deployed bytecode of the contract. - error: An error object indicating any issues encountered during the deployment process.
The function logs a fatal error and exits if there are any issues with transaction mining, if the deployment fails, or if the deployed bytecode is not found at the computed address.
func NewL1Backend ¶ added in v1.2.0
func NewL1Backend() (*backends.SimulatedBackend, error)
NewL1Backend returns a SimulatedBackend suitable for L1. It has the latest L1 hardforks enabled.
func NewL2Backend ¶ added in v1.2.0
func NewL2Backend() (*backends.SimulatedBackend, error)
NewL2Backend returns a SimulatedBackend suitable for L2. It has the latest L2 hardforks enabled.
func NewL2BackendWithChainIDAndPredeploys ¶ added in v1.4.0
func NewL2BackendWithChainIDAndPredeploys(chainID *big.Int, predeploys map[string]*common.Address) (*backends.SimulatedBackend, error)
NewL2BackendWithChainIDAndPredeploys returns a SimulatedBackend suitable for L2. It has the latest L2 hardforks enabled, and allows for the configuration of the network's chain ID and predeploys.
Types ¶
type Constructor ¶
type Constructor struct { Name string Args []interface{} }
type Deployer ¶
type Deployer func(*backends.SimulatedBackend, *bind.TransactOpts, Constructor) (*types.Transaction, error)
type Deployment ¶
func Deploy ¶
func Deploy(backend *backends.SimulatedBackend, constructors []Constructor, cb Deployer) ([]Deployment, error)