binhachonSushi Reward Program for Farmers - Remaining
Updated 2022-05-04
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
›
⌄
with claim_transactions as (
select
-- block_timestamp,
to_address as account,
sum(amount) as claimed_amount
from ethereum_core.ez_token_transfers
where block_timestamp >= '2021-10-22 09:47:00.000' --tx_hash = '0x4c22712b3a44eeae6266ee9c8c2f75316bd7d712736792e702e04b094e2fa4c1'
and from_address = lower('0x1026cbed7b7E851426b959BC69dcC1bf5876512d')
and symbol = 'SUSHI'
group by 1
-- and event_name = 'Claimed'
),
eligible_addresses as (
select
lower(address) as address,
amount
from ethereum_sushi.dim_distributor_reward_schedule
where 1=1 --lower(address) not in (select account from claim_transactions)
and merkle_root = '0x015e6c2cd1a4d6fa77aa1884c436b2435aae4beab5c9a091f18fd0c00dc7e577'
)
select
eligible_addresses.*,
claim_transactions.account,
claimed_amount,
sum(amount) over () - sum(coalesce(claimed_amount, 0)) over () as remaining_amount
from eligible_addresses
full outer join claim_transactions on (address = account)
Run a query to Download Data