SELECT
avg(trasfer),
max(trasfer),
median(trasfer)
FROM (
select
date_trunc('day', block_timestamp) as day,
count(*) as trasfer
from axelar.core.fact_msg_attributes
LEFT outer JOIN (
SELECT
tx_id as tx,
attribute_value as to_chain
FROM axelar.core.fact_msg_attributes
WHERE attribute_key LIKE 'destinationChain'
)
ON tx = tx_id
WHERE msg_type LIKE 'coin_spent'
AND attribute_index = 1
AND to_chain like 'osmosis'
GROUP BY 1
)