What is Atomic Routing?
Atomic Routing enables complex multi-step DeFi operations (swap → deposit) to execute in a single transaction with all-or-nothing guarantees. Think of it as Amazon’s 1-Click Checkout for DeFi: What used to require multiple transactions, approvals, and manual coordination now happens automatically in one click.The Problem
Traditional DeFi workflows are complex and error-prone: Traditional Approach (5+ transactions):- Approve USDC to DEX
- Swap USDC → EURC on DEX
- Wait for swap confirmation
- Approve EURC to Aave
- Deposit EURC to Aave
- Transaction failures at any step
- Price changes between steps
- High gas costs (5 separate transactions)
- Poor user experience
- Funds stuck if interrupted
The Solution
1tx enables single-transaction deposits: 1tx Approach (1 transaction):- User sends USDC with instrument ID
- 1tx automatically swaps USDC → EURC
- 1tx automatically deposits to Aave
- User receives aEURC tokens
- ✅ All steps succeed or fail together (atomic)
- ✅ No price slippage between steps
- ✅ 40% lower gas costs
- ✅ One-click user experience
- ✅ No partial state or stuck funds
Atomicity Guarantees
1tx ensures all-or-nothing execution:Success Case
All steps complete successfully:
- User sends USDC ✅
- Router swaps to EURC ✅
- Router deposits to Aave ✅
- User receives aEURC ✅
Failure Case
If ANY step fails, entire transaction reverts:
- Insufficient liquidity ❌
- Slippage exceeded ❌
- Adapter error ❌
- No partial state changes
What Atomicity Means
No Partial State
No Partial State
Either everything happens or nothing happens. You’ll never be stuck with:
- EURC when you wanted aEURC
- Lost tokens in transit
- Incomplete swaps
- Failed deposits with successful swaps
Price Certainty
Price Certainty
No price changes between swap and deposit steps. The rate you see is the rate you get for the entire operation.
Automatic Rollback
Automatic Rollback
If any step fails, the entire transaction reverts automatically. Your original tokens are returned safely to your wallet.
Gas Efficiency
Gas Efficiency
Pay gas only once for the entire operation instead of 5 separate transactions. Average savings: 40%
Transaction Flow Example
Let’s walk through a deposit from USDC to Aave EURC vault: At the contract level, the router path is:referralFeeBps / referralWallet are optional — set referralFeeBps = 0 and referralWallet = address(0) to skip the referral fee (fee is capped at 500 bps / 5%).
1
User Initiates
User wants to deposit 1000 USDC into Aave EURC vault (which requires EURC, not USDC)
2
1tx Detects Need
The router resolves the instrument and detects that USDC != EURC, so a swap is needed
3
Atomic Execution
In a single transaction:
- Swap USDC → EURC internally
- Deposit EURC to Aave
- Mint aEURC to user
4
User Receives
User receives aEURC tokens and starts earning yield immediately
Benefits
Atomicity
All steps succeed or fail together - no partial state
Gas Efficiency
40% gas savings vs manual multi-step approach
User Experience
One-click deposits - no manual coordination
Price Certainty
No price changes between swap and deposit steps
Security
Reentrancy protected, slippage controlled
Composability
Works with any ERC20 token and lending protocol
Comparison with Alternatives
Withdrawal Flow
Withdrawals work in reverse with the same atomic guarantees:1
User Initiates Withdrawal
User wants to withdraw from Aave EURC, receive USDC
2
1tx Withdraws
1tx withdraws EURC from Aave using your aEURC tokens
3
1tx Swaps
1tx automatically swaps EURC back to USDC
4
User Receives
User receives original token (USDC) - all in one transaction
Withdrawals have the same atomicity guarantees - if any step fails, the entire transaction reverts and your aEURC tokens remain safe.
The current router implementation supports cross-chain
buy() flows through CCTP, but sell() is local-chain only.Next Steps
Instrument Registry
Learn about universal instrument IDs
How It Works
See the complete transaction flow
Integration Guide
Start integrating atomic routing
API Reference
Query instruments via API