maybeyonaskashi_top_borrow_data
Updated 2022-05-16
999
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
token_data as (
select
token_address,
symbol,
decimals,
median(price) as price
from ethereum_core.fact_hourly_token_prices
where hour >= current_date - interval '1 day'
and decimals is not null
group by 1,2,3
),
kashi_deployments as (
select
event_inputs:cloneAddress::string as pair_address,
'0x'||substring(event_inputs:data::string, 27, 40) as collateral,
'0x'||substring(event_inputs:data::string, 91, 40) as asset
from ethereum_core.fact_event_logs
where event_removed = 'false'
and contract_address = '0xf5bce5077908a1b7370b9ae04adc565ebd643966' --bentobox
and event_name = 'LogDeploy'
and collateral is not null
and asset is not null
),
tokenMovement as (
select
contract_address as pair_address,
event_inputs:to::string as user,
event_inputs:amount as amount,
event_name
from ethereum_core.fact_event_logs
where event_removed = 'false'
and contract_address in (select pair_address from kashi_deployments)
and event_name in (
'LogBorrow',
'LogRepay'
Run a query to Download Data