KARTODTop 10 users, who Borrowed SOL and USDC to Solend
Updated 2022-07-03Copy 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 sol as (
select
date_trunc('day', block_timestamp) as day,
SIGNERS[0] as users,
sum(INNER_INSTRUCTIONS[0]:instructions[1]:parsed:info:amount/1e9) as sol_borrowed
from solana.core.fact_transactions
where INSTRUCTIONS[1]:programId = 'So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo'--
and INNER_INSTRUCTIONS[0]:instructions[0]:parsed:info:authority = 'DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby'
and PRE_TOKEN_BALANCES[0]:mint = 'So11111111111111111111111111111111111111112'
and succeeded = 'TRUE'
and day >= '2022-01-01'
group by 1,2
),
usdc as (
select date_trunc('day', block_timestamp) as day, SIGNERS[0] as users,
sum(INNER_INSTRUCTIONS[0]:instructions[1]:parsed:info:amount/1e6) as usdc_borrowed
-- count(distinct(pretokenbalances[0]:owner))
from solana.core.fact_transactions
where INSTRUCTIONS[1]:programId = 'So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo'--
and INNER_INSTRUCTIONS[0]:instructions[0]:parsed:info:authority = 'DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby'
and POST_TOKEN_BALANCES[0]:mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
and succeeded = 'TRUE'
and day >= '2022-01-01'
group by 1,2
),
solprice as (select date_trunc('day', block_timestamp) as day,
avg(swap_to_amount/swap_from_amount) as sol_price
from solana.core.fact_swaps
where day >= '2022-01-01'
and swap_from_mint = 'So11111111111111111111111111111111111111112' --wSOL
and swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' --USDC
and swap_to_amount > 0
and swap_from_amount > 0
and succeeded = 'TRUE'
Run a query to Download Data