Skip to content

Commit

Permalink
update files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason4276 committed Jan 10, 2025
1 parent 53a0326 commit 4afd070
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dbt_macros/shared/balances_subset_daily.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
with
filtered_balances as (
select
address as pool_address,
CAST(address AS varchar) as pool_address,
balance as token_balance,
day as snapshot_day
from {{ source('tokens_' ~ blockchain, 'balances_daily') }}
where
token_address = {{ token_address }}
CAST(token_address AS varchar) = CAST({{ token_address }} AS varchar)
{% if is_incremental() %}
and {{ incremental_predicate('day') }}
{% else %}
and day >= DATE '{{ start_date }}' -- Modified this line
and day >= DATE '{{ start_date }}'
{% endif %}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ WITH op_pools AS (
SELECT DISTINCT
CAST(pool AS varchar) AS pool_address
FROM {{ source('curve_optimism', 'pools') }}
WHERE CAST(token AS varchar) = '0x4200000000000000000000000000000042'
WHERE CAST(token AS varchar) = '0x4200000000000000000000000042'
),

filtered_balances AS (
{{ balances_subset_daily(
blockchain='optimism',
token_address="'0x4200000000000000000000000000000042'",
token_address="'0x4200000000000000000000000042'",
start_date='2021-11-11'
) }}
)
Expand All @@ -33,5 +33,5 @@ SELECT
COALESCE(b.token_balance, 0) AS op_balance
FROM op_pools p
LEFT JOIN filtered_balances b
ON CAST(p.pool_address AS varchar) = CAST(b.pool_address AS varchar)
ON p.pool_address = b.pool_address
WHERE COALESCE(b.token_balance, 0) > 0

0 comments on commit 4afd070

Please sign in to comment.