Solidity API
FactoryLib
EXECUTION_ENV_TEMPLATE
address EXECUTION_ENV_TEMPLATE
constructor
constructor(address executionTemplate) public
Initializes a new Factory contract instance by setting the immutable salt for deterministic deployment of Execution Environments and storing the execution template address.
The Execution Environment Template must be separately deployed using the same calculated salt.
Parameters
Name | Type | Description |
---|---|---|
executionTemplate | address | Address of the pre-deployed execution template contract for creating Execution Environment instances. |
getOrCreateExecutionEnvironment
function getOrCreateExecutionEnvironment(address user, address control, uint32 callConfig, bytes32 salt) public payable returns (address executionEnvironment)
Deploys a new execution environment or retrieves the address of an existing one based on the DApp control, user, and configuration.
Uses the create2
opcode for deterministic deployment, allowing the calculation of the execution
environment's address before deployment. The deployment uses a combination of the DAppControl address, user
address, call configuration, and a unique salt to ensure the uniqueness and predictability of the environment's
address.
Parameters
Name | Type | Description |
---|---|---|
user | address | The address of the user for whom the execution environment is being set. |
control | address | The address of the DAppControl contract providing the operational context. |
callConfig | uint32 | CallConfig settings of the DAppControl contract. |
salt | bytes32 |
Return Values
Name | Type | Description |
---|---|---|
executionEnvironment | address | The address of the newly created or already existing execution environment. |
getExecutionEnvironmentCustom
function getExecutionEnvironmentCustom(address user, address control, uint32 callConfig, bytes32 salt) public view returns (address executionEnvironment)
Generates the address of a user's execution environment affected by deprecated callConfig changes in the DAppControl.
Calculates the deterministic address of the execution environment based on the user, control, callConfig, and controlCodeHash, ensuring consistency across changes in callConfig.
Parameters
Name | Type | Description |
---|---|---|
user | address | The address of the user for whom the execution environment's address is being generated. |
control | address | The address of the DAppControl contract associated with the execution environment. |
callConfig | uint32 | The configuration flags defining the behavior of the execution environment. |
salt | bytes32 |
Return Values
Name | Type | Description |
---|---|---|
executionEnvironment | address | The address of the user's execution environment. |
_getMimicCreationCode
function _getMimicCreationCode(address user, address control, uint32 callConfig) internal view returns (bytes creationCode)
Generates the creation code for the execution environment contract.
Parameters
Name | Type | Description |
---|---|---|
user | address | The address of the user for whom the execution environment is being created, contributing to the uniqueness of the creation code. |
control | address | The address of the DAppControl contract associated with the execution environment. |
callConfig | uint32 | The configuration flags defining the behavior of the execution environment. |
Return Values
Name | Type | Description |
---|---|---|
creationCode | bytes | The bytecode representing the creation code of the execution environment contract. |