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
Name | Type | Description |
---|---|---|
config | uint32 | The 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
Name | Type | Description |
---|---|---|
control | address | The 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
Name | Type | Description |
---|---|---|
user | address | The 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
Name | Type | Description |
---|---|---|
callDepth | uint8 | The 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
Name | Type | Description |
---|---|---|
simulation | bool | The 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
Name | Type | Description |
---|---|---|
bidFind | bool | The 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
Name | Type | Description |
---|---|---|
solverOutcome | uint24 | The 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
Name | Type | Description |
---|---|---|
phase | uint8 | The 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
Name | Type | Description |
---|---|---|
solverCount | uint8 | The 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
Name | Type | Description |
---|---|---|
solverIndex | uint8 | The count of executed solverOps 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
Name | Type | Description |
---|---|---|
solverSuccessful | bool | The 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
Name | Type | Description |
---|---|---|
bundler | address | The 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
Name | Type | Description |
---|---|---|
activeEnvironment | address | The address of the currently active Execution Environment. |
ExecutionBase
constructor
constructor(address atlas) public
_contributeToAtlas
function _contributeToAtlas(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
Name | Type | Description |
---|---|---|
amt | uint256 | The amount of funds to deposit. |
_borrowFromAtlas
function _borrowFromAtlas(uint256 amt) internal
Borrows funds from the transient Atlas balance that will be repaid by the Solver or this Execution
Environment via _contributeToAtlas()
Parameters
Name | Type | Description |
---|---|---|
amt | uint256 | The 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
Name | Type | Description |
---|---|---|
token | address | The address of the ERC20 token contract. |
destination | address | The address to which the tokens will be transferred. |
amount | uint256 | The 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
Name | Type | Description |
---|---|---|
token | address | The address of the ERC20 token contract. |
destination | address | The address to which the tokens will be transferred. |
amount | uint256 | The 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
Name | Type | Description |
---|---|---|
token | address | The address of the ERC20 token contract. |
source | address | The address of the source of the tokens. |
amount | uint256 | The amount of tokens to transfer. |
phase | enum ExecutionPhase | The phase of the current metacall tx. |
Return Values
Name | Type | Description |
---|---|---|
available | bool | A 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
Name | Type | Description |
---|---|---|
token | address | The address of the ERC20 token contract. |
amount | uint256 | The amount of tokens to transfer and approve. |
destination | address | The address approved to spend the tokens from the ExecutionEnvironment. |