DAppControlTemplate
The DAppControlTemplate
is the most abstract contract in the Atlas Protocol's dApp integration hierarchy. It defines essential internal virtual functions that form the foundation for dApp modules. The DAppControl
contract, which inherits from DAppControlTemplate
, introduces external functions that wrap these abstract internal functions and apply necessary modifiers for access control and execution phase management.
The contract inherits from AtlasErrors
.
Constants
Constant | Type | Value | Description |
---|---|---|---|
DEFAULT_SOLVER_GAS_LIMIT | uint32 | 1_000_000 | Default gas limit for solver operations. |
Constructor
constructor() { }
The constructor is intentionally left empty as DAppControlTemplate is an abstract contract.
Virtual Functions
_preOpsCall
function _preOpsCall(UserOperation calldata) internal virtual returns (bytes memory)
Description
Executed before processing a UserOperation. Allows dApps to perform preliminary operations or checks.
Parameters
Name | Type | Description |
---|---|---|
(Unnamed) | UserOperation | The user operation being processed. |
Return Values
Name | Type | Description |
---|---|---|
(Unnamed) | bytes | Data to be passed to subsequent execution phases. |
_checkUserOperation
function _checkUserOperation(UserOperation memory) internal virtual
Description
Validates the integrity and correctness of a UserOperation.
Parameters
Name | Type | Description |
---|---|---|
(Unnamed) | UserOperation | The user operation to validate. |
_allocateValueCall
function _allocateValueCall(address bidToken, uint256 bidAmount, bytes calldata data) internal virtual
Description
Allocates value based on the outcome of a SolverOperation.
Parameters
Name | Type | Description |
---|---|---|
bidToken | address | Address of the token used for the bid. |
bidAmount | uint256 | Amount of the bid. |
data | bytes | Additional data required for allocation. |
_preSolverCall
function _preSolverCall(SolverOperation calldata, bytes calldata) internal virtual
Description
Executed before a solver performs its operation.
Parameters
Name | Type | Description |
---|---|---|
(Unnamed) | SolverOperation | The solver operation being executed. |
(Unnamed) | bytes | Data returned from the preOps call. |
_postSolverCall
function _postSolverCall(SolverOperation calldata, bytes calldata) internal virtual
Description
Executed after a solver completes its operation.
Parameters
Name | Type | Description |
---|---|---|
(Unnamed) | SolverOperation | The solver operation that was executed. |
(Unnamed) | bytes | Data returned from the solver's execution. |
_postOpsCall
function _postOpsCall(bool, bytes calldata) internal virtual
Description
Executed after all user and solver operations within a metacall transaction are completed.
Parameters
Name | Type | Description |
---|---|---|
(Unnamed) | bool | Indicates if a winning SolverOperation was successful. |
(Unnamed) | bytes | Data returned from the previous call phase. |
Getters & Helpers
getBidFormat
function getBidFormat(UserOperation calldata userOp) public view virtual returns (address bidToken)
Description
Retrieves the expected bid token format for a given user operation.
getBidValue
function getBidValue(SolverOperation calldata solverOp) public view virtual returns (uint256)
Description
Retrieves the bid value associated with a specific solver operation.
getSolverGasLimit
function getSolverGasLimit() public view virtual returns (uint32)
Description
Retrieves the gas limit set for solver operations.
Error Handling
The contract utilizes custom errors inherited from AtlasErrors:
AtlasErrors.NotImplemented()
- Other custom errors from AtlasErrors based on specific implementation needs.