KaskoazulCopy of Yawww - NFT
Updated 2022-05-08
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 YAWWW_TXS as (
select tx_id
from solana.fact_events
where block_timestamp >= '2022-04-01'
and program_id = '76f9QiXhCc8YLJc2LEE4Uae4Xu3itc3JCGLmup3VQwRH' --Yawww.io
),
FUNDED_LOANS as (
select ft.block_timestamp as fecha,
ft.tx_id,
ft.signers[0] as lender,
ft.inner_instructions[0]:instructions[0]:parsed:info:lamports / pow(10,9) as paid_amount,
ft.inner_instructions[0]:instructions[0]:parsed:info:destination as borrower,
ft.inner_instructions[0]:instructions[1]:parsed:info:lamports / pow(10,9) as loan_fees
from solana.fact_transactions ft
where fecha >= '2022-04-01'
and ft.tx_id IN (select tx_id from YAWWW_TXS)
and ft.succeeded = 'TRUE'
and ft.log_messages[1] = 'Program log: Instruction: Accept loan request'
group by 1,2,3,4,5,6
),
LENDERS as (
select lender,
count(tx_id) as funded_lends,
sum(paid_amount) as total_loaned,
sum(loan_fees) as total_fees,
sum(total_loaned) over (order by lender) as loan_volume,
sum(total_fees) over (order by lender) as fees_volume,
row_number () over (order by lender) as lender_id
from FUNDED_LOANS
group by lender
order by funded_lends desc
),
BORROWERS as (
Run a query to Download Data