with first_undelegate as (
select
delegator_address as wallet,
min(block_timestamp) as first_undelegate_time,
avg(amount/1e6) as undelegate_amount
from osmosis.core.fact_staking
where tx_status = 'SUCCEEDED'
and action = 'undelegate'
and block_timestamp >= current_date - 60
group by wallet
order by first_undelegate_time
),
first_delegate as (
select
delegator_address as wallet,
min(block_timestamp) as first_delegate_time,
avg(amount/1e6) as delegate_amount
from osmosis.core.fact_staking
where tx_status = 'SUCCEEDED'
and action = 'delegate'
and block_timestamp >= current_date - 60
group by wallet
order by first_delegate_time
),
first_swap as (
select
trader as wallet,
min(block_timestamp) as first_swap_time,
avg(from_amount/1e6) as swap_amount
from osmosis.core.fact_swaps
where tx_status = 'SUCCEEDED'
and from_currency = 'uosmo'
and block_timestamp >= current_date - 60
group by wallet
order by first_swap_time
),