Skip to main content

IAtlas

The IAtlas interface defines the primary functions of the Atlas Protocol, enabling the execution of user operations, managing execution environments, handling token balances, permit transfers, gas accounting, and maintaining protocol state.

Functions

metacall

function metacall(
UserOperation calldata userOp,
SolverOperation[] calldata solverOps,
DAppOperation calldata dAppOp
) external payable returns (bool auctionWon);

Executes an aggregated transaction by combining User Operations and Solver Operations. Determines whether the auction was won based on the execution outcome.

Parameters

NameTypeDescription
userOpUserOperation calldataThe operation initiated by the user.
solverOpsSolverOperation[] calldataAn array of operations proposed by solvers to fulfill the user operation.
dAppOpDAppOperation calldataThe operation defined by the DApp's control logic.

Return Values

TypeDescription
boolIndicates if the auction was won (true) or not (false).

createExecutionEnvironment

function createExecutionEnvironment(
address user,
address control
) external returns (address executionEnvironment);

Creates a new Execution Environment (EE) for a user and a specific DApp control contract.

Parameters

NameTypeDescription
useraddressThe address of the user for whom the EE is created.
controladdressThe address of the DAppControl contract.

Return Values

TypeDescription
addressThe address of the newly created Execution Environment.

getExecutionEnvironment

function getExecutionEnvironment(
address user,
address control
) external view returns (address executionEnvironment, uint32 callConfig, bool exists);

Retrieves the Execution Environment associated with a user and a specific DApp control contract.

Parameters

NameTypeDescription
useraddressThe address of the user.
controladdressThe address of the DAppControl contract.

Return Values

NameTypeDescription
executionEnvironmentaddressThe address of the Execution Environment.
callConfiguint32Configuration settings for the call.
existsboolIndicates whether the Execution Environment exists (true) or not (false).

balanceOf

function balanceOf(address account) external view returns (uint256);

Returns the total balance of a specified account.

Parameters

NameTypeDescription
accountaddressThe address of the account.

Return Values

TypeDescription
uint256The total balance of the account.

balanceOfBonded

function balanceOfBonded(address account) external view returns (uint256);

Returns the bonded balance of a specified account.

Parameters

NameTypeDescription
accountaddressThe address of the account.

Return Values

TypeDescription
uint256The bonded balance of the account.

balanceOfUnbonding

function balanceOfUnbonding(address account) external view returns (uint256);

Returns the unbonding balance of a specified account.

Parameters

NameTypeDescription
accountaddressThe address of the account.

Return Values

TypeDescription
uint256The unbonding balance of the account.

accountLastActiveBlock

function accountLastActiveBlock(address account) external view returns (uint256);

Returns the last active block number of a specified account.

Parameters

NameTypeDescription
accountaddressThe address of the account.

Return Values

TypeDescription
uint256The last active block number of the account.

unbondingCompleteBlock

function unbondingCompleteBlock(address account) external view returns (uint256);

Returns the block number when unbonding completes for a specified account.

Parameters

NameTypeDescription
accountaddressThe address of the account.

Return Values

TypeDescription
uint256The block number when unbonding completes.

deposit

function deposit() external payable;

Allows a user to deposit Ether into their account.

Parameters

NameTypeDescription
payable-The amount of Ether to deposit (sent as msg.value).

withdraw

function withdraw(uint256 amount) external;

Allows a user to withdraw a specified amount of Ether from their account.

Parameters

NameTypeDescription
amountuint256The amount of Ether to withdraw.

bond

function bond(uint256 amount) external;

Allows a user to bond a specified amount of tokens.

Parameters

| Name | Type | Description | |--------|--

-------|---------------------------------| | amount | uint256 | The amount of tokens to bond. |

depositAndBond

function depositAndBond(uint256 amountToBond) external payable;

Allows a user to deposit Ether and bond a specified amount of tokens in a single transaction.

Parameters

NameTypeDescription
amountToBonduint256The amount of tokens to bond after depositing Ether.
payable-The amount of Ether to deposit (sent as msg.value).

unbond

function unbond(uint256 amount) external;

Allows a user to unbond a specified amount of tokens.

Parameters

NameTypeDescription
amountuint256The amount of tokens to unbond.

redeem

function redeem(uint256 amount) external;

Allows a user to redeem a specified amount of bonded tokens.

Parameters

NameTypeDescription
amountuint256The amount of bonded tokens to redeem.

withdrawSurcharge

function withdrawSurcharge() external;

Allows the surcharge recipient to withdraw accumulated surcharges.

transferSurchargeRecipient

function transferSurchargeRecipient(address newRecipient) external;

Transfers the surcharge recipient role to a new address.

Parameters

NameTypeDescription
newRecipientaddressThe address to transfer the surcharge recipient role to.

becomeSurchargeRecipient

function becomeSurchargeRecipient() external;

Allows a user to become the surcharge recipient.

transferUserERC20

function transferUserERC20(
address token,
address destination,
uint256 amount,
address user,
address control
) external;

Transfers ERC20 tokens from a user's account to a destination address using Permit69.

Parameters

NameTypeDescription
tokenaddressThe ERC20 token contract address.
destinationaddressThe address to transfer tokens to.
amountuint256The amount of tokens to transfer.
useraddressThe address of the user initiating the transfer.
controladdressThe address of the DAppControl contract.

transferDAppERC20

function transferDAppERC20(
address token,
address destination,
uint256 amount,
address user,
address control
) external;

Transfers ERC20 tokens from a DApp's account to a destination address using Permit69.

Parameters

NameTypeDescription
tokenaddressThe ERC20 token contract address.
destinationaddressThe address to transfer tokens to.
amountuint256The amount of tokens to transfer.
useraddressThe address of the user associated with the transfer.
controladdressThe address of the DAppControl contract.

contribute

function contribute() external payable;

Allows actors to sponsor gas costs by donating Ether to the Atlas Escrow balance.

Parameters

NameTypeDescription
payable-The amount of Ether to contribute (sent as msg.value).

borrow

function borrow(uint256 amount) external payable;

Enables flash loans from the Atlas Escrow balance, which must be repaid within the same transaction.

Parameters

NameTypeDescription
amountuint256The amount of Ether to borrow.
payable-Additional Ether sent with the transaction (if any).

shortfall

function shortfall() external view returns (uint256);

Returns the current shortfall in the Atlas Escrow balance.

Return Values

TypeDescription
uint256The amount of Ether shortfall.

reconcile

function reconcile(uint256 maxApprovedGasSpend) external payable returns (uint256 owed);

Reconciles gas spending with a maximum approved gas spend, returning any owed amount.

Parameters

NameTypeDescription
maxApprovedGasSpenduint256The maximum approved gas spend for reconciliation.

Return Values

NameTypeDescription
oweduint256The amount owed after reconciliation.

isUnlocked

function isUnlocked() external view returns (bool);

Checks if the protocol is currently unlocked.

Return Values

TypeDescription
booltrue if unlocked, false otherwise.

VERIFICATION

function VERIFICATION() external view returns (address);

Returns the address of the verification contract.

Return Values

TypeDescription
addressThe address of the verification contract.

SIMULATOR

function SIMULATOR() external view returns (address);

Returns the address of the simulator contract.

Return Values

TypeDescription
addressThe address of the simulator contract.

L2_GAS_CALCULATOR

function L2_GAS_CALCULATOR() external view returns (address);

Returns the address of the Layer 2 gas calculator contract.

Return Values

TypeDescription
addressThe address of the Layer 2 gas calculator contract.

ESCROW_DURATION

function ESCROW_DURATION() external view returns (uint256);

Returns the duration of the escrow period.

Return Values

TypeDescription
uint256The escrow duration in blocks.

solverLockData

function solverLockData() external view returns (address currentSolver, bool calledBack, bool fulfilled);

Returns data related to the current solver lock.

Return Values

NameTypeDescription
currentSolveraddressThe address of the current solver.
calledBackboolIndicates if a callback was invoked.
fulfilledboolIndicates if the solver operation was fulfilled.

totalSupply

function totalSupply() external view returns (uint256);

Returns the total supply of bonded tokens in the protocol.

Return Values

TypeDescription
uint256The total bonded token supply.

bondedTotalSupply

function bondedTotalSupply() external view returns (uint256);

Returns the total supply of bonded tokens.

Return Values

TypeDescription
uint256The total bonded token supply.

accessData

function accessData(address account)
external
view
returns (
uint112 bonded,
uint32 lastAccessedBlock,
uint24 auctionWins,
uint24 auctionFails,
uint64 totalGasValueUsed
);

Retrieves access-related data for a specified account.

Parameters

NameTypeDescription
accountaddressThe address of the account.

Return Values

NameTypeDescription
bondeduint112The amount of tokens bonded by the account.
lastAccessedBlockuint32The last block number when the account was accessed.
auctionWinsuint24The number of auctions won by the account.
auctionFailsuint24The number of auctions failed by the account.
totalGasValueUseduint64The total gas value used by the account.

solverOpHashes

function solverOpHashes(bytes32 opHash) external view returns (bool);

Checks if a solver operation hash has been processed.

Parameters

NameTypeDescription
opHashbytes32The hash of the solver operation.

Return Values

TypeDescription
booltrue if the solver operation has been processed, otherwise false.

lock

function lock() external view returns (address activeEnvironment, uint32 callConfig, uint8 phase);

Retrieves the current lock state of the protocol.

Return Values

NameTypeDescription
activeEnvironmentaddressThe address of the active Execution Environment.
callConfiguint32Configuration settings for the current call.
phaseuint8The current phase of the protocol.

solverLock

function solverLock() external view returns (uint256);

Returns the current solver lock value.

Return Values

TypeDescription
uint256The current solver lock value.

cumulativeSurcharge

function cumulativeSurcharge() external view returns (uint256);

Returns the total accumulated surcharge.

Return Values

TypeDescription
uint256The cumulative surcharge amount.

surchargeRecipient

function surchargeRecipient() external view returns (address);

Returns the current surcharge recipient's address.

Return Values

TypeDescription
addressThe address of the surcharge recipient.

pendingSurchargeRecipient

function pendingSurchargeRecipient() external view returns (address);

Returns the pending surcharge recipient's address awaiting confirmation.

Return Values

TypeDescription
addressThe address of the pending surcharge recipient.