From 355ac531700cd884f9c8b7b15bc0dbf553e70c56 Mon Sep 17 00:00:00 2001 From: jeff-dude Date: Fri, 24 Jan 2025 14:15:27 -0500 Subject: [PATCH] cleanup taker param, move column alias --- .../macros/models/_project/uniswap_compatible_trades.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dbt_subprojects/dex/macros/models/_project/uniswap_compatible_trades.sql b/dbt_subprojects/dex/macros/models/_project/uniswap_compatible_trades.sql index 717c99553ae..dde889bf3d8 100644 --- a/dbt_subprojects/dex/macros/models/_project/uniswap_compatible_trades.sql +++ b/dbt_subprojects/dex/macros/models/_project/uniswap_compatible_trades.sql @@ -126,7 +126,7 @@ FROM , version = '4' , PoolManager_evt_Swap = null , PoolManager_evt_Initialize = null - , taker_column_name = 't.evt_tx_from' + , taker_column_name = 'evt_tx_from' , maker_column_name = null , swap_optional_columns = ['fee'] , initialize_optional_columns = ['hooks'] @@ -138,8 +138,8 @@ WITH dexs AS SELECT t.evt_block_number AS block_number , t.evt_block_time AS block_time - , {{ taker_column_name }} as taker - , {% if maker_column_name -%} {{ maker_column_name }} {% else -%} cast(null as varbinary) {% endif -%} as maker + , t.{{ taker_column_name }} as taker + , {% if maker_column_name -%} t.{{ maker_column_name }} {% else -%} cast(null as varbinary) {% endif -%} as maker -- in v4, when amount is negative, then user are selling the token (so things are done from the perspective of the user instead of the pool) , CASE WHEN t.amount0 < INT256 '0' THEN abs(t.amount1) ELSE abs(t.amount0) END AS token_bought_amount_raw , CASE WHEN t.amount0 < INT256 '0' THEN abs(t.amount0) ELSE abs(t.amount1) END AS token_sold_amount_raw