Skip to content

Commit

Permalink
Add in casting to keep the same data types as old lang.
Browse files Browse the repository at this point in the history
  • Loading branch information
thetroyharris committed Aug 16, 2023
1 parent 13e6aa6 commit 00ca48a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,25 @@ SELECT
END AS token_pair,
dexs.token_bought_amount_raw / POWER(10, COALESCE(erc20a.decimals, 18)) AS token_bought_amount,
dexs.token_sold_amount_raw / POWER(10, COALESCE(erc20b.decimals, 18)) AS token_sold_amount,
CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw,
CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw,
CAST(dexs.token_bought_amount_raw AS DECIMAL(38,0)) AS token_bought_amount_raw,
CAST(dexs.token_sold_amount_raw AS DECIMAL(38,0)) AS token_sold_amount_raw,
COALESCE(
dexs.amount_usd,
dexs.token_bought_amount_raw / POWER(10, p_bought.decimals) * p_bought.price,
dexs.token_sold_amount_raw / POWER(10, p_sold.decimals) * p_sold.price,
dexs.token_bought_amount_raw / POWER(10, COALESCE(erc20a.decimals, 18)) * bpa_bpt_prices.median_price,
dexs.token_sold_amount_raw / POWER(10, COALESCE(erc20b.decimals, 18)) * bpb_bpt_prices.median_price
) AS amount_usd,
dexs.token_bought_address,
dexs.token_sold_address,
CAST(dexs.token_bought_address AS VARCHAR) AS token_bought_address,
CAST(dexs.token_sold_address AS VARCHAR) AS token_sold_address,
dexs.taker AS taker,
dexs.maker,
dexs.project_contract_address,
dexs.poolId,
CAST(dexs.project_contract_address AS VARCHAR) AS project_contract_address,
CAST(dexs.poolId AS VARCHAR) AS poolId,
dexs.swap_fee,
dexs.tx_hash,
tx."from" AS tx_from,
tx.to AS tx_to,
CAST(dexs.tx_hash AS VARCHAR) AS tx_hash,
CAST(tx."from" AS VARCHAR) AS tx_from,
CAST(tx.to AS VARCHAR) AS tx_to,
dexs.trace_address,
dexs.evt_index
FROM
Expand Down

0 comments on commit 00ca48a

Please sign in to comment.