Skip to main content

Solidity API

Base

ATLAS

address ATLAS

SOURCE

address SOURCE

constructor

constructor(address atlas) public

onlyAtlasEnvironment

modifier onlyAtlasEnvironment()

validSolver

modifier validSolver(struct SolverOperation solverOp)

_onlyAtlasEnvironment

function _onlyAtlasEnvironment() internal view

_forward

function _forward(bytes data) internal pure returns (bytes)

_firstSet

function _firstSet() internal pure returns (bytes data)

_secondSet

function _secondSet() internal pure returns (bytes data)

_config

function _config() internal pure returns (uint32 config)

Extracts and returns the CallConfig of the current DAppControl contract, from calldata.

Return Values

NameTypeDescription
configuint32The CallConfig of the current DAppControl contract, in uint32 form.

_control

function _control() internal pure returns (address control)

Extracts and returns the address of the current DAppControl contract, from calldata.

Return Values

NameTypeDescription
controladdressThe address of the current DAppControl contract.

_user

function _user() internal pure returns (address user)

Extracts and returns the address of the user of the current metacall tx, from calldata.

Return Values

NameTypeDescription
useraddressThe address of the user of the current metacall tx.

_depth

function _depth() internal pure returns (uint8 callDepth)

Extracts and returns the call depth within the current metacall tx, from calldata.

The call depth starts at 1 with the first call of each step in the metacall, from Atlas to the Execution Environment, and is incremented with each call/delegatecall within that step.

Return Values

NameTypeDescription
callDepthuint8The call depth of the current step in the current metacall tx.

_simulation

function _simulation() internal pure returns (bool simulation)

Extracts and returns the boolean indicating whether the current metacall tx is a simulation or not, from calldata.

Return Values

NameTypeDescription
simulationboolThe boolean indicating whether the current metacall tx is a simulation or not.

_bidFind

function _bidFind() internal pure returns (bool bidFind)

Extracts and returns the boolean indicating whether the current metacall tx uses on-chain bid-finding, or not, from calldata.

Return Values

NameTypeDescription
bidFindboolThe boolean indicating whether the current metacall tx uses on-chain bid-finding, or not.

_solverOutcome

function _solverOutcome() internal pure returns (uint24 solverOutcome)

Extracts and returns the solver outcome bitmap in its current status during a metacall tx, from calldata.

Return Values

NameTypeDescription
solverOutcomeuint24The solver outcome bitmap in its current status, in uint24 form.

_phase

function _phase() internal pure returns (uint8 phase)

Extracts and returns the lock state bitmap of the current metacall tx, from calldata.

Return Values

NameTypeDescription
phaseuint8The lock state bitmap of the current metacall tx, in uint8 form.

_solverCount

function _solverCount() internal pure returns (uint8 solverCount)

Extracts and returns the number of solverOps in the current metacall tx, from calldata.

Return Values

NameTypeDescription
solverCountuint8The number of solverOps in the current metacall tx.

_solverIndex

function _solverIndex() internal pure returns (uint8 solverIndex)

Extracts and returns the number of executed solverOps in the current metacall tx, from calldata.

Solver index is incremented as Atlas iterates through the solverOps array during execution.

Return Values

NameTypeDescription
solverIndexuint8The count of executed solverOps in the current metacall tx.

_paymentsSuccessful

function _paymentsSuccessful() internal pure returns (bool paymentsSuccessful)

Extracts and returns the boolean indicating whether the payments were successful after the allocateValue step in the current metacall tx, from calldata.

Return Values

NameTypeDescription
paymentsSuccessfulboolThe boolean indicating whether the payments were successful after the allocateValue step in the current metacall tx.

_solverSuccessful

function _solverSuccessful() internal pure returns (bool solverSuccessful)

Extracts and returns the boolean indicating whether the winning solverOp was executed successfully in the current metacall tx, from calldata.

Return Values

NameTypeDescription
solverSuccessfulboolThe boolean indicating whether the winning solverOp was executed successfully in the current metacall tx.

_bundler

function _bundler() internal pure returns (address bundler)

Extracts and returns the current value of the bundler of the current metacall tx, from calldata.

The bundler is either the address of the current DAppControl contract (in preOps and userOp steps), the current solverOp.solver address (during solverOps steps), or the winning solverOp.from address (during allocateValue step).

Return Values

NameTypeDescription
bundleraddressThe current value of the bundler of the current metacall tx.

_activeEnvironment

function _activeEnvironment() internal view returns (address activeEnvironment)

Returns the address of the currently active Execution Environment, if any.

Return Values

NameTypeDescription
activeEnvironmentaddressThe address of the currently active Execution Environment.

ExecutionBase

constructor

constructor(address atlas) public

_contribute

function _contribute(uint256 amt) internal

Deposits local funds from this Execution Environment, to the transient Atlas balance. These funds go towards the bundler, with any surplus going to the Solver.

Parameters

NameTypeDescription
amtuint256The amount of funds to deposit.

_borrow

function _borrow(uint256 amt) internal

Borrows funds from the transient Atlas balance that will be repaid by the Solver or this Execution Environment via _contribute()

Parameters

NameTypeDescription
amtuint256The amount of funds to borrow.

_transferUserERC20

function _transferUserERC20(address token, address destination, uint256 amount) internal

Transfers ERC20 tokens from the user of the current metacall tx, via Atlas, to a specified destination.

This will only succeed if Atlas is in a phase included in SAFE_USER_TRANSFER. See SafetyBits.sol.

Parameters

NameTypeDescription
tokenaddressThe address of the ERC20 token contract.
destinationaddressThe address to which the tokens will be transferred.
amountuint256The amount of tokens to transfer.

_transferDAppERC20

function _transferDAppERC20(address token, address destination, uint256 amount) internal

Transfers ERC20 tokens from the DApp of the current metacall tx, via Atlas, to a specified destination.

This will only succeed if Atlas is in a phase included in SAFE_DAPP_TRANSFER. See SafetyBits.sol.

Parameters

NameTypeDescription
tokenaddressThe address of the ERC20 token contract.
destinationaddressThe address to which the tokens will be transferred.
amountuint256The amount of tokens to transfer.

_availableFundsERC20

function _availableFundsERC20(address token, address source, uint256 amount, enum ExecutionPhase phase) internal view returns (bool available)

Returns a bool indicating whether a source address has approved the Atlas contract to transfer a certain amount of a certain token, and whether Atlas is in the correct phase to transfer the token. Note: this is just for convenience - transfers via _transferDAppERC20() and _transferUserERC20() will independently ensure all necessary checks are made.

Parameters

NameTypeDescription
tokenaddressThe address of the ERC20 token contract.
sourceaddressThe address of the source of the tokens.
amountuint256The amount of tokens to transfer.
phaseenum ExecutionPhaseThe phase of the current metacall tx.

Return Values

NameTypeDescription
availableboolA bool indicating whether a transfer from the source, via Atlas, of the specified amount of the specified token, will succeed.

_getAndApproveUserERC20

function _getAndApproveUserERC20(address token, uint256 amount, address destination) internal

Transfers ERC20 tokens from the user of the current metacall tx, via Atlas, to the current ExecutionEnvironment, and approves the destination address to spend the tokens from the ExecutionEnvironment.

Parameters

NameTypeDescription
tokenaddressThe address of the ERC20 token contract.
amountuint256The amount of tokens to transfer and approve.
destinationaddressThe address approved to spend the tokens from the ExecutionEnvironment.