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
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
Name | Type | Description |
---|
userOp | UserOperation calldata | The operation initiated by the user. |
solverOps | SolverOperation[] calldata | An array of operations proposed by solvers to fulfill the user operation. |
dAppOp | DAppOperation calldata | The operation defined by the DApp's control logic. |
Return Values
Type | Description |
---|
bool | Indicates 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
Name | Type | Description |
---|
user | address | The address of the user for whom the EE is created. |
control | address | The address of the DAppControl contract. |
Return Values
Type | Description |
---|
address | The 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
Name | Type | Description |
---|
user | address | The address of the user. |
control | address | The address of the DAppControl contract. |
Return Values
Name | Type | Description |
---|
executionEnvironment | address | The address of the Execution Environment. |
callConfig | uint32 | Configuration settings for the call. |
exists | bool | Indicates 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
Name | Type | Description |
---|
account | address | The address of the account. |
Return Values
Type | Description |
---|
uint256 | The total balance of the account. |
balanceOfBonded
function balanceOfBonded(address account) external view returns (uint256);
Returns the bonded balance of a specified account.
Parameters
Name | Type | Description |
---|
account | address | The address of the account. |
Return Values
Type | Description |
---|
uint256 | The bonded balance of the account. |
balanceOfUnbonding
function balanceOfUnbonding(address account) external view returns (uint256);
Returns the unbonding balance of a specified account.
Parameters
Name | Type | Description |
---|
account | address | The address of the account. |
Return Values
Type | Description |
---|
uint256 | The 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
Name | Type | Description |
---|
account | address | The address of the account. |
Return Values
Type | Description |
---|
uint256 | The 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
Name | Type | Description |
---|
account | address | The address of the account. |
Return Values
Type | Description |
---|
uint256 | The block number when unbonding completes. |
deposit
function deposit() external payable;
Allows a user to deposit Ether into their account.
Parameters
Name | Type | Description |
---|
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
Name | Type | Description |
---|
amount | uint256 | The 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
Name | Type | Description |
---|
amountToBond | uint256 | The 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
Name | Type | Description |
---|
amount | uint256 | The amount of tokens to unbond. |
redeem
function redeem(uint256 amount) external;
Allows a user to redeem a specified amount of bonded tokens.
Parameters
Name | Type | Description |
---|
amount | uint256 | The 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
Name | Type | Description |
---|
newRecipient | address | The 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
Name | Type | Description |
---|
token | address | The ERC20 token contract address. |
destination | address | The address to transfer tokens to. |
amount | uint256 | The amount of tokens to transfer. |
user | address | The address of the user initiating the transfer. |
control | address | The 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
Name | Type | Description |
---|
token | address | The ERC20 token contract address. |
destination | address | The address to transfer tokens to. |
amount | uint256 | The amount of tokens to transfer. |
user | address | The address of the user associated with the transfer. |
control | address | The 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
Name | Type | Description |
---|
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
Name | Type | Description |
---|
amount | uint256 | The 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
Type | Description |
---|
uint256 | The 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
Name | Type | Description |
---|
maxApprovedGasSpend | uint256 | The maximum approved gas spend for reconciliation. |
Return Values
Name | Type | Description |
---|
owed | uint256 | The amount owed after reconciliation. |
isUnlocked
function isUnlocked() external view returns (bool);
Checks if the protocol is currently unlocked.
Return Values
Type | Description |
---|
bool | true if unlocked, false otherwise. |
VERIFICATION
function VERIFICATION() external view returns (address);
Returns the address of the verification contract.
Return Values
Type | Description |
---|
address | The address of the verification contract. |
SIMULATOR
function SIMULATOR() external view returns (address);
Returns the address of the simulator contract.
Return Values
Type | Description |
---|
address | The 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
Type | Description |
---|
address | The 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
Type | Description |
---|
uint256 | The 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
Name | Type | Description |
---|
currentSolver | address | The address of the current solver. |
calledBack | bool | Indicates if a callback was invoked. |
fulfilled | bool | Indicates 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
Type | Description |
---|
uint256 | The total bonded token supply. |
bondedTotalSupply
function bondedTotalSupply() external view returns (uint256);
Returns the total supply of bonded tokens.
Return Values
Type | Description |
---|
uint256 | The 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
Name | Type | Description |
---|
account | address | The address of the account. |
Return Values
Name | Type | Description |
---|
bonded | uint112 | The amount of tokens bonded by the account. |
lastAccessedBlock | uint32 | The last block number when the account was accessed. |
auctionWins | uint24 | The number of auctions won by the account. |
auctionFails | uint24 | The number of auctions failed by the account. |
totalGasValueUsed | uint64 | The 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
Name | Type | Description |
---|
opHash | bytes32 | The hash of the solver operation. |
Return Values
Type | Description |
---|
bool | true 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
Name | Type | Description |
---|
activeEnvironment | address | The address of the active Execution Environment. |
callConfig | uint32 | Configuration settings for the current call. |
phase | uint8 | The current phase of the protocol. |
solverLock
function solverLock() external view returns (uint256);
Returns the current solver lock value.
Return Values
Type | Description |
---|
uint256 | The current solver lock value. |
cumulativeSurcharge
function cumulativeSurcharge() external view returns (uint256);
Returns the total accumulated surcharge.
Return Values
Type | Description |
---|
uint256 | The cumulative surcharge amount. |
surchargeRecipient
function surchargeRecipient() external view returns (address);
Returns the current surcharge recipient's address.
Return Values
Type | Description |
---|
address | The address of the surcharge recipient. |
pendingSurchargeRecipient
function pendingSurchargeRecipient() external view returns (address);
Returns the pending surcharge recipient's address awaiting confirmation.
Return Values
Type | Description |
---|
address | The address of the pending surcharge recipient. |