azerbaijanCopy of axl_test 5
Updated 2022-12-08
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 tab1 as (
SELECT
tx_id as tx,
attribute_value as to_chain
from axelar.core.fact_msg_attributes
where attribute_key = 'destinationChain'),
tab2 as (
select
date_trunc('day', block_timestamp) as week,
case when attribute_value like '%uaxl%' THEN 'AXL'
when attribute_value like '%uusdc%' THEN 'USDC'
when attribute_value like '%ibc/6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F%' THEN 'UST'
when attribute_value like '%ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E%' THEN 'ATOM'
when attribute_value like '%weth-wei%' THEN 'ETH'
when attribute_value like '%ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8%' THEN 'LUNA'
when attribute_value like '%wbtc-satoshi%' THEN 'WBTC'
ELSE 'Other' END as axl_symbol,
to_chain,
count(DISTINCT tx_id) as events,
sum(
case when attribute_value like '%uaxl%' THEN cast(REPLACE(attribute_value, 'uaxl', '') as INT) / power(10, 6)
when attribute_value like '%uusdc%' THEN cast(REPLACE(attribute_value, 'uusdc', '') as INT) / power(10, 6)
when attribute_value like '%ibc/6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F%' THEN cast(REPLACE(attribute_value, 'ibc/6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F', '') as INT) / power(10, 6)
when attribute_value like '%ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E%' THEN cast(REPLACE(attribute_value, 'ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E', '') as INT) / power(10, 6)
when attribute_value like '%weth-wei%' THEN cast(REPLACE(attribute_value, 'weth-wei', '') as INT) / power(10, 18)
when attribute_value like '%ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8%' THEN cast(REPLACE(attribute_value, 'ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8', '') as INT) / power(10, 6)
when attribute_value like '%wbtc-satoshi%' THEN cast(REPLACE(attribute_value, 'wbtc-satoshi', '') as INT) / power(10, 9) END
) as toke_amt
from axelar.core.fact_msg_attributes
LEFT outer JOIN tab1
ON tx = tx_id
where msg_type like 'coin_spent'
AND attribute_index = 1
AND not to_chain is NULL
GROUP BY 1,2,3
), tab3 as (
Run a query to Download Data