One Click Leverage: How Contango Brought Looping to the Masses

Contango delivered a single-transaction looping mechanism across 300+ trading pairs, including complex yield-bearing assets and LSTs using Enso’s token routing optimization.

One Click Leverage: How Contango Brought Looping to the Masses

Imagine your users spending 30 minutes and paying dozens of gas fees just to execute a basic 5x leverage trade, only to watch the strategy fail mid-process due to price movements. This was DeFi reality until Contango found a way to compress 30+ transactions into one. 

The Contango x Enso collaboration at a glance

Contango tackled manual looping issues with Enso, making it faster, easier, and less demanding. Along the way, this introduced improvements across the board from fewer transactions and shorter execution times to more trading pairs and higher maximum leverage.

The Manual Looping Problem

Contango's team zeroed-in on the core problem: the manual process was overly complex even for seasoned DeFi users. Each loop required 4 steps, consuming a lot of personal time, incurring high gas fees, and demanding perfect execution timing across multiple transactions. Here’s an example of how a user can build a ETH/USDC long position manually:

  1. Deposit ETH on a lending market
  2. Borrow USDC against it
  3. Swap USDC for ETH on a spot market
  4. Deposit that ETH again on the lending market

Additionally, the “transaction-per-loop” approach would expose users to price movements and transaction failures.

This unreliable, time-sensitive process would make the whole looping strategy a frustrating experience. Luckily, the team found a way around this multi-layered issue.

The Solution: Flash Loan with Routing Optimization

Contango's approach leveraged flash loans to eliminate the incremental building constraint entirely and combined it with optimal swap routing.

The Core Constraint: Borrowing Limits 

Lending protocols enforce loan-to-value ratios to maintain protocol safety, forcing incremental leverage building through multiple independent transactions. Users are forced to manually loop this sequence of actions: deposit → borrow → swap → deposit → repeat.

After initial deposit, manual looping requires 3 operations per loop: borrow, swap, deposit. Not only it demands lots of time, but also carries the risk of mid-process price movement impact.
Manual looping: a time consuming and price-impact sensitive process.

The Unlock: Flash Loans 

Flash loans eliminate this constraint by providing uncollateralized capital within a single atomic transaction. Instead of building leverage incrementally over several separate loops, users can establish the complete leveraged position immediately using temporary capital that gets repaid within the same transaction.

Routing Optimization is Critical

However, basic asset swapping falls short when execution quality determines profitability. The challenge lies in choosing the optimal route for each asset to get the best prices with minimal market impact. For example, with assets like wstETH, direct staking through Lido provides superior execution compared to DEX routes as there is no market impact. But determining the optimal path requires sophisticated routing logic.

The Optimal Path: Enso's Routing

Enso's Bundle API with `route` action determines the optimal execution path for each step in real time: either DEX swapping or direct staking. This enables Contango to guarantee best execution across all supported assets while maintaining the atomic transaction structure.

Here's an example of a multi-step swap a user would need to do, either within the manual looping process, or before the initial loop deposit.

3 transactions users don't need to do manually when executing a strategy such as looping

The following sample demonstrates usage of the Enso SDK that achieves this routing.

const route = await ensoClient.getRouteData({
  chainId: ARBITRUM,
  fromAddress: userAddress,
  receiver: userAddress,
  amountIn: ["10000000000000000000"],
  tokenIn: [PT_weETH_26DEC2024],
  tokenOut: [WETH],
  // sign with smart wallet & avoid approvals
  routingStrategy: "delegate", 
  // 0.5% slippage
  slippage: "50", 
  referralCode: "contango-ui",
});

await smartWalletSend(route.tx, route.gas);

The combination transforms leverage from a complex, expensive, and error-prone process into instant, optimally-executed atomic transaction, enabling significant improvements in both user experience and platform scalability.

UX Convenience and Easy Scaling

The atomic flash loan approach with optimal routing delivered immediate benefits across user experience and platform growth.

Improved User Experience and Reliability

For users, the transformation was dramatic: faster execution, lower gas fees, and elimination of mid-process price exposure risk. Beyond convenience, Contango made the best prices that were used for every step of the process. The atomic approach guarantees reliability: either complete success or complete revert, but no failed halfway states.

Effortless Scaling Without New Workstreams

Additionally, by relying on Enso as a standard solution, any new token would become automatically available within the platform. Contango expanded to 300+ trading pairs without proportional development overhead, with stRUSD/RUSD becoming their third most traded instrument. 

As Kamel, Contango’s cofounder notes:

Contango's Co-Founder Highlights Enso Routing

Key Takeaways

  • Flash Loans + Optimized Routing = Simplified UX. Complex multi-step processes can be compressed into single transactions when flash loan architecture combines with intelligent routing. 
  • Standard Solutions Enable Rapid Integration. Having one solution for multiple protocols allows teams to launch new trading pairs quickly without custom development.
  • Focus on Core Competency. Outsourcing routing complexity allows teams to concentrate on their primary product differentiation.

Conclusion

Contango's approach transformed DeFi leverage from an exclusive tool for sophisticated users into wider accessibility. By reducing execution time by 95%, they enabled leverage trading for positions previously considered uneconomical. The result: 300+ trading pairs with up to 50x leverage capabilities, including stRUSD/RUSD becoming their third most traded instrument. 

This proves that the right infrastructure choices don't just optimize existing processes, they unlock entirely new markets and redefine what's possible for end users.