Bridge to Pod
This guide walks through bridging ERC20 tokens from Ethereum to Pod. For background on how the bridge works, see Native Bridge.
Deposit
Deposit tokens on Ethereum; the full amount is credited to the recipient's balance on Pod.
Steps
Call
deposit(token, amount, podRecipient, callContract, reserveBalance, permit)on the Ethereum bridge contract. SetcallContracttoaddress(0)andreserveBalanceto0— see the note below on why.Once the deposit is finalized on Ethereum, Pod validators automatically credit the balance on Pod. No claim is needed, and you send no transaction on Pod.
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://eth.llamarpc.com");
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);
const BRIDGE = "ETHEREUM_BRIDGE_ADDRESS";
const TOKEN = "TOKEN_ADDRESS"; // use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token
const amount = ethers.parseUnits("100", 6);
const podRecipient = wallet.address;
// Sign an EIP-2612 permit for gasless approval.
// If the token does not support permit, set permit to "0x" and
// send a separate approval transaction:
// const token = new ethers.Contract(TOKEN, ["function approve(address,uint256)"], wallet);
// await (await token.approve(BRIDGE, amount)).wait();
const permit = "0x";
const bridge = new ethers.Contract(
BRIDGE,
["function deposit(address token, uint256 amount, address to, address callContract, uint256 reserveBalance, bytes permit) returns (uint256)"],
wallet
);
const tx = await bridge.deposit(TOKEN, amount, podRecipient, ethers.ZeroAddress, 0, permit);
await tx.wait();
// Credited to podRecipient's balance once the deposit is finalized
// on Ethereum, scaled up to Pod's 18 decimals. Read it back with
// balanceOf(token, account) on the orderbook precompile.callContract and reserveBalance
These two parameters used to split a deposit between a Pod account and a contract on Pod. They no longer route anything on Pod. Every deposit is credited whole to the recipient's balance, because that is now the only balance there is to credit. The values are still carried through to the Pod-side DepositApplied event so the two chains reconcile, but they change nothing about where the funds land.
They are still validated on Ethereum, so a stale non-zero value is a revert rather than a harmless no-op. The Ethereum contract rejects:
a
callContractthe admin has not whitelisted viasetCallContractWhitelist(CallContractNotWhitelisted),a
reserveBalancegreater thanamount(AmountBelowReserve),any non-zero
reserveBalancewhencallContractisaddress(0)(InvalidReserveBalance).
Pass address(0) and 0.
Amounts and decimals
amount is in the Ethereum token's units — 1000000 for 1 USDC, not 1e18. The bridge scales it up to Pod's 18 decimals when it credits the balance, so 1 USDC deposited reads back as 1e18 from balanceOf.
The bridge contract enforces a per-token minimum and a rolling daily cap, and the token must be whitelisted by the bridge admin before it can be deposited at all.
Next steps
Trade the balance — see Place a spot order or Place a perpetual order.
Send some of it to another Pod account with the orderbook precompile's
transfer.Take it off Pod again with Bridge from Pod.
Last updated

