From 493006504514a4c975489a42613ae5a8d37576fe Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Sat, 8 Jan 2022 13:44:58 -0500 Subject: [PATCH 1/2] Include sandwiches that close in arbs --- mev_inspect/sandwiches.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mev_inspect/sandwiches.py b/mev_inspect/sandwiches.py index 8974873..7afa721 100644 --- a/mev_inspect/sandwiches.py +++ b/mev_inspect/sandwiches.py @@ -46,7 +46,10 @@ def _get_sandwich_starting_with_swap( elif ( other_swap.token_out_address == front_swap.token_in_address and other_swap.token_in_address == front_swap.token_out_address - and other_swap.to_address == sandwicher_address + and ( + other_swap.to_address == sandwicher_address + or other_swap.from_address == sandwicher_address + ) ): if len(sandwiched_swaps) > 0: return Sandwich( From 50ff7dadcdd588eafe88ca966434bb664a250de4 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Sat, 8 Jan 2022 16:15:39 -0500 Subject: [PATCH 2/2] The sandwicher should be where the swap value accumulates --- mev_inspect/sandwiches.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mev_inspect/sandwiches.py b/mev_inspect/sandwiches.py index 7afa721..30e4376 100644 --- a/mev_inspect/sandwiches.py +++ b/mev_inspect/sandwiches.py @@ -28,8 +28,7 @@ def _get_sandwich_starting_with_swap( front_swap: Swap, rest_swaps: List[Swap], ) -> Optional[Sandwich]: - - sandwicher_address = front_swap.from_address + sandwicher_address = front_swap.to_address sandwiched_swaps = [] for other_swap in rest_swaps: