Skip to content

fix(balancer): exclude TORUS from prices.day in protocol fee USD conversion#9801

Open
tiagoponciano wants to merge 1 commit into
duneanalytics:mainfrom
neo-empresarial:@tpa/fix/torus-price
Open

fix(balancer): exclude TORUS from prices.day in protocol fee USD conversion#9801
tiagoponciano wants to merge 1 commit into
duneanalytics:mainfrom
neo-empresarial:@tpa/fix/torus-price

Conversation

@tiagoponciano

Copy link
Copy Markdown

Thank you for contributing to Spellbook 🪄

Please open the PR in draft and mark as ready when you want to request a review.

Description:

Summary

Excludes TORUS (0xb47f575807fc5466285e1277ef8acfbb5c6686e8) from the prices.day lookup in balancer_v3_compatible_protocol_fee_macro, preventing inflated Swap Fee USD values caused by a bad upstream DEX-derived price.
A dust trade in dex.trades with a very small TORUS amount (~0.000006) and $0.214 notional produced an implied price of ~34,659 USD via amount_usd / token_amount. That value flowed through the SQLMesh pricing pipeline into prices.day (source = 'dex.trades') and was consumed by balancer.protocol_fee, causing an abnormal ~600k USD Swap Fee spike. Normal TORUS trades imply ~0.016 USD.


quick links for more information:

@github-actions
github-actions Bot marked this pull request as draft June 17, 2026 11:31
@github-actions github-actions Bot added the WIP work in progress label Jun 17, 2026
@tiagoponciano
tiagoponciano marked this pull request as ready for review June 17, 2026 11:52
@github-actions github-actions Bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review this PR development is complete, please review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant