Afonso_DiazTotal
Updated 2025-03-09
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
›
⌄
with
main as (
select
tx_hash,
block_timestamp,
decoded_log:beneficiary::string as user,
decoded_log:collateral_amount / 1e6 as collateral_amount_usd,
decoded_log:avusd_amount / 1e18 as amount_usd,
event_name
from
avalanche.core.ez_decoded_event_logs
where
tx_succeeded
and origin_to_address = '0x1499cb3197427b78dc0e2d356a1e0e4149e0ed51'
and origin_to_address = contract_address
and event_name in ('Redeem', 'Mint')
)
select
count(distinct iff(event_name = 'Mint', tx_hash, null)) as mints,
count(distinct iff(event_name = 'Redeem', tx_hash, null)) as redeems,
count(distinct iff(event_name = 'Mint', user, null)) as minters,
count(distinct iff(event_name = 'Redeem', user, null)) as redeemers,
sum(iff(event_name = 'Mint', amount_usd, 0)) as mint_volume_usd,
sum(iff(event_name = 'Redeem', amount_usd, 0)) as redeem_volume_usd,
mint_volume_usd - redeem_volume_usd as tvl_usd
from
main
QueryRunArchived: QueryRun has been archived