Skip to main content

Solidity API

AtlasVerification

AtlasVerification handles the verification of DAppConfigs, UserOperations, SolverOperations, and DAppOperations within a metacall to ensure that calldata sourced from various parties is safe and valid.

constructor

constructor(address atlas, address l2GasCalculator) public

validateCalls

function validateCalls(struct DAppConfig dConfig, struct UserOperation userOp, struct SolverOperation[] solverOps, struct DAppOperation dAppOp, uint256 metacallGasLeft, uint256 msgValue, address msgSender, bool isSimulation) external returns (uint256 allSolversGasLimit, uint256 allSolversCalldataGas, uint256 bidFindOverhead, enum ValidCallsResult verifyCallsResult)

The validateCalls function verifies the validity of the metacall calldata components.

Parameters

NameTypeDescription
dConfigstruct DAppConfigConfiguration data for the DApp involved, containing execution parameters and settings.
userOpstruct UserOperationThe UserOperation struct of the metacall.
solverOpsstruct SolverOperation[]An array of SolverOperation structs.
dAppOpstruct DAppOperationThe DAppOperation struct of the metacall.
metacallGasLeftuint256The gasleft at the start of the metacall.
msgValueuint256The ETH value sent with the metacall transaction.
msgSenderaddressThe forwarded msg.sender of the original metacall transaction in the Atlas contract.
isSimulationboolA boolean indicating if the call is a simulation.

Return Values

NameTypeDescription
allSolversGasLimituint256The calldata and execution gas limits of all solverOps summed.
allSolversCalldataGasuint256The sum of all solverOp calldata gas (excl. non-solver calldata).
bidFindOverheaduint256The gas overhead for bid-finding loop in exPostBids mode.
verifyCallsResultenum ValidCallsResultThe result of the ValidCalls check, in enum ValidCallsResult form.

verifySolverOp

function verifySolverOp(struct SolverOperation solverOp, bytes32 userOpHash, uint256 userMaxFeePerGas, address bundler, bool allowsTrustedOpHash) external view returns (uint256 result)

The verifySolverOp function verifies the validity of a SolverOperation.

Parameters

NameTypeDescription
solverOpstruct SolverOperationThe SolverOperation struct to verify.
userOpHashbytes32The hash of the associated UserOperation struct.
userMaxFeePerGasuint256The maximum fee per gas the user is willing to pay.
bundleraddressThe address of the bundler.
allowsTrustedOpHashbool

Return Values

NameTypeDescription
resultuint256The result of the SolverOperation verification, containing SolverOutcome info in a bitmap.

verifyCallConfig

function verifyCallConfig(uint32 callConfig) external pure returns (enum ValidCallsResult)

External function to call the internal _verifyCallConfig function

Parameters

NameTypeDescription
callConfiguint32The call configuration struct to verify.

Return Values

NameTypeDescription
[0]enum ValidCallsResultThe result of the ValidCalls check, in enum ValidCallsResult form.

_verifyCallConfig

function _verifyCallConfig(uint32 callConfig) internal pure returns (enum ValidCallsResult)

The _verifyCallConfig internal function verifies the validity of the call configuration.

Parameters

NameTypeDescription
callConfiguint32The call configuration to verify.

Return Values

NameTypeDescription
[0]enum ValidCallsResultThe result of the ValidCalls check, in enum ValidCallsResult form.

_verifyAuctioneer

function _verifyAuctioneer(struct DAppConfig dConfig, struct UserOperation userOp, struct SolverOperation[] solverOps, struct DAppOperation dAppOp, address msgSender) internal pure returns (enum ValidCallsResult validCallsResult, bool allowUnapprovedDAppSignatories)

The _verifyAuctioneer internal function is called by _validCalls to verify that the auctioneer of the metacall is valid according to the rules set in the DAppConfig.

Parameters

NameTypeDescription
dConfigstruct DAppConfigConfiguration data for the DApp involved, containing execution parameters and settings.
userOpstruct UserOperationThe UserOperation struct of the metacall.
solverOpsstruct SolverOperation[]An array of SolverOperation structs.
dAppOpstruct DAppOperationThe DAppOperation struct of the metacall.
msgSenderaddressThe bundler (msg.sender) of the metacall transaction in the Atlas contract.

Return Values

NameTypeDescription
validCallsResultenum ValidCallsResultThe result of the ValidCalls check, in enum ValidCallsResult form.
allowUnapprovedDAppSignatoriesboolA boolean indicating if the signatory approval check should be bypassed.

getSolverPayload

function getSolverPayload(struct SolverOperation solverOp) external view returns (bytes32 payload)

The getSolverPayload function returns the hash of a SolverOperation struct for use in signatures.

Parameters

NameTypeDescription
solverOpstruct SolverOperationThe SolverOperation struct to hash.

_verifySolverSignature

function _verifySolverSignature(struct SolverOperation solverOp) internal view returns (bool)

The internal _verifySolverSignature function verifies the signature of a SolverOperation.

Parameters

NameTypeDescription
solverOpstruct SolverOperationThe SolverOperation struct to verify.

Return Values

NameTypeDescription
[0]boolA boolean indicating if the signature is valid.

_getSolverOpHash

function _getSolverOpHash(struct SolverOperation solverOp) internal pure returns (bytes32 solverOpHash)

The _getSolverOpHash internal function returns the hash of a SolverOperation struct.

Parameters

NameTypeDescription
solverOpstruct SolverOperationThe SolverOperation struct to hash.

Return Values

NameTypeDescription
solverOpHashbytes32The hash of the SolverOperation struct.

_verifyDApp

function _verifyDApp(struct DAppConfig dConfig, struct DAppOperation dAppOp, address msgSender, bool allowUnapprovedDAppSignatories, bool isSimulation) internal returns (enum ValidCallsResult)

Verifies that the dapp's data matches the data submitted by the user and solvers. NOTE: The dapp's front end is the last party in the supply chain to submit data. If any other party (user, solver, FastLane, or a collusion between all of them) attempts to alter it, this check will fail.

Parameters

NameTypeDescription
dConfigstruct DAppConfigThe DAppConfig containing configuration details.
dAppOpstruct DAppOperationThe DAppOperation struct of the metacall.
msgSenderaddressThe forwarded msg.sender of the original metacall transaction in the Atlas contract.
allowUnapprovedDAppSignatoriesboolBoolean indicating whether to bypass signatory approval.
isSimulationboolBoolean indicating whether the execution is a simulation.

Return Values

NameTypeDescription
[0]enum ValidCallsResultThe result of the ValidCalls check, in enum ValidCallsResult form.

_getDAppOpHash

function _getDAppOpHash(struct DAppOperation dAppOp) internal pure returns (bytes32 dappOpHash)

Generates the hash of a DAppOperation struct.

Parameters

NameTypeDescription
dAppOpstruct DAppOperationThe DAppOperation struct to hash.

Return Values

NameTypeDescription
dappOpHashbytes32The hash of the DAppOperation struct.

_verifyDAppSignature

function _verifyDAppSignature(struct DAppOperation dAppOp) internal view returns (bool)

Verifies the signature of a DAppOperation struct.

Parameters

NameTypeDescription
dAppOpstruct DAppOperationThe DAppOperation struct to verify.

Return Values

NameTypeDescription
[0]boolA boolean indicating if the signature is valid.

getDAppOperationPayload

function getDAppOperationPayload(struct DAppOperation dAppOp) public view returns (bytes32 payload)

Generates the hash of a DAppOperation struct.

Parameters

NameTypeDescription
dAppOpstruct DAppOperationThe DAppOperation struct to hash.

Return Values

NameTypeDescription
payloadbytes32The hash of the DAppOperation struct.

getDomainSeparator

function getDomainSeparator() external view returns (bytes32 domainSeparator)

Returns the domain separator for the EIP712 signature scheme.

Return Values

NameTypeDescription
domainSeparatorbytes32The domain separator for the EIP712 signature scheme.

_verifyUser

function _verifyUser(struct DAppConfig dConfig, struct UserOperation userOp, bytes32 userOpHash, address msgSender, bool isSimulation) internal returns (enum ValidCallsResult)

Verifies the validity of a UserOperation struct.

Parameters

NameTypeDescription
dConfigstruct DAppConfigConfiguration data for the DApp involved, containing execution parameters and settings.
userOpstruct UserOperationThe UserOperation struct to verify.
userOpHashbytes32
msgSenderaddressThe forwarded msg.sender of the original metacall transaction in the Atlas contract.
isSimulationboolA boolean indicating if the call is a simulation.

Return Values

NameTypeDescription
[0]enum ValidCallsResultThe result of the UserOperation verification, in enum ValidCallsResult form.

getUserOperationPayload

function getUserOperationPayload(struct UserOperation userOp) public view returns (bytes32 payload)

Generates the payload hash of a UserOperation struct used in signatures.

Parameters

NameTypeDescription
userOpstruct UserOperationThe UserOperation struct to generate the payload for.

Return Values

NameTypeDescription
payloadbytes32The hash of the UserOperation struct for use in signatures.

getUserOperationHash

function getUserOperationHash(struct UserOperation userOp) public view returns (bytes32 userOpHash)

Generates the hash of a UserOperation struct used for inter-operation references.

Parameters

NameTypeDescription
userOpstruct UserOperationThe UserOperation struct to generate the hash for.

Return Values

NameTypeDescription
userOpHashbytes32The hash of the UserOperation struct for in inter-operation references.

_getUserOperationHash

function _getUserOperationHash(struct UserOperation userOp, bool trusted) internal view returns (bytes32 userOpHash)

_getAndVerifyGasLimits

function _getAndVerifyGasLimits(struct SolverOperation[] solverOps, struct DAppConfig dConfig, uint256 userOpGas, uint256 metacallGasLeft) internal view returns (enum ValidCallsResult verifyCallsResult, uint256 allSolversGasLimit, uint256 allSolversCalldataGas, uint256 bidFindOverhead)

Calculates 2 gas limits/maxes used in the metacall gas accounting.

Parameters

NameTypeDescription
solverOpsstruct SolverOperation[]The SolverOperations array of the current metacall.
dConfigstruct DAppConfigThe DAppConfig struct of the current metacall.
userOpGasuint256The gas limit of the UserOperation.
metacallGasLeftuint256The gasleft at the start of the metacall.

Return Values

NameTypeDescription
verifyCallsResultenum ValidCallsResultA ValidCallsResult enum which can be {Valid, MetacallGasLimitTooLow, MetacallGasLimitTooHigh}.
allSolversGasLimituint256The sum of all solverOp calldata and execution gas limits.
allSolversCalldataGasuint256The sum of all solverOp calldata gas (excl. non-solver calldata).
bidFindOverheaduint256The gas overhead for bid-finding loop in exPostBids mode.