Skip to main content

Solidity API

Atlas​

The Execution Abstraction protocol.

constructor​

constructor(uint256 escrowDuration, uint256 atlasSurchargeRate, uint256 bundlerSurchargeRate, address verification, address simulator, address initialSurchargeRecipient, address l2GasCalculator, address factoryLib) public

metacall​

function metacall(struct UserOperation userOp, struct SolverOperation[] solverOps, struct DAppOperation dAppOp, address gasRefundBeneficiary) external payable returns (bool auctionWon)

metacall is the entrypoint function for the Atlas transactions.

Any ETH sent as msg.value with a metacall should be considered a potential subsidy for the winning solver's gas repayment.

Parameters​

NameTypeDescription
userOpstruct UserOperationThe UserOperation struct containing the user's transaction data.
solverOpsstruct SolverOperation[]The SolverOperation array containing the solvers' transaction data.
dAppOpstruct DAppOperationThe DAppOperation struct containing the DApp's transaction data.
gasRefundBeneficiaryaddressThe address to receive the gas refund.

Return Values​

NameTypeDescription
auctionWonboolA boolean indicating whether there was a successful, winning solver.

execute​

function execute(struct DAppConfig dConfig, struct UserOperation userOp, struct SolverOperation[] solverOps, bytes32 userOpHash, address executionEnvironment, address bundler, bool isSimulation) external payable returns (struct Context ctx)

execute is called above, in a try-catch block in metacall.

Parameters​

NameTypeDescription
dConfigstruct DAppConfigConfiguration data for the DApp involved, containing execution parameters and settings.
userOpstruct UserOperationUserOperation struct of the current metacall tx.
solverOpsstruct SolverOperation[]SolverOperation array of the current metacall tx.
userOpHashbytes32The hash of the UserOperation.
executionEnvironmentaddressThe address of the execution environment.
bundleraddressThe address of the bundler.
isSimulationboolWhether the current execution is a simulation.

Return Values​

NameTypeDescription
ctxstruct ContextContext struct containing relevant context information for the Atlas auction.

_bidFindingIteration​

function _bidFindingIteration(struct Context ctx, struct DAppConfig dConfig, struct UserOperation userOp, struct SolverOperation[] solverOps, bytes returnData) internal returns (uint256)

Called above in execute if the DAppConfig requires ex post bids. Sorts solverOps by bid amount and executes them in descending order until a successful winner is found.

Parameters​

NameTypeDescription
ctxstruct ContextContext struct containing the current state of the escrow lock.
dConfigstruct DAppConfigConfiguration data for the DApp involved, containing execution parameters and settings.
userOpstruct UserOperationUserOperation struct of the current metacall tx.
solverOpsstruct SolverOperation[]SolverOperation array of the current metacall tx.
returnDatabytesReturn data from the preOps and userOp calls.

Return Values​

NameTypeDescription
[0]uint256The winning bid amount or 0 when no solverOps.

_bidKnownIteration​

function _bidKnownIteration(struct Context ctx, struct DAppConfig dConfig, struct UserOperation userOp, struct SolverOperation[] solverOps, bytes returnData) internal returns (uint256)

Called above in execute as an alternative to _bidFindingIteration, if solverOps have already been reliably sorted. Executes solverOps in order until a successful winner is found.

Parameters​

NameTypeDescription
ctxstruct ContextContext struct containing the current state of the escrow lock.
dConfigstruct DAppConfigConfiguration data for the DApp involved, containing execution parameters and settings.
userOpstruct UserOperationUserOperation struct of the current metacall tx.
solverOpsstruct SolverOperation[]SolverOperation array of the current metacall tx.
returnDatabytesReturn data from the preOps and userOp calls.

Return Values​

NameTypeDescription
[0]uint256The winning bid amount or 0 when no solverOps.

_handleErrors​

function _handleErrors(bytes revertData, uint32 callConfig) internal view

Called at the end of metacall to bubble up specific error info in a revert.

Parameters​

NameTypeDescription
revertDatabytesRevert data from a failure during the execution of the metacall.
callConfiguint32The CallConfig of the current metacall tx.

_verifyUserControlExecutionEnv​

function _verifyUserControlExecutionEnv(address environment, address user, address control, uint32 callConfig) internal returns (bool)

Returns whether or not the execution environment address matches what's expected from the set of inputs.

Parameters​

NameTypeDescription
environmentaddressExecutionEnvironment address
useraddressUser address
controladdressDAppControl contract address
callConfiguint32CallConfig of the current metacall tx.

Return Values​

NameTypeDescription
[0]boolA bool indicating whether the execution environment address is the same address that the factory would deploy an Execution Environment to, given the user, control, and callConfig params.