Search projects, hackathons, sponsors and tech

    ← All projects

    MarginMM

    Risk-bounded market making for leveraged Aave positions, enforced inside 1inch SwapVM.

    Demo

    About

    MarginMM is a collateral-aware market-making system for leveraged Aave V3 positions. A maker can use WETH and USDC collateral as liquidity through 1inch Aqua, while MarginMM continuously protects the lending position from unsafe execution. For each trade, MarginMM calculates qMax — the maximum safe executable amount — using the maker’s live Aave state, an active stressed-risk policy, and the maker’s minimum StressHF floor. Safe trades execute fully, oversized trades are reduced to a risk-capped partial fill, and trades with no safe capacity fail closed. Live market evidence from The Graph calibrates the stress policy, while a Risk Agent pays for fresh calibration through x402 using HBAR on Hedera Testnet. The Maker retains final control by approving the signed policy from their own browser wallet.

    How it's made

    MarginMM is built with Solidity and Foundry on a pinned Ethereum mainnet fork, using Aave V3 for the maker’s collateral and debt state and the official 1inch Aqua/SwapVM stack for market-making execution. We extended SwapVM with a custom MarginMM risk instruction that checks the active policy and computes qMax directly in the execution path. The Risk Agent uses the OpenAI Agents SDK for orchestration, while risk-critical calculations remain deterministic. It fetches live Uniswap and Aave evidence through The Graph, which is converted into a WETH downside shock and an EIP-712 signed MarketPolicy. Fresh calibration is exposed as a live x402-gated service: the Agent pays real HBAR on Hedera Testnet through Blocky402, validates the settlement receipt, then receives the signed policy. The policy can only be activated by the Maker through their browser wallet. The frontend is built with React, TypeScript and Vite, and shows Current HF, StressHF, qMax, full fills, liquidity-capped fills, risk-capped partial fills, and confirmed onchain execution evidence.