Idlecash

Self-custodial control panel for 1inch Aqua: sign, ship and dock LP strategies, verified on-chain.

Idlecash

Created At

ETHGlobal Mumbai

Project Description

IdleCash is a self-custodial control panel for 1inch Aqua, the shared liquidity layer where a maker’s tokens stay in their own wallet while the same balance backs swap strategies.

The problem: Aqua lets liquidity providers keep custody, but managing strategies today means building raw calldata, signing by hand and checking block explorers to see whether anything actually happened. IdleCash gives makers a mobile app for that workflow, so they never have to hand assets to a centralized platform.

What it does:

A Flutter wallet app and a TypeScript backend use the official 1inch Aqua and SwapVM SDKs to build a WETH/USDC constant-product strategy and prepare the ERC-20 approvals and the Aqua ship() call. The maker’s own wallet signs every transaction. The app and backend never hold keys or funds. After each transaction, the backend checks the receipt and the Aqua event. A strategy only shows as active once its Shipped event is confirmed, and as docked once Docked is confirmed. Anything unverified stays unverified. One wallet can run several strategies, each with its own hash, status and transaction history. The app can fetch a SwapVM quote and prepare slippage-limited swap calldata. The portfolio view shows wallet balances separately from Aqua allocations, so the same tokens aren’t counted twice.

How it was tested: Aqua has no listed testnet deployment, so we ran a local fork of Base mainnet using Base’s real Aqua and SwapVM contracts. The transactions are local, not on Base mainnet.

What it does not do yet: it is an unaudited prototype. It doesn’t claim fee earnings, completed taker swaps, or shared execution across independent makers. The next milestones are a verified taker fill, a small-value run on Base mainnet, and verified fee and execution reporting.

How it's Made

Stack

  • Frontend: a Flutter app (Android debug build). It connects to the maker's wallet through Reown, signs transactions in that wallet, and saves the wallet session, strategy records and balance snapshots on the device.
  • Backend:a TypeScript/Express API with routes to prepare a deposit, prepare a dock, verify a transaction, and prepare a swap.
  • 1inch SDKs: @1inch/aqua-sdk and @1inch/swap-vm-sdk, using the official Aqua and SwapVM deployments on Base.
  • Dev environment:Ganache forked from Base mainnet, plus scripts to start the backend against the fork and fund a development account.

How it fits together

  1. The user picks a strategy size in Flutter. The backend builds an AquaXYCAmmStrategy with a random salt, wraps it in an SwapVM Order, encodes and hashes it, and uses AquaProtocolContract.buildShipTx to produce the registry transaction. The salt gives each strategy a unique hash, so one wallet can hold several.
  2. The backend returns the two ERC-20 approvals and the ship() calldata. Flutter sends each one through the wallet and waits for its receipt.
  3. The backend then checks the ship receipt. It confirms the call went to the configured Aqua registry and decodes the Aqua events. The app marks a strategy active only after it sees Shipped.
  4. Docking works the same way with buildDockTx and the Docked event.
  5. For swaps, the backend decodes the shipped strategy, asks SwapVM for an on-chain quote, and prepares router calldata with a minimum-output limit.

How the 1inch tools helped: using the official SDK builders meant we never hand-wrote calldata. The same SDK gave us the strategy encoding, the hashing and the SwapVM quote, so the app talks to the real protocol and not a mock.

Notable and hacky parts

  • A fork instead of a testnet. The SDK lists no Aqua registry on Base Sepolia, so we forked all of Base mainnet in Ganache and run against Base's real Aqua and SwapVM contracts. Transactions there are local only. The backend fails closed on any chain without an explicitly verified Aqua deployment.
  • Receipts, not wallet responses, are the source of truth. A confirmed transaction isn't enough: if Aqua didn't emit Shipped, the app throws instead of showing the strategy as active. Pending transactions are re-checked when the app restores saved state.
  • Balance snapshots are written on device. A new one is stored when the value changes by at least 0.1% or 15 minutes have passed. History keeps up to a year or 2,000 snapshots, and the chart shows a trend only once it has two. We label it balance history, not performance, since deposits and withdrawals change it.
  • No double counting:wallet balances and Aqua allocations are shown separately, because one wallet balance can back several strategies.
  • Prototype Solidity, not wired in:the repo includes a custom SwapVM opcode (0x81, a regime-based dynamic spread) and a RegimeOracle, with Foundry tests. They are not deployed and not used by the app. We kept them out of the live flow on purpose and say so in the README.

What's not built yet: completed taker swaps, shared execution across independent makers, and fee tracking.

.

background image mobile

Join the mailing list

Get the latest news and updates