Calibration request: Uniswap V3 fee-base USD when dex.trades.amount_usd follows the output leg #9902
Replies: 1 comment 4 replies
|
Great investigation. The core finding is correct and the fix approach is sound. On your questions:
On the 304,833x multiple: Your regression proof on 3.1M unchanged rows is solid. Clean fix. |
Uh oh!
There was an error while loading. Please reload this page.
TL;DR: For at least one Uniswap V3 pool,
dex.trades.amount_usdfollows the output leg of the swap. That's a perfectly valid trade valuation — but any downstream fee model that uses it as the input-token fee base inherits large errors. I'd like to confirm the intended semantics of the field.Questions
dex.trades.amount_usd?amount_usdintended as a general trade valuation, rather than a fee-bearing-leg valuation?To be clear: I'm not proposing any change to the Swap events or to
dex.trades.amount_usditself. This is a question about field semantics and downstream usage.What I found
While rebuilding Uniswap V3 fees and protocol revenue from
dex.trades:[2026-06-14 00:00:00, 2026-07-14 00:00:00)0x80f8143fa056a063aaeecec3323aa3426262ddb2dex.trades.amount_usdand the sold-token input-side USD value at six-decimal precisionWorst row:
254673730xb1a43313b51512b45fc5d921838a8a6427266f4326e5d82cde7cdbe02daa334918amount_usd$1,900,384.829449$6.234174304,833.4685×The raw source
uniswap_v3_ethereum.uniswapv3pool_evt_swapchecks out:amount0/amount1reconcile with the decoded WETH output and AVAIL input for both material rows. So the data isn't wrong — the question is which leg the field is meant to carry.What I did on my side
I applied a targeted metric-layer repair to the 142 accepted keys only:
fixed_fee_base_usd = token_sold_amount × sold_token_minute_price_usd
Every other row keeps its legacy fee base, and a regression query proves the remaining 3,105,739 rows are unchanged at six-decimal precision.
Evidence
All reactions