boomer77Top 5 terraswap last 24h
Updated 2021-08-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 terraswap as (
select distinct address, address_name, balance, balance_type, balance_usd from terra.daily_balances
where address_name like '%Terraswap %'
and date = CURRENT_DATE
and balance > 0
),
price as (
select symbol , currency, avg(price_usd) as price_usd, date_trunc('day', block_timestamp) as blockday_price
from terra.oracle_prices
group by 1,2,4
),
msg as (
select distinct tx_id, date_trunc('day', block_timestamp) as blockday, msg_value
from terra.msgs
where tx_status != 'FAILED'
and msg_value:execute_msg like '%swap%'
),
swap as (
select msg_value:coins[0]:amount/1e6 as swapin_amount,
msg_value:coins[0]:denom::string as swapin_token,
msg_value:contract::string as contract,
address_name as pairs,
msg_value:sender::string as trader,
blockday
from msg m
left join terraswap ter on
m.msg_value:contract = ter.address
),
final_swap as (
select swapin_amount, price_usd,(swapin_amount * price_usd) as volume_swap, swapin_token, contract, pairs,
case when contract = 'terra19pg6d7rrndg4z4t0jhcd7z9nhl3p5ygqttxjll' then 'Terraswap STT - UST pair'
Run a query to Download Data