Skip to main content

Solidity API

Factory

FACTORY_LIB

address 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

NameTypeDescription
useraddressThe address of the user for whom the execution environment is being created.
controladdressThe address of the DAppControl contract for which the execution environment is being created.

Return Values

NameTypeDescription
executionEnvironmentaddressThe 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

NameTypeDescription
useraddressThe address of the user for whom the execution environment is being queried.
controladdressThe address of the DAppControl contract associated with the execution environment.

Return Values

NameTypeDescription
executionEnvironmentaddressThe address of the queried execution environment.
callConfiguint32The call configuration used by the execution environment, retrieved from the DAppControl contract.
existsboolA 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

NameTypeDescription
userOpstruct UserOperationThe user operation containing details about the user and the DAppControl contract.

Return Values

NameTypeDescription
executionEnvironmentaddressThe address of the execution environment that was found or created.
dConfigstruct DAppConfigThe 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

NameTypeDescription
useraddressThe address of the user for whom the execution environment is being set.
controladdressThe address of the DAppControl contract providing the operational context.
callConfiguint32CallConfig settings of the DAppControl contract.

Return Values

NameTypeDescription
executionEnvironmentaddressThe 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

NameTypeDescription
useraddressThe address of the user for whom the execution environment's address is being generated.
controladdressThe address of the DAppControl contract associated with the execution environment.
callConfiguint32The configuration flags defining the behavior of the execution environment.

Return Values

NameTypeDescription
executionEnvironmentaddressThe 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)