IFactory
Inherits: IMigratable
Functions
initialize
Initializes the contract.
function initialize() external;
deployImplementation
Deploys an implementation contract.
function deployImplementation(bytes memory bytecode_) external returns (address implementation_);
Parameters
| Name | Type | Description |
|---|---|---|
bytecode_ | bytes | The bytecode of the implementation to deploy (including appended constructor data). |
Returns
| Name | Type | Description |
|---|---|---|
implementation_ | address | The address of the deployed implementation. |
deployProxy
Deploys a proxy contract.
function deployProxy(address implementation_, bytes32 salt_, bytes calldata initializeCallData_)
external
returns (address proxy_);
Parameters
| Name | Type | Description |
|---|---|---|
implementation_ | address | The address of the implementation the proxy should proxy. |
salt_ | bytes32 | A salt defined by the sender. |
initializeCallData_ | bytes | The call data used to initialize the proxy. |
Returns
| Name | Type | Description |
|---|---|---|
proxy_ | address | The address of the deployed proxy. |
pausedParameterKey
The parameter registry key used to fetch the paused status.
function pausedParameterKey() external pure returns (string memory key_);
migratorParameterKey
The parameter registry key used to fetch the migrator.
function migratorParameterKey() external pure returns (string memory key_);
paused
The pause status.
function paused() external view returns (bool paused_);
parameterRegistry
The address of the parameter registry.
function parameterRegistry() external view returns (address parameterRegistry_);
initializableImplementation
The address of the first temporary implementation that proxies will proxy.
*This contract is the first proxied implementation of any proxy, and allows the factory to then set the proxy's actual implementation, and initialize it with respect to that actual implementation. This ensures that:
- The address of a proxy is only defined by the nonce, and not by the implementation it will proxy.
- No contracts are deployed that are not used.
- The proxy can be easily initialized with respect to the actual implementation, atomically.*
function initializableImplementation() external view returns (address initializableImplementation_);
computeImplementationAddress
Computes the address of an implementation contract that would be deployed from a given bytecode.
The address is determined only by the bytecode, and so the same bytecode results in the same address.
function computeImplementationAddress(bytes calldata bytecode_) external view returns (address implementation_);
Parameters
| Name | Type | Description |
|---|---|---|
bytecode_ | bytes | The bytecode of the implementation to deploy (including appended constructor data). |
Returns
| Name | Type | Description |
|---|---|---|
implementation_ | address | The address of the implementation that would be deployed. |
computeProxyAddress
Computes the address of a proxy contract that would be deployed from given a caller and salt.
The actual salt used to deploy the proxy via create2 is keccak256(abi.encodePacked(caller_, salt_)).
function computeProxyAddress(address caller_, bytes32 salt_) external view returns (address proxy_);
Parameters
| Name | Type | Description |
|---|---|---|
caller_ | address | The address of the caller that would request the proxy deployment. |
salt_ | bytes32 | The salt defined by the caller. |
Returns
| Name | Type | Description |
|---|---|---|
proxy_ | address | The address of the proxy that would be deployed. |
Events
InitializableImplementationDeployed
Emitted when the "initializable implementation" is deployed.
This contract is only deployed once, when the factory itself is deployed.
event InitializableImplementationDeployed(address indexed implementation);
Parameters
| Name | Type | Description |
|---|---|---|
implementation | address | The address of the deployed "initializable implementation". |
ImplementationDeployed
Emitted when an implementation is deployed.
event ImplementationDeployed(address indexed implementation, bytes32 indexed bytecodeHash);
Parameters
| Name | Type | Description |
|---|---|---|
implementation | address | The address of the deployed implementation. |
bytecodeHash | bytes32 | The hash of the bytecode of the deployed implementation. |
ProxyDeployed
Emitted when a proxy is deployed.
The actual salt used to deploy the proxy via create2 is keccak256(abi.encodePacked(sender, salt)).
event ProxyDeployed(
address indexed proxy,
address indexed implementation,
address indexed sender,
bytes32 salt,
bytes initializeCallData
);
Parameters
| Name | Type | Description |
|---|---|---|
proxy | address | The address of the deployed proxy. |
implementation | address | The address of the implementation the proxy proxies. |
sender | address | The address of the sender that triggered the proxy deployment. |
salt | bytes32 | The salt defined by the sender. |
initializeCallData | bytes | The call data used to initialize the proxy. |
Errors
ZeroParameterRegistry
Thrown when the parameter registry is the zero address.
error ZeroParameterRegistry();
InvalidImplementation
Thrown when the implementation is the zero address.
error InvalidImplementation();
EmptyBytecode
Thrown when the bytecode is empty (i.e. of the implementation to deploy).
error EmptyBytecode();
DeployFailed
Thrown when the deployment of a contract (e.g. an implementation or proxy) fails.
error DeployFailed();
Paused
Thrown when any pausable function is called when the contract is paused.
error Paused();