Skip to main content

Cross-Chain USDC Supply to AAVE with Gasless Fusion Orchestration

This guide demonstrates how to use LiFi 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 LiFi Protocol
  • Automated AAVE supply on the destination chain
  • Gasless execution through Fusion Orchestration
  • Single signature UX for the entire flow
  • Optimized routing with FASTEST or CHEAPEST options

Architecture

Key Components

  1. LiFi Protocol: Smart routing aggregator for cross-chain swaps and bridges
  2. Biconomy MEE: Orchestrates the entire transaction flow
  3. Fusion Mode: Enables gasless execution with external wallets
  4. Companion Account: Temporary smart account for orchestration

Flow Diagram

Implementation Guide

1. Setup and Dependencies

First, create the LiFi Quote Service file. Copy and paste this entire code block into a new file called lifi-quote-service.ts:
Now, import the dependencies in your main file:

2. Configure Token and Protocol Addresses

3. Initialize MEE Client and Orchestrator

4. Get LiFi Bridge Quote

Make sure you’ve created the lifi-quote-service.ts file from Step 1 before proceeding!
LiFi provides smart routing across multiple bridges and DEXs:

5. Build Orchestration Instructions

Step 1: Define Trigger

The trigger initiates the orchestration by pulling tokens from the EOA:

Step 2: Approve LiFi

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

LiFi Smart Routing

LiFi aggregates multiple bridges and DEXs to find the best route:
  • FASTEST: Optimizes for speed
  • CHEAPEST: Optimizes for lowest cost
  • Multi-hop: Can route through multiple chains if needed

Runtime Balance Constraints

The runtimeERC20BalanceOf function ensures instructions use the exact amount that arrives:
  • Handles bridge slippage automatically
  • Ensures proper sequencing
  • Avoids failed transactions

Constraints and Execution Order

Instructions execute only when their constraints are met:
  1. AAVE approval waits for bridged funds
  2. AAVE supply waits for approval
  3. 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

LiFi Quote Service

Quote Parameters

Response Structure

Best Practices

  1. Always use runtime balances for cross-chain operations
  2. Include cleanup instructions for failure scenarios
  3. Set reasonable time bounds (60 seconds recommended)
  4. Test on testnets first before mainnet deployment
  5. Monitor transactions using MEE Scan
  6. Choose appropriate routing:
    • Use FASTEST for time-sensitive operations
    • Use CHEAPEST for cost optimization
  7. Secure your API keys in environment variables

Error Handling

Advanced Features

Custom Slippage

Revenue Sharing

Earn fees by setting integrator params:

Multi-Chain Cleanups

Supported Chains & Bridges

LiFi aggregates 30+ bridges across 20+ chains including:
  • Bridges: Stargate, Across, Hop, Connext, etc.
  • DEXs: Uniswap, SushiSwap, Curve, etc.
  • Chains: Ethereum, Arbitrum, Optimism, Base, Polygon, etc.

Monitoring & Analytics

Track your orchestrations:

Optional: Using LiFi API Key

If you have high volume or need priority access, you can get a LiFi API key:
  1. Visit LiFi Developer Portal
  2. Sign up and get your API key
  3. Update the lifi-quote-service.ts file:
  1. Set your environment variable:

Conclusion

This integration combines LiFi’s powerful routing engine with Biconomy MEE’s orchestration capabilities to deliver:
  • Access to the best cross-chain routes
  • Completely gasless experience
  • Single signature for complex flows
  • Built-in failure protection
The result is a seamless DeFi experience that abstracts away all the complexity of cross-chain operations.