← Back to home

aqua-flash-loans

Gas-Optimized Flash Loans on Aqua Protocol. More tokens for lenders. More yeild for LPs!

Problem Statement

While platforms like Aave provide flash loans, their token coverage is inherently limited. This implementation aims to fill a critical market gap:The Problem:Aave and similar platforms only support a limited set of tokenslong-tail tokens typically have high fees on Uniswap V3/V4 in case of doing flash loan thereThe Solution: Aqua Flash Loans enable efficient, low-gas flash loans for tokens not listed on traditional lending platforms. This is particularly valuable for:Tokens with high-fee Uniswap pools where borrowing is expensiveLong-tail assets without Aave listingsMarket-making and arbitrage opportunities in emerging marketsProtocol-specific tokens that need flash loan functionalityCustomizable fee structures - makers choose their own flash loan fee when providing liquidityBy leveraging Aqua's liquidity infrastructure, this implementation makes flash loans accessible for a broader range of tokens at lower gas costs, with flexible fee pricing determined by individual liquidity providers.Result: The project that implements custom fees flash loans using the 1inch Aqua protocol with a direct pull/push mechanism, avoiding the complexity and gas overhead of bytecode construction. The result is simple, auditable implementations that maintain full security guarantees while being significantly more efficient.Key Achievements:FlashLoan: Single-token flash loans in 79,144 gas (53% less gas than Aave V3's 169,084 gas!)DualFlashLoan: Dual-token flash loans in 128,207 gas (19% savings vs sequential)Customizable Fees: Makers set their own flash loan fee when creating strategies - unlike Aave's fixed 0.05%Industry Comparison: Aqua is 2.1x more gas-efficient than Aave V3 for single-token flash loans

Solution

Long story short: I have used the 1inch aqua-app-template in order to speed up the development. As a framework I've used the hardhat v3. I have first researched how does Aqua works, came out with an idea of flash loans, verified their necessity by researching the current state of the market for flash loans (and. uncovering a strong case for a long-tail tokens!). Only then I have sat down and coded the solution.At first I have tried SwapVM. But then I've realized that flash loans is something rather simple and straightforward (and ideally gas-units-cheap). This is how I've pivoted to using the aqua-app-template (instead of swap-vm-template). Then I've implemented the basic flash loan, tested it, deployed to Sepolia.Then the "aha" moment happened - since the Aqua is the swap engine - we can make efficient dual tokens flash loans! which will be gas efficient. Done. Implemented and tested.Then the serious research legacy of mine kicked in and I've decided to run back-to-back tests with Aave V3. And viola - Aqua flash loans are using 2 times less gas units compared to Aave! Indeed gas optimized.Then I've polished it all and shipped 🚀🧉

Hackathon

ETHGlobal Buenos Aires

2025

Prizes

  • 🏆

    Build an Aqua App2nd place

    1inch

Contributors