From 2e3cd28850cc1985e43bb0efc70bbd8f8ac8892e Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Mon, 13 Nov 2023 16:29:08 +0100 Subject: [PATCH 1/4] add list of batches excluded from slippage computation (from R depeg) This adds some transaction hashes to a table of excluded batches. This is done in the Dune query and not in the python code since all computations related to slippage happen on Dune. --- queries/dune_v2/period_slippage.sql | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/queries/dune_v2/period_slippage.sql b/queries/dune_v2/period_slippage.sql index 48cb2fe3..5218490b 100644 --- a/queries/dune_v2/period_slippage.sql +++ b/queries/dune_v2/period_slippage.sql @@ -154,11 +154,23 @@ batch_meta as ( join pre_batch_transfers pbt on bm.tx_hash = pbt.tx_hash ) --- These batches involve a token AXS (Old) --- whose transfer function doesn't align with the emitted transfer event. +-- These batches are excluded from slippage accounting ,excluded_batches as ( select tx_hash from filtered_trades + -- These batches involve a token AXS (Old) + -- whose transfer function doesn't align with the emitted transfer event. where 0xf5d669627376ebd411e34b98f19c868c8aba5ada in (buy_token, sell_token) + -- Batches involving depeddeg R stable coin + or tx_hash in ( + 0x4b8b031baebd7c13652f51ab33feaec078093c992edcb23c3e9f531fa9310131, + 0x11a7b6e9591a391972ec0ba14e7f6d2cdde6b6101835fc068aa781486edbd586, + 0xab4ecb6c331c4aa54da361d189d0f8d064720d29c66ac06311875c845c444437, + 0xc7289412dd9a8de54a266d3d4763d72c8d0d465d6157ed6da4d9360df1fe5ef7, + 0x3603837611b1670f743325ab81ba2ab50b092e5a8defc8d111b554264d600cd7, + 0x27fe348aa539ed1647ceced2808b63161ed3b3bf5a46b877c247341acd74754e, + 0xd8356e52dafc2c749da8b0f2bee69736c83fae986ce3f5b14e2a8dd603c3092e, + 0xaa037b87eba06781f0699b6c021fa84d67a197502d3141c00c9e274055899118 + ) ), incoming_and_outgoing as ( SELECT From cbcc2f46ff2121490fb235dfac840498d834245f Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Mon, 13 Nov 2023 19:44:24 +0100 Subject: [PATCH 2/4] Update queries/dune_v2/period_slippage.sql Co-authored-by: Benjamin Smith --- queries/dune_v2/period_slippage.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries/dune_v2/period_slippage.sql b/queries/dune_v2/period_slippage.sql index 5218490b..6330aae1 100644 --- a/queries/dune_v2/period_slippage.sql +++ b/queries/dune_v2/period_slippage.sql @@ -160,7 +160,7 @@ batch_meta as ( -- These batches involve a token AXS (Old) -- whose transfer function doesn't align with the emitted transfer event. where 0xf5d669627376ebd411e34b98f19c868c8aba5ada in (buy_token, sell_token) - -- Batches involving depeddeg R stable coin + -- Batches involving depegged R stable coin or tx_hash in ( 0x4b8b031baebd7c13652f51ab33feaec078093c992edcb23c3e9f531fa9310131, 0x11a7b6e9591a391972ec0ba14e7f6d2cdde6b6101835fc068aa781486edbd586, From 75e814f447a467f3b7c92be983f1fe389acae82b Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Mon, 13 Nov 2023 20:22:48 +0100 Subject: [PATCH 3/4] remove hashes related to missing tokens --- queries/dune_v2/period_slippage.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/queries/dune_v2/period_slippage.sql b/queries/dune_v2/period_slippage.sql index 6330aae1..f7d5c11d 100644 --- a/queries/dune_v2/period_slippage.sql +++ b/queries/dune_v2/period_slippage.sql @@ -162,14 +162,12 @@ batch_meta as ( where 0xf5d669627376ebd411e34b98f19c868c8aba5ada in (buy_token, sell_token) -- Batches involving depegged R stable coin or tx_hash in ( - 0x4b8b031baebd7c13652f51ab33feaec078093c992edcb23c3e9f531fa9310131, 0x11a7b6e9591a391972ec0ba14e7f6d2cdde6b6101835fc068aa781486edbd586, 0xab4ecb6c331c4aa54da361d189d0f8d064720d29c66ac06311875c845c444437, 0xc7289412dd9a8de54a266d3d4763d72c8d0d465d6157ed6da4d9360df1fe5ef7, 0x3603837611b1670f743325ab81ba2ab50b092e5a8defc8d111b554264d600cd7, 0x27fe348aa539ed1647ceced2808b63161ed3b3bf5a46b877c247341acd74754e, - 0xd8356e52dafc2c749da8b0f2bee69736c83fae986ce3f5b14e2a8dd603c3092e, - 0xaa037b87eba06781f0699b6c021fa84d67a197502d3141c00c9e274055899118 + 0xd8356e52dafc2c749da8b0f2bee69736c83fae986ce3f5b14e2a8dd603c3092e ) ), incoming_and_outgoing as ( From 6095554a508289d7b26b0fe479a9a3c16cc4ceb3 Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Tue, 14 Nov 2023 00:23:29 +0100 Subject: [PATCH 4/4] remove settlement by quasilabs this was not directly related to the value of R but was just a bad suboptimal execution on its own right --- queries/dune_v2/period_slippage.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/queries/dune_v2/period_slippage.sql b/queries/dune_v2/period_slippage.sql index f7d5c11d..e306980e 100644 --- a/queries/dune_v2/period_slippage.sql +++ b/queries/dune_v2/period_slippage.sql @@ -166,7 +166,6 @@ batch_meta as ( 0xab4ecb6c331c4aa54da361d189d0f8d064720d29c66ac06311875c845c444437, 0xc7289412dd9a8de54a266d3d4763d72c8d0d465d6157ed6da4d9360df1fe5ef7, 0x3603837611b1670f743325ab81ba2ab50b092e5a8defc8d111b554264d600cd7, - 0x27fe348aa539ed1647ceced2808b63161ed3b3bf5a46b877c247341acd74754e, 0xd8356e52dafc2c749da8b0f2bee69736c83fae986ce3f5b14e2a8dd603c3092e ) ),