Skip to content

Commit

Permalink
cleanup taker param, move column alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-dude committed Jan 24, 2025
1 parent 75bc302 commit 355ac53
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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
Expand Down

0 comments on commit 355ac53

Please sign in to comment.