Skip to content

robertleifke/numo

Repository files navigation

Numo

⚠️ WARNING: This code has not yet been audited. Use at your own risk.

Fuzz Testing npm version


Numo

Automated market maker for on-chain derivatives

Overview

Automated market makers (AMMs) have revolutionized spot markets by bootstrapping liquidity without relying on external price feeds. As the token economy expands, this mechanism has proven invaluable. Yet, no equivalent solution exists for derivatives. Bootstrapping liquidity for derivative markets without established prices is a fundamentally harder problem. As a result, derivative markets are limited to a small subset of tokens. Numo changes this. By leveraging the novelty of AMMs, Numo enables derivative exposure on any token—without requiring a counterparty or oracles.

Application

Numo enables the synethetic exposure of forwards for cross-border lending, payments, and exchange. With Numo, users can lock in an exchange rate for a specific time. The replication of a forward is a combination of long calls and short puts.

Advantages

  • ✅ Any derivative exposure
  • 🌍 Globally accessible
  • 🤝 No reliance on counterparties
  • 🛠️ Customizability

Architecture

Numo is a Uniswap V4 hook that inherits OpenZeppelin's BaseCustomCurve contract from their uniswap-hooks library. Thus enabling Numo to interact with the V4 poolmanager for optimal routing and inherit much of their battle tested code without needing use the concentrated liquidity logic. Instead of calling beforeSwap directly, Numo.sol implements its custom curve in _getUnspecifiedAmount to support the replication of derivatives. Each call and put is repersented as a ERC-6909 token.

Trading curve

The trading curve in Numo determines the price and behavior of the AMM. Unlike a traditional AMM like in Uniswap V2, Numo implements a log-normal curve to adjust prices dynamically based on volatility (σ), strike (K), and time to maturity (τ). It allows users to swap assets at implied vol-adjusted prices, mimicking an options market.The formula:

Formula

Implemented in computeTradingFunction(...) with the following parameters:

  • Reserve balances reserveX, reserveY
  • Liquidity totalLiquidity
  • Strike price strike
  • Implied volatility sigma
  • Time to maturity tau

Acknowledgements

The smart contract suite is inspired by Primitive's RMM implementation and the replicating market makers paper that first proved that any synethic derivative expsoure can be constructed using AMMs without needing a liquid options market.

Setup

Requires forge to be installed already.

forge install

Testing

forge test -vvv

Coverage

forge coverage --report lcov
cmd + shift + p -> Coverage Gutters: Display Coverage

Gas benchmarks

View gas usage

forge snapshot --gas-report

Compare gas usage

forge snapshot --diff

Update dependencies

git submodule update --init --recursive

Deployments

Network Factory Address
Unichain Sepolia 0x82360b9a2076a09ea8abe2b3e11aed89de3a02d1

Releases

No releases published

Packages

No packages published