kohshiba / univ4-offchain-pricing

Lime is an active hook manager which allows fillers or market makers to set price and fill Intent / RFQ based swap requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lime: Uniswap V4 Active Hooks manager with Offchain Pricing

Lime-concept drawio (1)

Summary

Lime is an active hook manager which allows fillers or market makers to set price and fill Intent / RFQ based swap requests. This system is intended to be used through UniswapX, 1inch, CowSwap, and other RFQ / Intent based systems.

Offchain entities are usually more competitive in terms of pricing and taking orders as they can collect more information and more nimble. On the other hand, Onchain liquidity is vulnerable to toxic flows, or MEV exploits which is usually arbitrage between onchain <> offchain price (e,g. Binance and Uniswap). This situation is called LVR (Loss versus rebalance) or adverse selection problem. You can learn more on LVR intro by a16z

Lime allows onchain liquidity to be lend out to fillers or market makers, and they can set a competitive price vs offchain entities, and settle swaps with that funds. All related parties will benefit from this mechanims

  • Onchain LPs will no longer suffer from toxic liquidity, arbitrageurs, MEV
  • Traders will benefit from increased liquidity from onchain/offchain
  • Market makers can easily access to capital

Not only Lime bridges offchain and onchain environments, but mix advantages of both worlds;

  • From offchain: better pricing and execution
  • From onchain: trust-minimalized control over liquidity and composability of deposit token.

This project's code bases are inspired from Stoploss hooks and Take proft hooks

Use cases

When market is in upward trend

  • It is usually CEX who offer higher price than DEX in uptrend market
  • For example, DEX offers $1500 and CEX offers $1600
  • Market maker on Lime react to the market condition and offer around $1600
  • By this way, liquidity providers of Lime can prevent arbitrageurs(MEV) to take all the profits, which is generated by selling an asset by about $100 higher price

When market is in downward trend

  • It is usually CEX who offer lower price than DEX in downtrend market
  • For example, DEX offers $1500 and CEX offers $1400
  • Market maker on Lime react to the market condition and offer around $1400
  • By this way, liquidity providers of Lime can prevent taking unfavorable selling orders at higher price

Example tx flow

Lime-txs drawio

Tests

requires foundry

forge test --via-ir 

About

Lime is an active hook manager which allows fillers or market makers to set price and fill Intent / RFQ based swap requests.

License:MIT License


Languages

Language:Solidity 100.0%