Cross-Chain USDC Supply to AAVE with Gasless Fusion Orchestration
This guide demonstrates how to use Relay Protocol together with Biconomy’s Modular Execution Environment (MEE) to perform a cross-chain supply of USDC into AAVE, completely gasless using Fusion Orchestration.Overview
The integration enables:- Cross-chain bridging from Optimism to Base using Relay Protocol
- Automated AAVE supply on the destination chain
- Gasless execution through Fusion Orchestration
- Single signature UX for the entire flow
- Fast and reliable bridging with Relay’s optimized routes
Architecture
Key Components
- Relay Protocol: Fast cross-chain bridging with intent-based architecture
- Biconomy MEE: Orchestrates the entire transaction flow
- Fusion Mode: Enables gasless execution with external wallets
- Companion Account: Temporary smart account for orchestration
Flow Diagram
Implementation Guide
1. Setup and Dependencies
First, create the Relay Service file. Copy and paste this entire code block into a new file calledrelay-service.ts
:
2. Configure Token and Protocol Addresses
3. Initialize MEE Client and Orchestrator
4. Get Relay Bridge Quote
Make sure you’ve created the
relay-service.ts
file from Step 1 before proceeding!5. Build Orchestration Instructions
Step 1: Define Trigger
The trigger initiates the orchestration by pulling tokens from the EOA:Step 2: Approve Relay Protocol
Step 3: Execute Bridge Transaction
Step 4: Approve AAVE (with runtime balance)
Using runtime balance ensures we approve exactly what arrived:Step 5: Supply to AAVE
Step 6: Withdraw aUSDC to EOA
6. Execute Fusion Orchestration
Key Concepts
Relay Intent-Based Architecture
Relay uses an intent-based system that:- Fast execution: Intents are fulfilled by relayers instantly
- Competitive pricing: Relayers compete to fill your intent
- Guaranteed delivery: Funds are secured until successful completion
Runtime Balance Constraints
TheruntimeERC20BalanceOf
function ensures instructions use the exact amount that arrives:
- Handles any bridge fees automatically
- Ensures proper sequencing
- Avoids failed transactions
Constraints and Execution Order
Instructions execute only when their constraints are met:- AAVE approval waits for bridged funds
- AAVE supply waits for approval
- Withdrawal waits for aUSDC
Cleanup Mechanism
If any step fails, cleanup instructions ensure funds are returned:Gas Payment
The orchestration is gasless because:- Gas paid using bridged USDC
- MEE handles gas abstraction
- Users only sign once
Relay Quote Service
Quote Parameters
Response Structure
Best Practices
- Always use runtime balances for cross-chain operations
- Include cleanup instructions for failure scenarios
- Set reasonable time bounds (60 seconds recommended)
- Test on testnets first before mainnet deployment
- Monitor transactions using MEE Scan
- Consider slippage tolerance for volatile assets
- Secure your API keys in environment variables
Error Handling
Advanced Features
Revenue Sharing
Earn fees by setting referrer address:Exact Output Bridging
Bridge to receive exact amount on destination:Multi-Chain Cleanups
Gas Optimization Options
Monitoring & Analytics
Track your orchestrations:Supported Chains & Features
Relay supports fast bridging across major chains:- Chains: Ethereum, Arbitrum, Optimism, Base, Polygon, etc.
- Features: Intent-based filling, MEV protection, guaranteed delivery
- Speed: Usually completes in under 60 seconds
Conclusion
This integration combines Relay’s fast intent-based bridging with Biconomy MEE’s orchestration capabilities to deliver:- Lightning-fast cross-chain transfers
- Completely gasless experience
- Single signature for complex flows
- Built-in failure protection