Search projects, hackathons, sponsors and tech

    ← All projects

    Aquastack

    One balance, two yields: Aave lending + 1inch Aqua liquidity, with automated depeg exit

    Demo

    About

    In normal DeFi, a dollar can only do one job at a time: it's either lent out on a money market like Aave, or it's paired into a liquidity pool on a DEX. You have to choose, and whichever you don't choose sits there earning nothing. AquaStack removes that choice by making a single stablecoin deposit do both jobs simultaneously, without ever splitting or moving the underlying funds. The mechanism relies on a property of 1inch Aqua, a shared-liquidity layer where a liquidity provider registers a "virtual balance" with the protocol instead of transferring tokens into a pool. Aqua only ever touches the real tokens at the exact instant a swap settles, pulling from the maker's wallet and pushing the counter-asset back. Because the tokens sit in the wallet the entire time rather than being locked in a pool contract, they are free to simultaneously be something else: a rebasing Aave v3 aToken, quietly accruing lending interest every block. Nothing is double-spent, since Aqua can never pull more than the registered virtual balance allows. The full flow: you deposit two stablecoins (USDC and USDT on our Base Sepolia deployment). Both are supplied to Aave v3, minting rebasing aUSDC and aUSDT directly into your wallet. Those aTokens are then registered with Aqua as a pegged, narrow-band automated market maker strategy. From that point on, the aTokens keep rebasing with Aave yield in the background, while real swaps route through the pegged pool and pay the position a small spread on top — two independent income streams from one balance. Because pegged pools carry depeg risk, every position carries a protective rule you configure at deposit time: a peg-deviation limit, a take-profit target, a stop-loss, and a max-drawdown limit, any combination of which can be active. An automated keeper runs a pass over every open position on a schedule, reads its live on-chain state, evaluates the rule, and either holds, raises an alert, or executes a full unwind: docking the Aqua position, repaying any variable debt left by an asymmetric swap, and withdrawing both legs from Aave back to your wallet as plain stablecoins plus yield. This happens automatically, even if you are offline, without ever taking custody of your funds. The keeper only ever holds a Privy session signer scoped to exactly two functions, dock() and withdraw(), on the one position it was delegated for.

    How it's made

    AquaStack is a Next.js (App Router, TypeScript) app with the entire chain-facing layer built as Server Actions, so none of the 1inch SDK code or RPC logic ever ships to the browser. The client only ever receives pre-built, ready-to-sign transaction plans and read-only position state. The stack: wagmi + viem for chain reads and transaction sending, Privy for wallet auth (both a plain browser-wallet fallback and Privy's embedded wallets with delegated session signers), Tailwind for styling, and Upstash Redis for the position/rule store in production — it falls back to a local JSON file in dev, since a serverless deployment's filesystem doesn't persist between invocations but a long-running dev server's does. The core partner technology is 1inch Aqua, via the official @1inch/aqua-sdk and @1inch/swap-vm-sdk. Aqua's key property a maker registers a virtual balance and the underlying tokens only move at the instant a swap settles is what makes the whole product possible: it lets the same aToken be Aave-earning and Aqua-liquidity at once, since Aqua never actually takes custody. Aave v3 supplies the lending side for real, live yield rather than a simulated APY. The most notable hacky bit: neither 1inch Aqua nor SwapVM has an official Base Sepolia testnet deployment, so we redeployed both ourselves opcode-identical to the official SDK builds — and verified the whole flow end-to-end against our own deployment, which the 1inch bounty rules explicitly allow. Close behind that: the 1inch SDKs ship a broken ESM build (extensionless relative imports that Node can't resolve), so we had to add the packages to Next.js's serverExternalPackages config to force it to fall back to native require() and pick up the working CJS build instead without that, the build silently fails at import time. Another deliberate design choice: a deposit ships min(suppliedLegA, suppliedLegB) to Aqua so the pegged curve always starts exactly at 1:1, leaving any small remainder from an unbalanced deposit sitting in the wallet, still earning Aave yield, just outside the Aqua position. And the keeper itself only ever holds a Privy session signer scoped to exactly dock() and withdraw() for one position at a time a deliberately narrow blast radius instead of a general-purpose delegated signer.