hessRewards Percentage From Net Volume
Updated 2022-11-18Copy Reference Fork
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
36
›
⌄
with rewards as ( select sum(EVENT_INPUTS:value/pow(10,6)) as reward_amount
from optimism.core.fact_event_logs
where origin_to_address = lower('0x722e9bfc008358ac2d445a8d892cf7b62b550f3f')
and event_name = 'Transfer'
)
,
deposit_tx as ( select tx_hash
from optimism.core.fact_event_logs
where origin_to_address = '0x79bc8bd53244bc8a9c8c27509a2d573650a83373'
and event_name = 'Mint')
,
deposit as ( select sum(EVENT_INPUTS:value/pow(10,6)) as deposit_amount
from optimism.core.fact_event_logs
where origin_to_address = '0x79bc8bd53244bc8a9c8c27509a2d573650a83373'
and EVENT_INPUTS:to = '0x79bc8bd53244bc8a9c8c27509a2d573650a83373'
and origin_from_address = EVENT_INPUTS:from
and event_name = 'Transfer'
and tx_hash in (select tx_hash from deposit_tx)
)
,
withdraw_tx as ( select tx_hash
from optimism.core.fact_event_logs
where origin_to_address = '0x79bc8bd53244bc8a9c8c27509a2d573650a83373'
and event_name = 'Withdraw')
,
withdraw as ( select sum(EVENT_INPUTS:value/pow(10,6))*-1 as withdraw_amount
from optimism.core.fact_event_logs
where origin_to_address = '0x79bc8bd53244bc8a9c8c27509a2d573650a83373'
and EVENT_INPUTS:from = '0x79bc8bd53244bc8a9c8c27509a2d573650a83373'
and origin_from_address = EVENT_INPUTS:to
and event_name = 'Transfer'
and tx_hash in (select tx_hash from withdraw_tx)
)
select deposit_amount+withdraw_amount as net_volume , (reward_amount/net_volume)*100 as reward_percentage
from deposit , rewards, withdraw
Run a query to Download Data