with tb as (
select block_timestamp::date as date,
day_of_week_name,
attribute_key,
count(tx_id) as tx_count,
sum(to_number(replace(attribute_value,'ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4',''))/pow(10,6)) as stars_amount
from osmosis.core.fact_msg_attributes join flipside_prod_db.ethereum_core.dim_dates on block_timestamp::date = date_day
where attribute_value ilike '%ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4%'
and msg_type ilike ('%swap%')
and BLOCK_TIMESTAMP::date >= '2022-03-20'
and to_number(replace(attribute_value,'ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4',''))/pow(10,6) > 0
group by 1, 2, 3
) select * from tb