Solidity API
AtlETH
Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
constructor
constructor(uint256 escrowDuration, address verification, address simulator, address initialSurchargeRecipient, address l2GasCalculator) internal
balanceOf
function balanceOf(address account) external view returns (uint256)
Returns the unbonded AtlETH balance of the specified account.
Parameters
Name | Type | Description |
---|---|---|
account | address | The address for which to query the unbonded AtlETH balance. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The unbonded AtlETH balance of the specified account. |
balanceOfBonded
function balanceOfBonded(address account) external view returns (uint256)
Returns the bonded AtlETH balance of the specified account.
Parameters
Name | Type | Description |
---|---|---|
account | address | The address for which to query the bonded AtlETH balance. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The bonded AtlETH balance of the specified account. |
balanceOfUnbonding
function balanceOfUnbonding(address account) external view returns (uint256)
Returns the unbonding AtlETH balance of the specified account.
Parameters
Name | Type | Description |
---|---|---|
account | address | The address for which to query the unbonding AtlETH balance. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The unbonding AtlETH balance of the specified account. |
accountLastActiveBlock
function accountLastActiveBlock(address account) external view returns (uint256)
Returns the last active block of the specified account in the escrow contract.
Parameters
Name | Type | Description |
---|---|---|
account | address | The address for which to query the last active block. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The last active block of the specified account in the escrow contract. |
unbondingCompleteBlock
function unbondingCompleteBlock(address account) external view returns (uint256)
Returns the block number at which the unbonding process of the specified account will be completed.
Parameters
Name | Type | Description |
---|---|---|
account | address | The address for which to query the completion block of unbonding. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The block number at which the unbonding process of the specified account will be completed. |
deposit
function deposit() external payable
Deposits ETH to receive atlETH tokens in return.
Mints atlETH tokens to the caller in exchange for the deposited ETH.
withdraw
function withdraw(uint256 amount) external
Redeems atlETH tokens for ETH.
Burns the specified amount of atlETH tokens from the caller's balance and transfers the equivalent amount of ETH to the caller.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of atlETH tokens to redeem for ETH. |
_mint
function _mint(address to, uint256 amount) internal
Mints new atlETH tokens and assigns them to the specified account.
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to which the newly minted atlETH tokens will be assigned. |
amount | uint256 | The amount of atlETH tokens to mint and assign to the specified account. |
_burn
function _burn(address from, uint256 amount) internal
Burns atlETH tokens from the specified account.
Parameters
Name | Type | Description |
---|---|---|
from | address | The address from which the atlETH tokens will be burned. |
amount | uint256 | The amount of atlETH tokens to burn from the specified account. |
_deduct
function _deduct(address account, uint256 amount) internal
Deducts atlETH tokens from the specified account.
This function deducts the specified amount of atlETH tokens from the balance of the specified account. If the deduction results in a negative balance, it handles the shortfall differently depending on whether the account has passed the unbonding lock period. If the account has passed the lock period, the shortfall is considered as unbonding, and the total supply is adjusted accordingly. Otherwise, if the account is still within the lock period, the function reverts due to insufficient balance for deduction.
Parameters
Name | Type | Description |
---|---|---|
account | address | The address from which to deduct atlETH tokens. |
amount | uint256 | The amount of atlETH tokens to deduct from the specified account. |
bond
function bond(uint256 amount) external
Puts a "hold" on a solver's AtlETH, enabling it to be used in Atlas transactions.
This function locks the specified amount of AtlETH tokens for the sender, making them bonded. Bonded AtlETH tokens must first be unbonded before they can be transferred or withdrawn.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of AtlETH tokens to bond. |
depositAndBond
function depositAndBond(uint256 amountToBond) external payable
Deposits the caller's ETH and mints AtlETH, then bonds a specified amount of that AtlETH.
Parameters
Name | Type | Description |
---|---|---|
amountToBond | uint256 | The amount of AtlETH tokens to bond after the deposit. |
unbond
function unbond(uint256 amount) external
Starts the unbonding wait time for the specified amount of AtlETH tokens.
This function initiates the unbonding process for the specified amount of AtlETH tokens held by the sender. Unbonding AtlETH tokens can still be used by solvers while the unbonding process is ongoing, but adjustments may be made at withdrawal to ensure solvency.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of AtlETH tokens to unbond. |
redeem
function redeem(uint256 amount) external
Redeems the specified amount of AtlETH tokens for withdrawal.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of AtlETH tokens to redeem for withdrawal. |
_bond
function _bond(address owner, uint256 amount) internal
Puts a hold on a solver's AtlETH tokens, enabling them to be used in Atlas transactions.
This internal function puts a hold on a solver's AtlETH tokens, enabling them to be used in Atlas transactions. The specified amount of AtlETH tokens is deducted from the owner's balance and added to the bonded balance. The total supply and bonded total supply are updated accordingly.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the account to put a hold on AtlETH tokens for. |
amount | uint256 | The amount of AtlETH tokens to put a hold on. |
_unbond
function _unbond(address owner, uint256 amount) internal
Starts the unbonding wait time for a specified amount of AtlETH tokens.
This internal function starts the unbonding wait time for a specified amount of AtlETH tokens. The specified amount of AtlETH tokens is deducted from the owner's bonded balance and added to the unbonding balance. The last accessed block for the owner is updated to the current block number.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the account to start the unbonding wait time for. |
amount | uint256 | The amount of AtlETH tokens to start the unbonding wait time for. |
_redeem
function _redeem(address owner, uint256 amount) internal
Redeems the specified amount of AtlETH tokens for withdrawal.
This function allows the owner to redeem a specified amount of AtlETH tokens for withdrawal. If the unbonding process is active for the specified account, the function will revert. Otherwise, the specified amount of AtlETH tokens will be added back to the account's balance, and the total supply will be updated accordingly.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the account redeeming AtlETH tokens for withdrawal. |
amount | uint256 | The amount of AtlETH tokens to redeem for withdrawal. |
withdrawSurcharge
function withdrawSurcharge() external
Allows the current surcharge recipient to withdraw the accumulated surcharge. NOTE: If the only ETH in Atlas is the surcharge, be mindful that withdrawing this ETH may limit solvers' liquidity to flashloan ETH from Atlas in their solverOps.
This function can only be called by the current surcharge recipient. It transfers the accumulated surcharge amount to the surcharge recipient's address.
transferSurchargeRecipient
function transferSurchargeRecipient(address newRecipient) external
Starts the transfer of the surcharge recipient designation to a new address.
This function can only be called by the current surcharge recipient.
It sets the pendingSurchargeRecipient
to the specified newRecipient
address,
allowing the new recipient to claim the surcharge recipient designation by calling becomeSurchargeRecipient
.
If the caller is not the current surcharge recipient, it reverts with an InvalidAccess
error.
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | The address of the new surcharge recipient. |
becomeSurchargeRecipient
function becomeSurchargeRecipient() external
Finalizes the transfer of the surcharge recipient designation to a new address.
This function can only be called by the pending surcharge recipient,
and it completes the transfer of the surcharge recipient designation to the address
stored in pendingSurchargeRecipient
.
If the caller is not the pending surcharge recipient, it reverts with an InvalidAccess
error.
onlyWhenUnlocked
modifier onlyWhenUnlocked()
Blocks certain AtlETH functions during a metacall transaction.