charliemarketplaceNear vs Avalanche Stablecoin Borrow Volume
Updated 2024-10-31
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 stablecoins AS (
SELECT LOWER(address) AS address
FROM (
VALUES
('0xd586e7f844cea2f87f50152665bcbc2c279d8d70'),
('0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7'),
('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e')
) AS s(address)
),
avax_borrow AS (
SELECT
'avalanche' as chain_,
DATE_TRUNC('WEEK', b.block_timestamp) AS week_,
SUM(b.amount) AS borrow_amount
FROM avalanche.defi.ez_lending_borrows b
JOIN stablecoins s
ON b.token_address = s.address
WHERE b.block_timestamp >= '2024-01-01'
GROUP BY 1, 2
ORDER BY week_ ASC
),
near_borrow AS (
select
'near' as chain_,
date_trunc('week', block_timestamp) as week_,
sum(amount) as borrow_amount
from near.defi.ez_lending
where block_timestamp >= '2024-01-01'
and actions = 'borrow'
and amount_usd IS NOT NULL
and symbol IN ('DAI','USDt','FRAX','USDT.e','USDC','USDC.e')
group by week_
)
QueryRunArchived: QueryRun has been archived