Search projects, hackathons, sponsors and tech

    ← All projects

    RiverSwap

    Auction-Managed AMMs: A market for DeFi liquidity provider optimization

    Demo

    About

    RiverSwap is "am-AMM: An Auction-Managed Automated Market Maker." built on top of 1inch SwapVM and Aqua. We fix two major issues with conventional AMMs: 1 - Liquidity providers (LPs) systematically bleed money to arbitrage bots, a cost that has been coined "loss versus rebalancing" or LVR. 2 - LPs have their assets locked in the pool of liquidity. They surrender custody and the ability to use capital for anything else (lending, collateral, governance…) These issues are not easy to fix: 1 - a) Increasing the trading fees to 'give back' value to LPs makes the protocol less competitive for swappers. b) Finding the 'right' fee is hard. Worse, it may change dynamically depending on market conditions. Yet many conventional AMMs still offer static fees. 2 -By design of AMMs current implementations, funds are locked. RiverSwap comes to the rescue. 1 - Inspired by Adams et al., we auction the right to set and to capture the trading fee. LPs are now compensated by the rent created by the highest bid. The complex problem of setting the 'right' fee is now 'solved' by market participants. 2 - We build on 1inch's Aqua, a shared liquidity layer, so LPs never lock their assets in a pool contract at all. Funds stay in the LP's own wallet and are only pulled atomically at the exact moment a swap executes. The same capital stays fully self-custodial and can keep working elsewhere. We expect this protocole to be more competitive for both LPs and swappers, leaving less money to arbitragers. Our core contribution is to a) implement Adams et al.'s research using 1inch's SwapVM and Aqua. b) extend the original research to Uniswap-V3-style concentrated liquidity (rather than Uniswap-V2-style liquidity).

    How it's made

    River Dex uses 1inch's SwapVM and Aqua to build an auction-managed automated market maker (am AMM). It came down to two major pieces of work: 1) a new SwapVM opcode that makes the fee auction possible 2) a Tycho indexer integration that reconstructs a single liquidity pool out of distributed orders. 1) The core of the build is a custom SwapVM opcode, _aquaAccountedDynamicFeeAmountInXD. It does two things at once: it applies a dynamic fee that's read at swap time rather than hardcoded, and it accounts the fees generated through Aqua so we can track exactly how much each pool produces per period. 2) Because SwapVM liquidity is order based and distributed, there's no single pool contract holding reserves; the "pool" is really a universe of individual signed orders and a solver can't just read a reserve to price it. So we built a Tycho integration to index that universe of active order and reconstruct the pool state off-chain.