Skip to content

Commit

Permalink
improvement for balancer erc4626 tokens (#7595)
Browse files Browse the repository at this point in the history
Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com>
  • Loading branch information
viniabussafi and jeff-dude authored Feb 3, 2025
1 parent 7778dff commit cea35f9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ FROM {{ source('metamorpho_factory_ethereum', 'MetaMorphoV1_1Factory_evt_CreateM
JOIN {{ source('tokens', 'erc20') }} t
ON t.blockchain = 'ethereum'
AND a.asset = t.contract_address
AND a.metaMorpho != 0xbeefc011e94f43b8b7b455ebab290c7ab4e216f1

UNION

SELECT
erc4626_token,
erc4626_token_name,
erc4626_token_symbol,
underlying_token,
underlying_token_symbol,
decimals
FROM (VALUES
(0xbeefc011e94f43b8b7b455ebab290c7ab4e216f1, 'Coinshift USDL', 'csUDL', 0xbdC7c08592Ee4aa51D06C27Ee23D5087D65aDbcD, 'USDL', 18)
) AS temp_table (erc4626_token, erc4626_token_name, erc4626_token_symbol, underlying_token, underlying_token_symbol, decimals)
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ WITH wrap_unwrap AS(
m.erc4626_token_symbol,
m.underlying_token_symbol,
m.decimals,
ratio * price AS adjusted_price
ratio * price * POWER(10, (m.decimals - p.decimals)) AS adjusted_price
FROM wrap_unwrap w
JOIN {{ref('balancer_v3_ethereum_erc4626_token_mapping')}} m ON m.erc4626_token = w.wrappedToken
JOIN {{ source('prices', 'usd') }} p ON m.underlying_token = p.contract_address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ WITH wrap_unwrap AS(
m.erc4626_token_symbol,
m.underlying_token_symbol,
m.decimals,
ratio * price AS adjusted_price
ratio * price * POWER(10, (m.decimals - p.decimals)) AS adjusted_price
FROM wrap_unwrap w
JOIN {{ref('balancer_v3_gnosis_erc4626_token_mapping')}} m ON m.erc4626_token = w.wrappedToken
JOIN {{ source('prices', 'usd') }} p ON m.underlying_token = p.contract_address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ WITH wrap_unwrap AS(
m.erc4626_token_symbol,
m.underlying_token_symbol,
m.decimals,
ratio * price AS adjusted_price
ratio * price * POWER(10, (m.decimals - p.decimals)) AS adjusted_price
FROM wrap_unwrap w
JOIN {{ref('balancer_v3_sonic_erc4626_token_mapping')}} m ON m.erc4626_token = w.wrappedToken
JOIN {{ source('prices', 'usd') }} p ON m.underlying_token = p.contract_address
Expand Down

0 comments on commit cea35f9

Please sign in to comment.