Skip to main content

Deposits

Users can deposit assets into Atlas L2 by interacting with the Atlas Bridge contract on the Ethereum network, and no further action is required from the user. The Bridge currently supports both native ETH and ERC20 tokens, and once deposited these assets remain locked in the contract until a withdrawal is initiated from Atlas.

warning

Do not send assets to the Bridge directly, instead use the provided interface below. Depositing WETH is not supported, users must first unwrap to native ETH.

Contract Interface

/**
* @notice Initiates an ETH deposit to Atlas L2.
* @param l2Pubkey The public key of the recipient on Atlas L2.
*/
function initiateEtherDeposit(bytes32 l2Pubkey) external payable;

/**
* @notice Initiates a token deposit to Atlas L2.
* @param tokenAddress The address of the token to deposit.
* @param tokenAmount The amount of tokens to deposit.
* @param l2Pubkey The public key of the recipient on Atlas L2.
*/
function initiateTokenDeposit(address tokenAddress, uint256 tokenAmount, bytes32 l2Pubkey) external payable;

When initiating a deposit, the user must call one of two functions on the Bridge contract depending on the type of assets they wish to deposit. In either case, a minimum amount of ETH is required to cover rent costs and future transaction fees on Atlas. Both functions require specifying l2Pubkey which is the recipient address on Atlas. These addresses share the same format with Solana and must be specified as a base58-encoded string.

note

Token decimal precision is not the same on Atlas as Ethereum. The maximum decimal amount on Atlas is 9, so all deposit amounts including ETH are scaled down accordingly. Token decimal information is available on the token metadata account.

Deposit Requirements

ETH Deposits

  • Minimum deposit amount: 100,000 gwei
  • Amount must be a multiple of 1 gwei
  • ETH is sent to the payable function initiateEtherDeposit

Token Deposits

  • Token must be first approved to be spent by the Bridge contract
  • Amount must be a multiple of token's minimum decimal unit
  • Token contract and amount is specified in the initiateTokenDeposit function
  • Minimum ETH amount is also required to be sent with the function call

Deposit Flow

Initiation on Ethereum L1

  1. User calls either initiateEtherDeposit or initiateTokenDeposit on the Bridge contract
  2. Bridge contract validates and adjusts deposit parameters, then emits a deposit event
  3. A cross-chain message is sent to Atlas through the Mailbox contract

Finalization on Atlas L2

  1. Atlas monitors for finalized Mailbox events, after 2 epochs pass on Ethereum
  2. When a deposit message is detected, funds are minted and credited to recipient's account
  3. EVM state account is updated to track the state of deposit processing on Atlas
note

When an asset is bridged over to Atlas for the first time, the bridge program automatically generates a token metadata account for the asset. This account is used to store the asset's name, symbol, URI, and associated EVM address. Initially, only the EVM address is set, and the remaining fields can be set afterwards via a separate instruction.

Events

The Bridge emits events for each deposit initiated:

event EtherDepositInitiated(
uint64 indexed depositId,
address indexed depositor,
uint256 amount,
bytes32 l2Pubkey
);

event TokenDepositInitiated(
uint64 indexed depositId,
address indexed depositor,
address indexed tokenAddress,
uint256 ethAmount,
uint256 tokenAmount,
bytes32 l2Pubkey
);

EVM State Account Structure

The Atlas Bridge SPL program maintains a special EVM state account on the Atlas L2 that tracks critical Ethereum state information. This account plays a crucial role in ensuring bridge reliability and state synchronization.

pub struct EvmState {
pub discriminator: u64, // Account type identifier
pub block_number: u64, // Latest processed Ethereum block
pub deposit_count: u64, // Total number of deposits processed
pub withdraw_count: u64 // Total number of withdrawals initiated
}

The EVM state account serves multiple critical functions:

Sequencer Recovery

  • If the Atlas sequencer experiences downtime, the EVM state account maintains the last processed Ethereum block
  • Upon sequencer restart, the bridge can resume processing from the last known state
  • Prevents double-processing of deposits and maintains transaction ordering

Deposit Tracking

  • Sequential deposit IDs ensure no deposits are missed or processed out of order
  • Bridge validates that each subsequent deposit ID matches deposit_count + 1
  • Maintains an accurate count of total deposits processed

Withdrawal Management

  • Tracks total withdrawals initiated from L2
  • Each withdrawal receives a unique sequential ID
  • Enables proper withdrawal verification on L1

Atlas Deposit CLI

The Atlas dev team provides a tool that allows end users to deposit assets into the bridge from the command line.