Skip to content

Commit

Permalink
Revert "Add pancakeswapx on arbitrum to dex trades (#7428)"
Browse files Browse the repository at this point in the history
This reverts commit 3e264a4.
  • Loading branch information
jeff-dude committed Jan 9, 2025
1 parent d4ca1d6 commit 7494eda
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 85 deletions.
1 change: 0 additions & 1 deletion dbt_subprojects/dex/models/trades/arbitrum/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ models:
version:
- 2
- stableswap
- pcsx

- name: balancer_v2_arbitrum_base_trades
meta:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dexs_macro AS (
}}
),

dexs_ss AS (
dexs AS (
-- PancakeSwap v2 stableswap
SELECT
'stableswap' AS version,
Expand All @@ -46,47 +46,8 @@ dexs_ss AS (
{% if is_incremental() %}
WHERE {{ incremental_predicate('t.evt_block_time') }}
{% endif %}
),

transfer as (
select * from {{ source('tokens', 'transfers') }}
where blockchain = 'arbitrum'
and block_date >= date '2024-08-01'
and tx_hash in (select evt_tx_hash from {{ source('pancakeswap_arbitrum', 'ExclusiveDutchOrderReactor_evt_Fill') }})
{% if is_incremental() %}
and {{ incremental_predicate('block_time') }}
{% endif %}
),

dexs_pcsx AS (
-- PancakeSwapX
SELECT
'pcsx' AS version,
a.evt_block_number AS block_number,
a.evt_block_time AS block_time,
a.swapper AS taker,
a.filler AS maker,
receive.amount_raw AS token_bought_amount_raw,
send.amount_raw AS token_sold_amount_raw,
receive.contract_address AS token_bought_address,
send.contract_address AS token_sold_address,
a.contract_address AS project_contract_address,
a.evt_tx_hash AS tx_hash,
a.evt_index

FROM {{ source('pancakeswap_arbitrum', 'ExclusiveDutchOrderReactor_evt_Fill') }} a

LEFT JOIN transfer AS send
ON a.evt_tx_hash = send.tx_hash AND a.swapper = send."from"

LEFT JOIN transfer AS receive
on a.evt_tx_hash = receive.tx_hash AND a.swapper = receive."to"
{% if is_incremental() %}
WHERE {{ incremental_predicate('a.evt_block_time') }}
{% endif %}
)


SELECT
dexs_macro.blockchain,
dexs_macro.project,
Expand All @@ -109,39 +70,18 @@ UNION ALL
SELECT
'arbitrum' AS blockchain,
'pancakeswap' AS project,
dexs_ss.version,
CAST(date_trunc('month', dexs_ss.block_time) AS date) AS block_month,
CAST(date_trunc('day', dexs_ss.block_time) AS date) AS block_date,
dexs_ss.block_time,
dexs_ss.block_number,
dexs_ss.token_bought_amount_raw,
dexs_ss.token_sold_amount_raw,
dexs_ss.token_bought_address,
dexs_ss.token_sold_address,
dexs_ss.taker,
dexs_ss.maker,
dexs_ss.project_contract_address,
dexs_ss.tx_hash,
dexs_ss.evt_index
FROM dexs_ss
UNION ALL
SELECT
'arbitrum' AS blockchain,
'pancakeswap' AS project,
dexs_pcsx.version,
CAST(date_trunc('month', dexs_pcsx.block_time) AS date) AS block_month,
CAST(date_trunc('day', dexs_pcsx.block_time) AS date) AS block_date,
dexs_pcsx.block_time,
dexs_pcsx.block_number,
dexs_pcsx.token_bought_amount_raw,
dexs_pcsx.token_sold_amount_raw,
dexs_pcsx.token_bought_address,
dexs_pcsx.token_sold_address,
dexs_pcsx.taker,
dexs_pcsx.maker,
dexs_pcsx.project_contract_address,
dexs_pcsx.tx_hash,
dexs_pcsx.evt_index
FROM dexs_pcsx
WHERE token_sold_amount_raw > 0
AND token_bought_amount_raw > 0
dexs.version,
CAST(date_trunc('month', dexs.block_time) AS date) AS block_month,
CAST(date_trunc('day', dexs.block_time) AS date) AS block_date,
dexs.block_time,
dexs.block_number,
dexs.token_bought_amount_raw,
dexs.token_sold_amount_raw,
dexs.token_bought_address,
dexs.token_sold_address,
dexs.taker,
dexs.maker,
dexs.project_contract_address,
dexs.tx_hash,
dexs.evt_index
FROM dexs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ arbitrum,pancakeswap,2,2023-08-10,0x1958fe5d2b768dff806749c4d029be07fd5a0e182d4d
arbitrum,pancakeswap,2,2023-08-10,0xb9cda996210e763e0edaa5489a276e96f4db35161b15b95407f95cfd4a8e2c79,10,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,120059612,221946,125732913697032
arbitrum,pancakeswap,stableswap,2024-04-01,0x2cf8caf24b570525f082d3654ea210877f7900abb1ec86c463ae70983b6aaee5,26,0xb688ba096b7bb75d7841e47163cd12d18b36a5bf,0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8,196473076,406168916530447950398,296449467065124408277
arbitrum,pancakeswap,stableswap,2024-04-02,0xbf75e0478b82c5748c534f9f2269016bd818d0b404324cb0a03a5f12f61230cb,12,0xb688ba096b7bb75d7841e47163cd12d18b36a5bf,0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8,196871367,401013690539420465823,288005566501605715147
arbitrum,pancakeswap,pcsx,2024-11-05,0xf4451dd2b05bac1c1e0734e06054ebe4433d5880e34f8d43f09b1eeccc27c6c5,7,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0xaf88d065e77c8cc2239327c5edb3a432268e5831,271321857,806896487382198674,2000000000
arbitrum,pancakeswap,pcsx,2024-11-05,0x42e4d0b12f4da75dda589127573e03f1cf56526a92bd441c9311f1c4b3a1627c,24,0xaf88d065e77c8cc2239327c5edb3a432268e5831,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,271324628,88451496,35878939559819662
arbitrum,pancakeswap,pcsx,2024-11-05,0x99b2f309f7e1238dd01cf523e1859c859fe59079d106108ac98175d1d5d7a1aa,49,0xaf88d065e77c8cc2239327c5edb3a432268e5831,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,271327750,3895840552,3900000000
9 changes: 4 additions & 5 deletions sources/_sector/dex/trades/arbitrum/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@ sources:
- name: LBFactory_evt_LBPairCreated
- name: trader_joe_v2_1_arbitrum
- name: trader_joe_arbitrum
- name: pancakeswap_arbitrum
tables:
- name: ExclusiveDutchOrderReactor_evt_Fill
- name: pancakeswap_v2_arbitrum
tables:
- name: PancakePair_evt_Swap
- name: PancakeFactory_evt_PairCreated
- name: PancakeStableSwapTwoPool_evt_TokenExchange
- name: PancakeStableSwapFactory_evt_NewStableSwapPair
- name: pancakeswap_v3_arbitrum
tables:
- name: PancakeV3Pool_evt_Swap
- name: PancakeV3Factory_evt_PoolCreated
- name: pancakeswap_v2_arbitrum
tables:
- name: PancakeStableSwapTwoPool_evt_TokenExchange
- name: PancakeStableSwapFactory_evt_NewStableSwapPair
- name: balancer_v2_arbitrum
tables:
- name: Vault_evt_Swap
Expand Down

0 comments on commit 7494eda

Please sign in to comment.