Factory
FACTORY_LIB
_FACTORY_BASE_SALT
bytes32 _FACTORY_BASE_SALT
constructor
constructor(address factoryLib) internal
createExecutionEnvironment
function createExecutionEnvironment(address user, address control) external returns (address executionEnvironment)
Creates a new Execution Environment for the caller, given a DAppControl contract address.
Parameters
Name | Type | Description |
---|
user | address | The address of the user for whom the execution environment is being created. |
control | address | The address of the DAppControl contract for which the execution environment is being created. |
Return Values
Name | Type | Description |
---|
executionEnvironment | address | The address of the newly created Execution Environment instance. |
getExecutionEnvironment
function getExecutionEnvironment(address user, address control) external returns (address executionEnvironment, uint32 callConfig, bool exists)
Retrieves the address and configuration of an existing execution environment for a given user and DApp
control contract.
Parameters
Name | Type | Description |
---|
user | address | The address of the user for whom the execution environment is being queried. |
control | address | The address of the DAppControl contract associated with the execution environment. |
Return Values
Name | Type | Description |
---|
executionEnvironment | address | The address of the queried execution environment. |
callConfig | uint32 | The call configuration used by the execution environment, retrieved from the DAppControl contract. |
exists | bool | A boolean indicating whether the execution environment already exists (true) or not (false). |
_getOrCreateExecutionEnvironment
function _getOrCreateExecutionEnvironment(struct UserOperation userOp) internal returns (address executionEnvironment, struct DAppConfig dConfig)
Gets an existing execution environment or creates a new one if it does not exist for the specified user
operation.
Parameters
Name | Type | Description |
---|
userOp | struct UserOperation | The user operation containing details about the user and the DAppControl contract. |
Return Values
Name | Type | Description |
---|
executionEnvironment | address | The address of the execution environment that was found or created. |
dConfig | struct DAppConfig | The DAppConfig for the execution environment, specifying how operations should be handled. |
_getOrCreateExecutionEnvironment
function _getOrCreateExecutionEnvironment(address user, address control, uint32 callConfig) internal 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. |
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) internal 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. |
Return Values
Name | Type | Description |
---|
executionEnvironment | address | The address of the user's execution environment. |
_computeSalt
function _computeSalt(address user, address control, uint32 callConfig) internal view returns (bytes32)
_delegatecallFactoryLib
function _delegatecallFactoryLib(bytes data) internal returns (bytes)