Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-snx committed Oct 14, 2024
1 parent dc22efc commit 201d8e6
Show file tree
Hide file tree
Showing 19 changed files with 138 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ with delegated as (
block_timestamp,
account_id,
'Delegated' as account_action
from {{ ref('core_delegation_updated_arbitrum_mainnet') }} as core
from {{ ref('core_delegation_updated_arbitrum_mainnet') }}
),

withdrawn as (
select
block_timestamp,
account_id,
'Withdrawn' as account_action
from {{ ref('core_withdrawn_arbitrum_mainnet') }} as core
from {{ ref('core_withdrawn_arbitrum_mainnet') }}
),

claimed as (
select
block_timestamp,
account_id,
'Claimed' as account_action
from {{ ref('core_rewards_claimed_arbitrum_mainnet') }} as core
from {{ ref('core_rewards_claimed_arbitrum_mainnet') }}
),

combined as (
Expand All @@ -39,4 +39,4 @@ select
block_timestamp,
account_action,
account_id
from combined
from combined
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,45 @@ with delegation_updated as (
block_timestamp,
account_id,
amount
from {{ ref('core_delegation_updated_arbitrum_mainnet') }} as core
from {{ ref('core_delegation_updated_arbitrum_mainnet') }}
),

dim as (
select
d.date,
accounts.account_id
select
d.block_date,
accounts_unique.account_id
from (
select
select
generate_series(
date_trunc('day', date('2023-12-15')),
date_trunc('day', current_date), '1 day'::interval
) as date
) as block_date
) as d
cross join (
select distinct account_id from delegation_updated
) as accounts
) as accounts_unique
),

stakers as (
select
date,
select
dim.block_date,
dim.account_id,
case when coalesce(last(amount) over (
partition by dim.account_id
order by date
rows between unbounded preceding and current row
), 0) = 0 then 0 else 1 end as is_staking
case
when coalesce(last(delegation_updated.amount) over (
partition by dim.account_id
order by dim.block_date
rows between unbounded preceding and current row
), 0) = 0 then 0
else 1
end as is_staking
from dim
left join delegation_updated
on dim.date = date(delegation_updated.block_timestamp)
left join delegation_updated on
dim.block_date = date(delegation_updated.block_timestamp)
and dim.account_id = delegation_updated.account_id
)

select
date,
block_date,
sum(is_staking) as nof_stakers_daily
from stakers
group by date
group by block_date
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ models:
- name: fct_core_active_stakers_daily_arbitrum_mainnet
description: "Daily number of active stakers"
columns:
- name: date
- name: block_date
description: "Date"
data_type: date
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
tags = ["perp", "account_activity", "arbitrum", "mainnet"]
) }}

select
select
block_timestamp,
account_id
from {{ ref('perp_order_settled_arbitrum_mainnet') }}
from {{ ref('perp_order_settled_arbitrum_mainnet') }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ with delegated as (
block_timestamp,
account_id,
'Delegated' as account_action
from {{ ref('core_delegation_updated_arbitrum_sepolia') }} as core
from {{ ref('core_delegation_updated_arbitrum_sepolia') }}
),

withdrawn as (
select
block_timestamp,
account_id,
'Withdrawn' as account_action
from {{ ref('core_withdrawn_arbitrum_sepolia') }} as core
from {{ ref('core_withdrawn_arbitrum_sepolia') }}
),

claimed as (
select
block_timestamp,
account_id,
'Claimed' as account_action
from {{ ref('core_rewards_claimed_arbitrum_sepolia') }} as core
from {{ ref('core_rewards_claimed_arbitrum_sepolia') }}
),

combined as (
Expand All @@ -39,4 +39,4 @@ select
block_timestamp,
account_action,
account_id
from combined
from combined
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,45 @@ with delegation_updated as (
block_timestamp,
account_id,
amount
from {{ ref('core_delegation_updated_arbitrum_sepolia') }} as core
from {{ ref('core_delegation_updated_arbitrum_sepolia') }}
),

dim as (
select
d.date,
accounts.account_id
select
d.block_date,
accounts_unique.account_id
from (
select
select
generate_series(
date_trunc('day', date('2023-12-15')),
date_trunc('day', current_date), '1 day'::interval
) as date
) as block_date
) as d
cross join (
select distinct account_id from delegation_updated
) as accounts
) as accounts_unique
),

stakers as (
select
date,
select
dim.block_date,
dim.account_id,
case when coalesce(last(amount) over (
partition by dim.account_id
order by date
rows between unbounded preceding and current row
), 0) = 0 then 0 else 1 end as is_staking
case
when coalesce(last(delegation_updated.amount) over (
partition by dim.account_id
order by dim.block_date
rows between unbounded preceding and current row
), 0) = 0 then 0
else 1
end as is_staking
from dim
left join delegation_updated
on dim.date = date(delegation_updated.block_timestamp)
left join delegation_updated on
dim.block_date = date(delegation_updated.block_timestamp)
and dim.account_id = delegation_updated.account_id
)

select
date,
block_date,
sum(is_staking) as nof_stakers_daily
from stakers
group by date
group by block_date
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ models:
- name: fct_core_active_stakers_daily_arbitrum_sepolia
description: "Daily number of active stakers"
columns:
- name: date
- name: block_date
description: "Date"
data_type: date
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
tags = ["perp", "account_activity", "arbitrum", "sepolia"]
) }}

select
select
block_timestamp,
account_id
from {{ ref('perp_order_settled_arbitrum_sepolia') }}
from {{ ref('perp_order_settled_arbitrum_sepolia') }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ with delegated as (
block_timestamp,
account_id,
'Delegated' as account_action
from {{ ref('core_delegation_updated_base_mainnet') }} as core
from {{ ref('core_delegation_updated_base_mainnet') }}
),

withdrawn as (
select
block_timestamp,
account_id,
'Withdrawn' as account_action
from {{ ref('core_withdrawn_base_mainnet') }} as core
from {{ ref('core_withdrawn_base_mainnet') }}
),

claimed as (
select
block_timestamp,
account_id,
'Claimed' as account_action
from {{ ref('core_rewards_claimed_base_mainnet') }} as core
from {{ ref('core_rewards_claimed_base_mainnet') }}
),

combined as (
Expand All @@ -39,4 +39,4 @@ select
block_timestamp,
account_action,
account_id
from combined
from combined
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,45 @@ with delegation_updated as (
block_timestamp,
account_id,
amount
from {{ ref('core_delegation_updated_base_mainnet') }} as core
from {{ ref('core_delegation_updated_base_mainnet') }}
),

dim as (
select
d.date,
accounts.account_id
select
d.block_date,
accounts_unique.account_id
from (
select
select
generate_series(
date_trunc('day', date('2023-12-15')),
date_trunc('day', current_date), '1 day'::interval
) as date
) as block_date
) as d
cross join (
select distinct account_id from delegation_updated
) as accounts
) as accounts_unique
),

stakers as (
select
date,
select
dim.block_date,
dim.account_id,
case when coalesce(last(amount) over (
partition by dim.account_id
order by date
rows between unbounded preceding and current row
), 0) = 0 then 0 else 1 end as is_staking
case
when coalesce(last(delegation_updated.amount) over (
partition by dim.account_id
order by dim.block_date
rows between unbounded preceding and current row
), 0) = 0 then 0
else 1
end as is_staking
from dim
left join delegation_updated
on dim.date = date(delegation_updated.block_timestamp)
left join delegation_updated on
dim.block_date = date(delegation_updated.block_timestamp)
and dim.account_id = delegation_updated.account_id
)

select
date,
block_date,
sum(is_staking) as nof_stakers_daily
from stakers
group by date
group by block_date
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ models:
- name: fct_core_active_stakers_daily_base_mainnet
description: "Daily number of active stakers"
columns:
- name: date
- name: block_date
description: "Date"
data_type: date
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
tags = ["perp", "account_activity", "base", "mainnet"]
) }}

select
select
block_timestamp,
account_id
from {{ ref('perp_order_settled_base_mainnet') }}
from {{ ref('perp_order_settled_base_mainnet') }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ with delegated as (
block_timestamp,
account_id,
'Delegated' as account_action
from {{ ref('core_delegation_updated_base_sepolia') }} as core
from {{ ref('core_delegation_updated_base_sepolia') }}
),

withdrawn as (
select
block_timestamp,
account_id,
'Withdrawn' as account_action
from {{ ref('core_withdrawn_base_sepolia') }} as core
from {{ ref('core_withdrawn_base_sepolia') }}
),

claimed as (
select
block_timestamp,
account_id,
'Claimed' as account_action
from {{ ref('core_rewards_claimed_base_sepolia') }} as core
from {{ ref('core_rewards_claimed_base_sepolia') }}
),

combined as (
Expand All @@ -39,4 +39,4 @@ select
block_timestamp,
account_action,
account_id
from combined
from combined
Loading

0 comments on commit 201d8e6

Please sign in to comment.