primo_datasushi_kashi_total_stake_pct
Updated 2022-07-20
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 tvl as (
select
contract_address -- KMP token
, symbol -- KMP token
, sum(case when from_address = '0x0000000000000000000000000000000000000000' then amount else - amount end) as tvl
from ethereum.core.ez_token_transfers
where (from_address = '0x0000000000000000000000000000000000000000' or to_address = '0x0000000000000000000000000000000000000000')
and (lower(symbol) like 'km%' and symbol like '%/%-%') -- KMP tokens
group by 1,2
),
staked as (
select
contract_address -- KMP token
, symbol -- KMP token
, sum(case when lower(from_address) = lower('0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd') then -amount else amount end) as total
from ethereum.core.ez_token_transfers
where (lower(to_address) = lower('0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd') or lower(from_address) = lower('0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd'))-- staking contract
and (lower(symbol) like 'km%' and symbol like '%/%-%') -- KMP tokens
group by 1,2
),
rewards as (
select tx_hash, amount rewards_sushi
from ethereum.core.ez_token_transfers
where lower(from_address) = lower('0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd')
and symbol = 'SUSHI'
and amount > 0
),
staked_txns as (
select tx_hash, symbol, contract_address
from ethereum.core.ez_token_transfers
where (lower(to_address) = lower('0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd') or lower(from_address) = lower('0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd')) -- staking contract
and (lower(symbol) like 'km%' and symbol like '%/%-%') -- KMP tokens
),
final_rewards as (
select
staked_txns.contract_address
Run a query to Download Data