USD_DEPOSITED | USD_REPAYED | USD_BORROWED | USD_WITHDRAWN | |
---|---|---|---|---|
1 | 12666110.4242138 | 5261452.99066604 | 5995628.14322744 | 8793004.09648709 |
Sbhn_NPcolossal-harlequin
Updated 4 days ago
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 price as (
select hour::date as datee,
avg(price) as usdprice
from stellar.price.ez_prices_hourly
where symbol = 'XLM'
group by 1
),
supply as ( SELECT
SUM(
CASE
WHEN COALESCE(details_json:asset_balance_changes[0]:asset_code::STRING, 'XLM') = 'XLM'
THEN details_json:asset_balance_changes[0]:amount * usdprice
ELSE details_json:asset_balance_changes[0]:amount
END
) AS usd_deposited
FROM stellar.core.ez_operations
JOIN stellar.core.fact_contract_events USING(transaction_hash)
LEFT JOIN price ON DATE_TRUNC('day', block_timestamp) = datee
WHERE details_json:asset_balance_changes[0]:to = 'CDVQVKOY2YSXS2IC7KN6MNASSHPAO7UN2UR2ON4OI2SKMFJNVAMDX6DP'
AND details_json:asset_balance_changes[0]:type = 'transfer'
AND topics_decoded:topics_decoded[0]:value ='supply_collateral'
and block_timestamp::date >= '2025-01-01'
),
repay as ( SELECT
SUM(
CASE
WHEN COALESCE(details_json:asset_balance_changes[0]:asset_code::STRING, 'XLM') = 'XLM'
THEN details_json:asset_balance_changes[0]:amount * usdprice
ELSE details_json:asset_balance_changes[0]:amount
END
) AS usd_repayed
FROM stellar.core.ez_operations
Last run: 4 days ago
1
71B
35s