Skip to content

Methodology

DISCLAIMER // NFA // DYOR

This analysis is based on observations of the contract behavior. We are not smart contract security experts. This document aims to explain what the contract appears to do based on the code. It should not be considered a comprehensive security audit or financial advice. Always verify critical information independently and consult with blockchain security professionals for important decisions.

⊙ generated by robots | curated by humans

METADATA
Contract Address 0x658bF1A6608210FDE7310760f391AD4eC8006A5F (etherscan)
Network Ethereum Mainnet
Analysis Date 2026-02-28

Overview

This analysis started from the contract address 0x658bF1A6608210FDE7310760f391AD4eC8006A5F, identified as zQuoter by the project owner. The Etherscan API was used to fetch the verified source code and ABI. The contract verified with an Exact Match, meaning Etherscan was able to recompile the submitted source and confirm it matches the deployed bytecode.

The source is a single 2,300-line Solidity file containing the core zQuoter contract plus several embedded math library dependencies (TickMath, SwapMath, SqrtPriceMath, FullMath, LiquidityMath, BitMath, SafeCast, UnsafeMath, FixedPoint96, V4TickBitmap) and interface definitions for all external contracts. These embedded libraries are drawn from Uniswap's published codebase.

The primary analytical effort focused on understanding the quoting methodology for each AMM type (V2/Sushi via reserve math, V3 via external quoter delegation, V4 via local tick simulation, zAMM via reserve math with bps fee), the best-route selection logic, and the calldata builder functions. A secondary focus was contextualizing the ZROUTER constant and its relationship to the newer zRouter contract previously analyzed.

Cross-referencing the deployer address (0x999657a4...b44e1c) and the ZROUTER constant deployment history confirmed that zQuoter targets an earlier zRouter version predating the February 2026 deployment.

Thought Process

%%{init: {'theme': 'base'}}%%
mindmap
  root((zQuoter Analysis))
    Contract Identification
      Fetch verified source via Etherscan API
      Single file — 2300 lines
      Solidity 0.8.30 + Prague EVM
      Exact Match verification
    Contract Type
      Standalone — no proxy
      No storage — fully stateless
      No owner or admin
      Pure read layer
    Architecture
      7 public view functions
      Embedded V4 math libraries
      5 external protocol dependencies
      ZROUTER constant — older zRouter
    AMM Coverage
      Uniswap V2 — reserve math
      SushiSwap — reserve math
      zAMM 4 fee tiers — reserve math
      Uniswap V3 4 fee tiers — quoter delegation
      Uniswap V4 4 fee tiers — tick simulation
    Calldata Generation
      buildBestSwap — single hop
      buildBestSwapViaETHMulticall — two hop via WETH
      SlippageLib — amountLimit calculation
      Targets older ZROUTER constant
    Risk Assessment
      No storage — no centralization
      ZROUTER staleness — medium
      V4 simulation divergence — medium
      V3 try/catch silent failures — low
      payable constructor no sweep — informational
    Contextual Notes
      Deployed Aug 2025 before newer zRouter
      Different deployer from newer zRouter
      Both appear to be zFi-operated

Verification Guide

External Resources

RESOURCE USAGE
Etherscan — zQuoter Contract Primary source for verified source code, ABI, deployment metadata
Etherscan — ZROUTER constant address Confirmed as earlier zRouter version (Exact Match verified)
Uniswap V3 QuoterV2 Docs Interface reference for the V3 quoter called by quoteV3
Uniswap V4 Docs — StateView StateView lens interface reference for quoteV4
DNZN zRouter Analysis Context for the newer zRouter deployed 2026-02-12

Commandline Tools

Tip

Commands below use cast from the Foundry Toolkit. To run the commands below, you must set the RPC URL environment variable:

export ETH_RPC_URL=https://eth.llamarpc.com

Verify Contract Deployment and Bytecode

# CONFIRM CONTRACT IS DEPLOYED (non-empty bytecode)
cast code 0x658bF1A6608210FDE7310760f391AD4eC8006A5F

# GET DEPLOYMENT TRANSACTION DETAILS
cast tx 0xf851c65a81b38b4efa7fb169afff00f40d732511bd5538471ae34596649e1c60

# CONFIRM ZERO STORAGE (fully stateless — all slots should return zero)
cast storage 0x658bF1A6608210FDE7310760f391AD4eC8006A5F 0
cast storage 0x658bF1A6608210FDE7310760f391AD4eC8006A5F 1
cast storage 0x658bF1A6608210FDE7310760f391AD4eC8006A5F 2

Verify Function Selectors

# CONFIRM EXPECTED FUNCTION SELECTORS
cast sig "getQuotes(bool,address,address,uint256)"
cast sig "quoteV2(bool,address,address,uint256,bool)"
cast sig "quoteV3(bool,address,address,uint24,uint256)"
cast sig "quoteV4(bool,address,address,uint24,int24,address,uint256)"
cast sig "quoteZAMM(bool,uint256,address,address,uint256,uint256,uint256)"
cast sig "buildBestSwap(address,bool,address,address,uint256,uint256,uint256)"
cast sig "buildBestSwapViaETHMulticall(address,address,bool,address,address,uint256,uint256,uint256)"

Test Live Quoting (Example: 1 WETH → USDC)

# GET ALL QUOTES FOR 1 WETH -> USDC (EXACT IN)
# tokenIn = WETH (0xC02aaa...), tokenOut = USDC (0xA0b86991...), amount = 1e18
cast call 0x658bF1A6608210FDE7310760f391AD4eC8006A5F \
    "getQuotes(bool,address,address,uint256)" \
    false \
    0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
    0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
    1000000000000000000

# QUOTE V2 ONLY FOR 1 WETH -> USDC
cast call 0x658bF1A6608210FDE7310760f391AD4eC8006A5F \
    "quoteV2(bool,address,address,uint256,bool)" \
    false \
    0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
    0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
    1000000000000000000 \
    false

# QUOTE V3 (500 bps fee tier) FOR 1 WETH -> USDC
cast call 0x658bF1A6608210FDE7310760f391AD4eC8006A5F \
    "quoteV3(bool,address,address,uint24,uint256)" \
    false \
    0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
    0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
    500 \
    1000000000000000000

Verify ZROUTER Constant Address

# CONFIRM THE ZROUTER CONSTANT IS THE OLDER ZROUTER
cast code 0x0000000000404FECAf36E6184245475eE1254835

# COMPARE WITH THE NEWER ZROUTER (analyzed separately)
cast code 0x000000000000FB114709235f1ccBFfb925F600e4

Token Cost Breakdown

PHASE DESCRIPTION TOKENS
Phase 0 Obtain the Contract 8 tok
Phase 1 Discovery & Understanding 15 tok
Phase 2 Deep Dive Analysis 18 tok
Phase 3 Risk & Trust Analysis 8 tok
Phase 4 Documentation Generation 16 tok
TOTAL Complete Contract Analysis 65 tok

Note: Token costs are estimates based on typical conversation lengths and complexity. Actual consumption may vary by ±10-15% depending on API responses, iterative refinement, and verification steps.