Mandate

Market makers get bounded, revocable strategies, not your tokens: deals as onchain code.

Mandate

Created At

ETHGlobal Mumbai

Winner of

1inch

1inch - Build an Aqua App 1st place

Project Description

Mandate turns the market-maker deal into an onchain program for new token issuers. Today a project usually loans tokens to a market maker and hopes the terms are honoured. With Mandate, the tokens never leave the issuer's Safe.

The issuer sets one treasury policy per token, and every value is theirs: a release schedule, gross and net sell limits and a buyback budget per period, a price floor, and market-risk thresholds. Market makers run strategies under that policy on 1inch Aqua, within the bounds the issuer grants. A strategy is either two-sided market making or buyback only. Every strategy shares the policy's limits, so extra strategies, reships and buy-sell round trips cannot reset or multiply the budget. Every ship also checks that the Safe really holds what its strategies promise.

A Uniswap v4 hook and market oracle report spot and TWAP prices, short-term volatility, trusted depth and pool age. Trusted depth ignores liquidity added within a settle window, so just-in-time deposits don't count. Each fill then runs in Normal, Defensive or Paused mode against the issuer's thresholds. A stale quote is refused, separately from price impact.

The platform covers everything around the deal. Issuers launch a token and open its Uniswap pool. They pick a market maker ranked by an onchain-only score, and the market maker accepts by signing the exact strategy terms. A Safe module, quoter and indexer enforce the deal and explain every refusal publicly. It is live on Base with mock tokens.

How it's Made

Mandate is three layers: Solidity contracts, a TypeScript indexer and SDK, and a React app.

Contracts (Solidity 0.8.30, Foundry). The core is a Safe 1.4.1 module. Each Safe gets one treasury policy per token, and market makers' strategies attach to it. Strategies run on 1inch Aqua and SwapVM. Aqua's virtual balances let a Safe "ship" inventory to an order without the tokens ever leaving it, which is how the market maker gets no custody. Each strategy's order is two SwapVM instructions: a salt, then an Extruction call into our MandateQuoter. The quoter prices every fill itself and enforces every rule: risk mode, quote tolerance, impact, fill size, floor, gross/net/release limits and buyback budget. The counters are kept per policy, not per order. The module can only ship, dock and pay a market maker's fees from the Safe, all as plain calls. Since Aqua balances are virtual, every ship checks that the Safe truly holds what all its live strategies promise.

Uniswap v4. Our hook extends OpenZeppelin's oracle hook for TWAPs. We added a beforeAddLiquidity hook that records the liquidity before each add. Liquidity added within a settle window doesn't count as trusted depth, so a just-in-time deposit can't pass a depth check in the same block. A market oracle turns that into spot, long and short TWAPs, depth to move the price ±band (via SqrtPriceMath), and pool age. A pure library then maps those readings to Normal, Defensive or Paused. Pools and oracles come from a launcher; liquidity goes in through the PositionManager in one batched Safe transaction (MultiSendCallOnly, the only delegatecall the app permits).

Off-chain. A viem SDK generates the ABIs from Foundry's build output. It pins every read to one block and rechecks the hash, so a reorg can't mix data. Its error map must cover every contract error at compile time. The indexer runs TypeScript directly on Node 24: Hono, Drizzle and Postgres, a per-block Redis cache, live server-sent events, reorg rollback through cascading foreign keys, and a prober that quotes strategies for an onchain-only market-maker score. Market makers accept proposals by signing EIP-712 terms, checked through the RPC so smart wallets work too. The web app is Vite, React 19, shadcn and wagmi.

Partners. 1inch Aqua and SwapVM give non-custodial market making with a programmable quote. Uniswap v4 hooks give a manipulation-aware oracle. Safe gives multi-owner control. Base gives cheap, real deployment.

Notable hacks: - The hook's permission flags live in its address, so its CREATE2 salt is mined. - A small scenario contract catches expected reverts onchain, which gives every "blocked" step in our demo a real transaction receipt. - The fork is fully deterministic, so the recorded demo reproduces block for block. - Mainnet-fork tests run against the canonical Aqua, SwapVM, v4 and Safe contracts. - We smoke-test the UI by driving headless Chrome over the DevTools protocol with Node's built-in WebSocket, with no browser test library at all.

background image mobile

Join the mailing list

Get the latest news and updates

Mandate | ETHGlobal