IL2ContractDeployer

Git Source

Author: Matter Labs

System smart contract that is responsible for deploying other smart contracts on a ZK chain.

Functions

allowedBytecodeTypesToDeploy

Returns what types of bytecode are allowed to be deployed on this chain

function allowedBytecodeTypesToDeploy()
  external
  view
  returns (AllowedBytecodeTypes mode);

forceDeployOnAddresses

This method is to be used only during an upgrade to set bytecodes on specific addresses.

function forceDeployOnAddresses(ForceDeployment[] calldata _deployParams)
  external;

create2

Deploys a contract with similar address derivation rules to the EVM's CREATE2 opcode.

function create2(bytes32 _salt, bytes32 _bytecodeHash, bytes calldata _input)
  external;

Parameters

NameTypeDescription
_saltbytes32The create2 salt.
_bytecodeHashbytes32The correctly formatted hash of the bytecode.
_inputbytesThe constructor calldata.

setAllowedBytecodeTypesToDeploy

Changes what types of bytecodes are allowed to be deployed on the chain.

function setAllowedBytecodeTypesToDeploy(
  AllowedBytecodeTypes newAllowedBytecodeTypes
) external;

Parameters

NameTypeDescription
newAllowedBytecodeTypesAllowedBytecodeTypesThe new allowed bytecode types mode.

Structs

ForceDeployment

A struct that describes a forced deployment on an address.

struct ForceDeployment {
  bytes32 bytecodeHash;
  address newAddress;
  bool callConstructor;
  uint256 value;
  bytes input;
}

Properties

NameTypeDescription
bytecodeHashbytes32The bytecode hash to put on an address.
newAddressaddressThe address on which to deploy the bytecodehash to.
callConstructorboolWhether to run the constructor on the force deployment.
valueuint256The msg.value with which to initialize a contract.
inputbytesThe constructor calldata.