hmxinternProtocol fees
Updated 2024-09-16
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
32
33
34
35
›
⌄
with trading_fees_log as (
select
sum(case
when EVENT_NAME = 'LogSettleTradingFeeAmount' then DECODED_LOG['feeUsd']
when EVENT_NAME = 'LogSettleBorrowingFeeValue' then DECODED_LOG['feeUsd']
when EVENT_NAME = 'LogSettleLiquidationFeeValue' then DECODED_LOG['usd']
end) / pow(10,30) as usd,
case
when EVENT_NAME = 'LogSettleTradingFeeAmount' then 'tradingFees'
when EVENT_NAME = 'LogSettleBorrowingFeeValue' then 'BorrowingFees'
when EVENT_NAME = 'LogSettleLiquidationFeeValue' then 'LiquidationFees'
end as type
from blast.core.fact_decoded_event_logs
where CONTRACT_ADDRESS = lower('0x9F1f13eBC178122C3ef6c14FA3A523680563F58b')
and EVENT_NAME in (
'LogSettleTradingFeeAmount',
'LogSettleBorrowingFeeValue',
'LogSettleLiquidationFeeValue'
)
group by 2
),
hlp_fees as (
select sum(decoded_log['feeUsd']) / pow(10,30) as usd,
'HlpFees' as type,
from blast.core.fact_decoded_event_logs
where contract_address = lower('0xF0D92907236418Fa8Ee900E384b4c6928f7cADfc')
and event_name in ('CollectAddLiquidityFee', 'CollectRemoveLiquidityFee')
)
select * from (
select * from trading_fees_log
union all
select * from hlp_fees
)
order by type
QueryRunArchived: QueryRun has been archived