CryptoIcicleUntitled Query
Updated 2023-02-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
›
⌄
-- Background: With the launch of Squid, Axelar’s General Message Passing functionality has entered the spotlight.
-- The future is now – safe, secure cross-chain contract calls with tokens, enabling multi-step swaps with the click of a single button.
-- However, GMP transfer volumes are not currently captured in Axelar’s token transfer volume reporting.
with
prices as (
select
date_trunc('day',recorded_at) as date,
lower(symbol) as symbol,
avg(price) as price_usd
from osmosis.core.dim_prices
where recorded_at >= CURRENT_DATE - {{n_days}}
group by 1,2
),
txns as (
select
regexp_substr(sender,'[a-zA-Z]+|\d+') as sender_chain,
regexp_substr(receiver,'[a-zA-Z]+|\d+') as receiver_chain,
concat(sender_chain,'-->',receiver_chain) as transfer_path,
lower(split(currency,'-')[0]) as symbol,
iff(symbol ilike 'u%', substring(symbol, 2, LEN(symbol)), symbol) as sym,
iff(transfer_type = 'IBC_TRANSFER_IN', 'bridge_in', 'bridge_out') as router,
t.*
from axelar.core.fact_transfers t
where transfer_type in ('IBC_TRANSFER_IN', 'IBC_TRANSFER_OUT')
and block_timestamp >= CURRENT_DATE - {{n_days}}
and sender_chain <> receiver_chain
and decimal is not null
),
p_txns as (
select
p.price_usd,
(amount/pow(10,decimal)) * p.price_usd as token_amount_usd,
t.*
from txns t
join prices p on t.block_timestamp::date = p.date and p.symbol = t.sym
Run a query to Download Data