binhachon3. [Medium] Transaction Fees Per Asset - Time series
Updated 2021-11-22
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 mAsset_contracts as(
select
address,
substr(address_name, 11) as address_name
from
terra.labels
where
substr(address_name, 1, 11) = 'Terraswap m'
),
mAsset_transactions as(
-- swap UST for other asset
select
block_timestamp,
tx_id,
event_attributes : "0_contract_address" :: string as address,
event_attributes : offer_amount :: float / 1e6 as UST_amount,
event_attributes : return_amount :: float / 1e6 as masset_amount
from
terra.msg_events
where
event_type = 'from_contract'
and tx_status = 'SUCCEEDED'
and event_attributes : "0_contract_address" :: string in (
select
address
from
mAsset_contracts
)
and event_attributes : "0_action" :: string = 'swap'
and event_attributes : offer_asset :: string = 'uusd'
union all
-- swap other asset for UST
select
block_timestamp,
tx_id,
event_attributes : "1_contract_address" :: string as address,
Run a query to Download Data