Merge pull request #222 from flashbots/include-sandwiches-close-in-arb

Include sandwiches that close in arbs
This commit is contained in:
Luke Van Seters 2022-01-10 11:24:34 -05:00 committed by GitHub
commit 89fcf388e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,8 +28,7 @@ def _get_sandwich_starting_with_swap(
front_swap: Swap, front_swap: Swap,
rest_swaps: List[Swap], rest_swaps: List[Swap],
) -> Optional[Sandwich]: ) -> Optional[Sandwich]:
sandwicher_address = front_swap.to_address
sandwicher_address = front_swap.from_address
sandwiched_swaps = [] sandwiched_swaps = []
for other_swap in rest_swaps: for other_swap in rest_swaps:
@ -46,7 +45,10 @@ def _get_sandwich_starting_with_swap(
elif ( elif (
other_swap.token_out_address == front_swap.token_in_address other_swap.token_out_address == front_swap.token_in_address
and other_swap.token_in_address == front_swap.token_out_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: if len(sandwiched_swaps) > 0:
return Sandwich( return Sandwich(