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.
Contract Addresses (0G Testnet)
SwapRouter02
0x0A747f2Aff533B0Ac69d852eDD5A2963666dFd54
QuoterV2
0x8Be0799fD3537Da1be7F55690632B9F8DD21Be82
UniswapV3Factory
0xef93cCFfA3a5B18bAFF1bC985a0C0606F70Ae99c
NonfungiblePositionManager
0xf07F21CB0222bed19eE6ae041DCf062D107aE428
W0G (WETH9)
0xF57f5B08Dfa12C5C4d75B2063Be0607e942c92cB
Supported Tokens
W0G
0xF57f5B08Dfa12C5C4d75B2063Be0607e942c92cB
18d
USDC.e
0xF2506aa3684871549083d235453a1dcDcCB3396c
6d
WETH
0xcda3B2B66ab3d9263C3d065f2ef04f8D27C7F6F3
18d
cbBTC
0x0a70dC9089Cf091aFE4D52276aC379c35A576d71
8d
Native A0GI 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 contracts are a fork of Uniswap V3, which has been extensively audited. Refer to the Uniswap V3 documentation for detailed protocol mechanics.