Uniswap Integration
Uniswap is NMT's most complex integration, spanning three protocol versions (V2, V3, V4) with different mechanics.
Uniswap V2 — Basic AMM
What it is: The classic automated market maker. Liquidity providers deposit equal values of two tokens into a pool and earn fees from trades.
How NMT integrates:
| Layer | Component |
|---|---|
| Contract | UniswapV2Module.sol — handles swap, addLiquidity, removeLiquidity |
| Backend | workers/src/defi/services/uniswap_v2/ — indexes pairs and positions |
| Frontend | lib/defi/uniswap/v2/ — encodes V2 transactions |
| Data source | Krystal API |
Min TVL filter: $100,000
Uniswap V3 — Concentrated Liquidity
What it is: An advanced AMM where liquidity providers choose a specific price range for their capital. This increases capital efficiency but requires active management.
Key concepts:
- Tick range — the price bounds for a position (lower tick to upper tick)
- In-range — the position is currently earning fees
- Out-of-range — the price has moved outside the position's bounds
- Position NFT — each V3 position is a unique NFT owned by the user's Safe
How NMT integrates:
| Layer | Component |
|---|---|
| Contract | UniswapV3Module.sol — mint, burn, collect, increase/decrease liquidity |
| Backend | workers/src/defi/services/uniswap_v3/ — indexes positions, calculates values |
| Frontend | lib/defi/uniswap/v3/ — range selection, position encoding |
| Data source | Krystal API |
Min TVL filter: $500,000
Backend update interval: Every 2 minutes (more frequent than other protocols because CL data changes rapidly)
Uniswap V4 — Hooks
What it is: The newest version of Uniswap, introducing "hooks" — custom logic that runs before/after swaps and liquidity operations.
How NMT integrates: V4 shares much of V3's infrastructure. The backend indexes V4 pools through the same service, and the frontend has a dedicated adapter at lib/defi/uniswap/v4/.
Min TVL filter: $500,000
Key Addresses
| Chain | Contract | Address |
|---|---|---|
| Ethereum | V3 NonfungiblePositionManager | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 |
| Base | V3 NonfungiblePositionManager | 0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1 |
| Ethereum | V2 Router | 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D |