xhavic.com
GitHub (Coming Soon) Whitepaper
Docs / Bridging

Deposits (L1 → L2)

How to deposit ETH and ERC-20 tokens from Ethereum to Xhavic via the native bridge.

Deposits move assets from Ethereum (L1) to Xhavic (L2) using a lock-and-mint mechanism secured by Ethereum’s consensus.

How Deposits Work

  1. Send assets — Call the bridge contract on Ethereum with ETH or approved ERC-20 tokens
  2. Lock on L1 — The bridge contract locks your assets in escrow
  3. Emit deposit event — An event is emitted on L1 containing deposit details
  4. Relayer detection — The Xhavic relayer detects the deposit event
  5. Mint on L2 — Equivalent tokens are minted on Xhavic and credited to your address

Deposit Parameters

ParameterValue
Minimum depositNo minimum
Confirmation time~5-15 minutes
L1 confirmations required12 blocks (~2.4 minutes)
Supported assetsETH, USDC, USDT, DAI, WBTC (more via governance)

ETH Deposits

When you deposit ETH, it is locked on L1 and you receive WETH (Wrapped ETH) on Xhavic. WETH is an ERC-20 token on L2 for replay protection and consistent gas accounting.

// Deposit ETH via the bridge
bridge.depositETH{ value: 1 ether }(
    200_000,     // L2 gas limit
    bytes("")    // optional data
);

ERC-20 Deposits

For ERC-20 tokens, you must first approve the bridge contract to spend your tokens:

// 1. Approve the bridge
token.approve(bridgeAddress, amount);

// 2. Deposit
bridge.depositERC20(
    l1TokenAddress,
    l2TokenAddress,
    amount,
    200_000,     // L2 gas limit
    bytes("")    // optional data
);

Deposit Status

You can track deposit status using the bridge explorer or by querying the relayer:

StatusMeaning
PendingWaiting for L1 confirmations
RelayedDetected by relayer, minting in progress
CompleteTokens available on Xhavic
FailedDeposit reverted (funds returned to L1)

Programmatic Deposits

For dApps and automated systems, use the XhavicBridge SDK:

import { XhavicBridge } from '@xhavic/sdk';

const bridge = new XhavicBridge({ l1Provider, l2Provider });

// Deposit ETH
const tx = await bridge.depositETH({
  amount: ethers.parseEther("1.0"),
  l2GasLimit: 200_000,
});

// Wait for L2 confirmation
const receipt = await bridge.waitForDeposit(tx.hash);