Skip to content

Add Fresh Markets Watch submission#233

Open
go165 wants to merge 5 commits into
daydreamsai:masterfrom
go165:fresh-markets-watch-gpt55
Open

Add Fresh Markets Watch submission#233
go165 wants to merge 5 commits into
daydreamsai:masterfrom
go165:fresh-markets-watch-gpt55

Conversation

@go165

@go165 go165 commented Jun 13, 2026

Copy link
Copy Markdown

Fixes #1

Summary

  • Adds fresh-markets-watch, an on-chain AMM factory event scanner.
  • Scans V2 PairCreated and V3 PoolCreated logs using public RPC eth_getLogs.
  • Supports Base and Arbitrum default factory sets, plus caller-selected configured factories.
  • Returns decoded markets[] with pair/pool address, token addresses, factory/protocol, event type, fee where available, block/time evidence, transaction hash, and log index.
  • Adds machine-readable scan_evidence with requested/scanned blocks, factory topics, raw log count, decoded market count, decode failures, and observed false-positive rate for each invocation.
  • Enriches init_liquidity and top_holders with read-only on-chain evidence when possible: V2 getReserves() at the creation block, V2 LP mint Transfer logs from the creation receipt, and V3 slot0() / liquidity() at the creation block; unavailable evidence is explicitly marked instead of fabricated.
  • Adds x402/discovery compatibility routes for canonical, hyphenated, short, and legacy invoke clients.

Validation Commands

cd submissions/fresh-markets-watch
npm install
npm run build
npm test
npm run lint
npm audit --audit-level=moderate
FRESH_CHAIN=base FRESH_WINDOW_MINUTES=10 npm run fresh:sample
FRESH_CHAIN=base FRESH_FROM_BLOCK=47264078 FRESH_TO_BLOCK=47264078 FRESH_WINDOW_MINUTES=10 npm run fresh:sample

Validation passed after latest PR head 51b50a0:

  • npm run build
  • npm test (6/6)
  • npm run lint
  • npm audit --audit-level=moderate (0 vulnerabilities)
  • recent Base scan returned current scanned block range, raw_log_count=0, decoded_market_count=0, decode_failure_count=0, and observed false-positive rate 0

Live historical validation passed:

  • decoded a real Base SushiSwap V2 PairCreated event from public RPC
  • block: 47264078
  • pair: 0xb49425c227c48148d0f5cf9eae48e68a89c19598
  • tokens: 0x4200000000000000000000000000000000000006, 0xf95666e641107aff9b84e788154082e7a37aa014
  • tx: 0x4aec8920d00546b03e9c121aa17366e1791671766beefd1941cd0d245260a1c2
  • init_liquidity.reserve0_raw: 70000000000000
  • init_liquidity.reserve1_raw: 2622615056768501327918020
  • first LP mint holder: 0x9dc039703a6e7f8bc1ad3806e7c1e5e9bb7044ef
  • first LP mint amount: 13549282415456364892
  • scan_evidence.raw_log_count=1
  • scan_evidence.decoded_market_count=1
  • scan_evidence.decode_failure_count=0
  • scan_evidence.observed_false_positive_rate_pct=0

Server validation passed on the Beijing deployment:

  • fresh-markets-watch.service active on internal port 8802
  • Beijing server passed npm run build, npm test (6/6), npm run lint, and npm audit --audit-level=moderate
  • Beijing recent and historical live samples returned the scan evidence above
  • public health returns HTTP 200
  • public manifest returns HTTP 200 and advertises x402 price $0.01
  • unpaid public invoke returns HTTP 402 on the canonical protected path

Supported Chains

  • base
  • arbitrum

Default factories include configured V2 and V3 factory contracts for those chains. Callers may pass factories to restrict the scan to one or more configured factories.

Deployment / x402 URL

Current public deployment:

Public x402 smoke test passed: unpaid invoke returns HTTP 402 on Base (eip155:8453) at $0.01 per request.

Payout Wallet

0x1f0130669ca6fd02e025a984cc038f139df19a2f

@go165

go165 commented Jun 14, 2026

Copy link
Copy Markdown
Author

Update: hardened the Fresh Markets Watch submission with best-effort on-chain enrichment.

New in commit 5d7c879:

  • V2 PairCreated: reads getReserves() at the creation block for init_liquidity.
  • V2 PairCreated: reads the creation transaction receipt and extracts LP token mint Transfer logs for top_holders.
  • V3 PoolCreated: reads slot0() and liquidity() at the creation block; holder evidence is explicitly marked unavailable because V3 LP positions are not ERC20 pool-token holders.
  • Added tests for LP mint holder extraction and zero-address mint filtering.

Validation rerun locally and on the Beijing deployment host:

cd submissions/fresh-markets-watch
npm run build
npm test
npm run lint
npm audit --audit-level=moderate
FRESH_CHAIN=base FRESH_FROM_BLOCK=47264078 FRESH_TO_BLOCK=47264078 npm run fresh:sample

The historical Base sample returns non-null init_liquidity.reserve0_raw, init_liquidity.reserve1_raw, and an LP mint holder from eth_getTransactionReceipt. Public deployment remains reachable and x402-protected: health/manifest return 200, unpaid invoke returns 402 with payment-required.

@go165

go165 commented Jun 14, 2026

Copy link
Copy Markdown
Author

Update: pushed PR head 51b50a0 adding machine-readable scan evidence for the false-positive control path.

Additional validation completed on the Beijing x402 deployment:

  • npm run build passed
  • npm test passed (6/6)
  • npm run lint passed
  • npm audit --audit-level=moderate passed with 0 vulnerabilities
  • recent Base scan: raw_log_count=0, decoded_market_count=0, decode_failure_count=0, observed false-positive rate 0
  • historical Base SushiSwap V2 block 47264078: raw_log_count=1, decoded_market_count=1, decode_failure_count=0, observed false-positive rate 0, plus non-null reserves and LP mint holder evidence
  • public health: HTTP 200
  • public agent manifest: HTTP 200
  • unpaid canonical invoke: HTTP 402

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fresh Markets Watch

1 participant