Skip to content

Commit

Permalink
make trusted tokens source instead of ref (#7533)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRobin authored Jan 24, 2025
1 parent 87ba043 commit 8b3fdb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ select
from
{{ source('prices','usd_0003') }} as p -- todo: fix this source
inner join
{{ ref('prices_trusted_tokens') }} as ptt
{{ source('prices','trusted_tokens') }} as ptt
on p.token_id = ptt.token_id
where
1=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ WITH dex_trades_filter_and_unnest as (
d.amount_usd/d.token_bought_amount as price,
d.amount_usd as volume -- in USD
FROM {{ source('dex','trades') }} d
INNER JOIN {{ref('prices_trusted_tokens')}} t
INNER JOIN {{source('prices','trusted_tokens')}} t
on t.blockchain = d.blockchain
and t.contract_address = d.token_sold_address -- the token traded against is trusted
LEFT JOIN {{ref('prices_trusted_tokens')}} anti_t
LEFT JOIN {{source('prices','trusted_tokens')}} anti_t
on anti_t.blockchain = d.blockchain
and anti_t.contract_address = d.token_bought_address -- the subjected token is already in trusted
WHERE d.amount_usd > 0 and token_bought_amount > 0 and token_bought_address is not null
Expand All @@ -39,10 +39,10 @@ WITH dex_trades_filter_and_unnest as (
d.amount_usd/d.token_sold_amount as price,
d.amount_usd as volume -- in USD
FROM {{ source('dex','trades') }} d
INNER JOIN {{ref('prices_trusted_tokens')}} t
INNER JOIN {{source('prices','trusted_tokens')}} t
on t.blockchain = d.blockchain
and t.contract_address = d.token_bought_address -- the token traded against is trusted
LEFT JOIN {{ref('prices_trusted_tokens')}} anti_t
LEFT JOIN {{source('prices','trusted_tokens')}} anti_t
on anti_t.blockchain = d.blockchain
and anti_t.contract_address = d.token_sold_address -- the subjected token is already in trusted
WHERE d.amount_usd > 0 and token_sold_amount > 0 and token_sold_address is not null
Expand Down

0 comments on commit 8b3fdb2

Please sign in to comment.