BondDocumentation

AMM (Swap) Protocol

Technical documentation for the Bond Uniswap V3-based AMM.

Architecture

Bond Swap is a Uniswap V3 fork deployed on the 0G Network with concentrated liquidity, multiple fee tiers, and NFT-based LP positions. The implementation uses the standard Uniswap V3 contract suite with no modifications to core AMM logic.

Supported Tokens

a0G

0x4b3c2f55fa67679b382c979a082df1b32079b4cb

18d

cbBTC

0xa5613ac7f1e83a68719b1398c8f6aaa25581db82

8d

iAI

0xc77fbd3824cc68e612b26114d176879addc29463

18d

st0G

0x7bbc63d01ca42491c3e084c941c3e86e55951404

18d

USDC.e

0x1f3aa82227281ca364bfb3d253b0f1af1da6473e

6d

0G

0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c

18d

WBTC

0x0555e30da8f98308edb960aa94c0db47230d2b9c

8d

WETH

0x564770837ef8bbf077cfe54e5f6106538c815b22

18d

Native 0G is represented using sentinel address 0xEeee...eEEeE and internally resolved to W0G for all pool operations.

Fee Tiers & Tick Spacing

0.01%

fee: 100

tick: 1

0.05%

fee: 500

tick: 10

0.30%

fee: 3000

tick: 60

1.00%

fee: 10000

tick: 200

Routing

The swap router attempts a direct single-hop swap first. If no direct pool exists, it routes through W0G as an intermediary (2-hop). Multi-hop paths are encoded as tightly-packed byte arrays: [address(20) + fee(3)] x N + address(20)

Key Functions

SwapRouter02.exactInputSingle

Single-hop swap with exact input amount. Returns output amount.

(tokenIn, tokenOut, fee, recipient, amountIn, amountOutMinimum, sqrtPriceLimitX96)

SwapRouter02.exactInput

Multi-hop swap along an encoded path. Returns output amount.

(path, recipient, amountIn, amountOutMinimum)

QuoterV2.quoteExactInputSingle

Simulate a single-hop swap (read-only). Returns quote amount and gas estimate.

(tokenIn, tokenOut, amountIn, fee, sqrtPriceLimitX96)

NonfungiblePositionManager.mint

Create a new concentrated liquidity position. Returns NFT tokenId.

(token0, token1, fee, tickLower, tickUpper, amount0Desired, amount1Desired, amount0Min, amount1Min, recipient, deadline)

Tick Mathematics

price = 1.0001 ^ tick

humanPrice = price * 10^(decimals0 - decimals1)

Min tick: -887,272 · Max tick: 887,272

Data Sources

On-Chain (Real-Time)

Pool state (liquidity, sqrtPrice, tick) via RPC multicalls. QuoterV2 for swap simulation. All write operations via SwapRouter02 and NonfungiblePositionManager.

Subgraph (Indexed)

Goldsky subgraph indexing pool events for TVL, volume, 24h metrics, and user positions. Polled at 30-second intervals.

External (CoinGecko)

USD price feeds for token valuations. Free API tier with 30-second polling and request deduplication.

Based on Uniswap V3

Bond Swap uses the Uniswap V3 implementation without changes to core AMM logic. The linked Trail of Bits report reviews the upstream Uniswap V3 contracts; it is not a separate audit of Bond-specific modifications.

Read the upstream Uniswap V3 Trail of Bits report ↗