Afonso_Diaz2023-10-24 09:04 PM
Updated 2023-10-24
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
t1 as (
select distinct tx_id
from sei.core.fact_msg_attributes
where attribute_key = '_contract_address'
and msg_type = 'wasm-execute-exchange'
and attribute_value = 'sei1pdwlx9h8nc3fp6073mweug654wfkxjaelgkum0a9wtsktwuydw5sduczvz'
and tx_succeeded = 1
),
t2 as (
select
tx_id,
a.block_timestamp,
a.attribute_value / 1e6 as amount_sei,
b.attribute_value as seller,
c.tx_from as buyer,
(replace(fee, 'usei') / 1e6)::float as fee_sei
from sei.core.fact_msg_attributes a
join sei.core.fact_msg_attributes b
using(tx_id, block_timestamp)
join sei.core.fact_transactions c
using(tx_id, block_timestamp)
where a.attribute_key = 'exchange-token-amount'
and a.msg_type = 'wasm-accept-request'
and b.attribute_key = 'seller'
and b.msg_type = 'wasm-accept-request'
and b.msg_index = 12
and tx_id in (select distinct tx_id from t1)
),
t3 as (
select
seller as user,
count(distinct tx_id) as transactions
Run a query to Download Data