picasoTotal
Updated 2025-02-09Copy Reference Fork
999
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 Borrow_events AS (
SELECT
BLOCK_TIMESTAMP,
TX_HASH,
EVENT_INDEX,
CONTRACT_ADDRESS,
ORIGIN_FROM_ADDRESS,
ORIGIN_TO_ADDRESS,
ORIGIN_FUNCTION_SIGNATURE,
TX_SUCCEEDED,
EVENT_NAME,
FULL_DECODED_LOG,
DECODED_LOG:sender::TEXT AS sender,
(DECODED_LOG:assets::NUMERIC) / 1e18 AS value_in_ether, -- Converting to Ether (ETH)
CONTRACT_NAME,
DATE(BLOCK_TIMESTAMP) AS Borrow_date
FROM
swell.core.ez_decoded_event_logs
WHERE
EVENT_NAME = 'Borrow'
AND ORIGIN_FUNCTION_SIGNATURE = '0xc16ae7a4'
),
-- Daily Borrow Transactions
Daily_Borrow_Transactions AS (
SELECT
Borrow_date AS daily_Borrow_date,
CONTRACT_NAME AS vault_name,
COUNT(DISTINCT TX_HASH) AS daily_Borrow_transactions
FROM
Borrow_events
GROUP BY
Borrow_date, CONTRACT_NAME
),
-- Daily Borrow Value
QueryRunArchived: QueryRun has been archived