adambalaState of the Art
Updated 2022-03-14
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 base as (select *,
date_trunc('day', block_timestamp) as day,
msg_value:execute_msg:add_balance:amount/1e6 as amount_luna
from terra.msgs
where --tx_id = '0E2A3FE2E39A7882AE82F30651F794EE0F2D34661BECC87B14896E0169E2C226'
msg_value:contract = 'terra1fj44gmt0rtphu623zxge7u3t85qy0jg6p5ucnk'
and amount_luna is not null
order by amount_luna DESC),
price as (select date_trunc('day', block_timestamp) as day,
avg(price_usd) as luna_price
from terra.oracle_prices
where symbol ilike 'LUNA'
group by 1),
table1 as (select
tx_id,
amount_luna * luna_price as amount_usd
from base a
join price b
on a.day = b.day),
table2 as (select a.tx_id,
msg_value:execute_msg:execute_order:order_id as order_id
from table1 a
join terra.msgs b
on a.tx_id = b.tx_id
where order_id is not null),
table3 as (select a.tx_id,
a.order_id,
b.msg_value:execute_msg:post_sell_order:nft_contract_address as nft_contract_address,
case
WHEN nft_contract_address = 'terra1sux7jjk9vfd0q6z0l99wpg07yd0wme0ac9le40' THEN 'The Crunks'
WHEN nft_contract_address = 'terra1934kn7p03ns94htl75zpzsg0n4yvw8yf2746ep' THEN 'Styllar'
WHEN nft_contract_address = 'terra1wcdapxh8030czdketyfemsa7lndsmpmk2e76l5' THEN 'WagmiKongz'
Run a query to Download Data