rmasDASH - YTD Monthly USDT Usage
Updated 2023-06-11Copy 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
-- Mint, burn, and transfer events for bridged USDT
bridged_usdt_events AS (
WITH
mints AS (
SELECT fc.tx_hash
, fc.block_timestamp
, fc.method_name
, 'system' AS sender_id
, fc.args['account_id']::string AS receiver_id
, try_cast(fc.args['amount']::string as bigint) / 1e6 AS amount
, fc.receiver_id AS token_contract
FROM near.core.fact_actions_events_function_call AS fc
WHERE fc.receiver_id = 'dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near'
AND fc.method_name = 'mint'
-- Exclude failed TXs
AND fc.tx_hash NOT IN ( SELECT tx_hash
FROM near.core.fact_transactions
WHERE tx_status = 'Fail' )
-- Dashboard date filter
AND fc.block_timestamp BETWEEN '2023-01-01 00:00:00.000'
AND '2023-06-09 23:59:59.999'
),
burns AS (
SELECT fc.tx_hash
, fc.block_timestamp
, fc.method_name
, r.actions:predecessor_id::string AS sender_id
, 'system' AS receiver_id
Run a query to Download Data