Kruys-CollinsAptin Utilization
Updated 2024-10-15
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
›
⌄
WITH APTIN AS
(
SELECT
t1.block_timestamp as block_timestamp,
t1.tx_hash,
(t1.event_data:utilization)/100 as "Utilzation rate %",
t1.event_data:interest as interest,
t2.address,
t2.address_name,
t2.label,
t3.token_address,
t3.decimals,
t3.symbol
FROM
aptos.core.fact_events t1
LEFT JOIN aptos.core.dim_labels t2 ON t1.event_address = t2.address
LEFT JOIN aptos.core.dim_tokens t3 ON t1.event_data:coin_name = t3.token_address
WHERE t1.block_timestamp >= '2024-01-01'
AND initcap(t2.label) = 'Aptin Finance'
AND t1.payload_function IN (
'0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::lend::borrow',
'0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::lend::supply',
'0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::lend::repay',
'0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::lend::withdraw'
)
AND SUCCESS = 'TRUE'
)
SELECT
Date_trunc('day', block_timestamp) AS Date,
AVG("Utilzation rate %") AS "Average Utilization Rate %"
FROM APTIN
GROUP BY Date
ORDER BY Date;
QueryRunArchived: QueryRun has been archived