yasminDESTINATION_CHAIN
Updated 2024-03-13
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
›
⌄
-- SELECT * from avalanche.defi.ez_bridge_activity LIMIT 1
WITH bridge_activity AS (
SELECT
BLOCK_TIMESTAMP,
ORIGIN_FROM_ADDRESS,
ORIGIN_TO_ADDRESS,
ORIGIN_FUNCTION_SIGNATURE,
TX_HASH,
EVENT_INDEX,
BRIDGE_ADDRESS,
EVENT_NAME,
PLATFORM,
SENDER,
RECEIVER,
DESTINATION_CHAIN,
DESTINATION_CHAIN_ID,
TOKEN_ADDRESS,
TOKEN_SYMBOL,
ROUND(AMOUNT_USD, 0) AS AMOUNT_USD_rounded
FROM
avalanche.defi.ez_bridge_activity
WHERE
BLOCK_TIMESTAMP :: date > '{{date}}'
)
SELECT
DATE_TRUNC('Day', BLOCK_TIMESTAMP) AS "date",
DESTINATION_CHAIN,
COUNT(DISTINCT TX_HASH) AS "txs",
COUNT(DISTINCT ORIGIN_FROM_ADDRESS) AS "users",
SUM(AMOUNT_USD_rounded) AS "bridge volume usd"
FROM
bridge_activity
GROUP BY 1,2