-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add queries for TON Dune Index metrics #7621
base: main
Are you sure you want to change the base?
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
a337674
to
7d00a7e
Compare
, avg(price) as price | ||
from {{ source('prices', 'usd') }} | ||
where true | ||
and symbol = 'TON' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add and blockchain IS NOT NULL
to filter for only TON prices, the TON symbol on ethereum is Tokamak Network Token (TON) for which the prices are different
|
||
-- fee paid for sending messages | ||
select block_date, sum( | ||
coalesce(m.fwd_fee * 1e-9, 0.0) * p.price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead do sum( (COALESCE(m.fwd_fee, 0) + COALESCE(m.import_fee, 0) + COALESCE(m.ihr_fee, 0)) * 1e-9 * p.price ) as fees
For internal transactions, the total message fee = fwd_fee+ihr_fee based on the "forward fees" section here
For external transactions, the total message fee = import_fee
When import_fee != 0 and fwd_fee > 0, we get no results.
When import_fee != 0 and ihr_fee > 0, we also get no results.
So we can do (COALESCE(fwd_fee, 0) + COALESCE(import_fee, 0) + COALESCE(ihr_fee, 0)) to consider both internal and external cases.
Thank you for contributing to Spellbook 🪄
Please open the PR in draft and mark as ready when you want to request a review.
Description:
Adding TON metrics to the Dune Index
quick links for more information: