Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
barak manos authored and barakman committed May 5, 2024
1 parent 477e9cd commit 19ad399
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions fastlane_bot/helpers/routehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,10 @@ def aggregate_bancor_v3_trades(calculated_trade_instructions: List[TradeInstruct

for idx, trade in enumerate(calculated_trade_instructions):
if idx > 0:
if trade.exchange_name == "bancor_v3" and calculated_trade_instructions[
idx - 1].exchange_name == "bancor_v3":
if trade.exchange_name == calculated_trade_instructions[idx - 1].exchange_name == "bancor_v3":
trade_before = calculated_trade_instructions[idx - 1]
# This checks for a two-hop trade through BNT and combines them
if trade_before.tknout_address in "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C" and trade.tknin_address in "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C":
if trade_before.tknout_address == trade.tknin_address == trade.ConfigObj.BNT_ADDRESS:
new_trade_instruction = TradeInstruction(ConfigObj=trade.ConfigObj, cid=trade_before.cid,
amtin=trade_before.amtin, amtout=trade.amtout,
tknin=trade_before.tknin_address,
Expand Down
2 changes: 1 addition & 1 deletion fastlane_bot/tests/test_042_TestBancorV3ModeTwoHop.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test_test_trade_merge():
)
assert len(calculated_trade_instructions) == 3
# Aggregate multiple Bancor V3 trades into a single trade
calculated_trade_instructions = TxRouteHandler.aggregate_bancor_v3_trades(
calculated_trade_instructions = tx_route_handler.aggregate_bancor_v3_trades(
calculated_trade_instructions
)
assert len(calculated_trade_instructions) == 2
Expand Down

0 comments on commit 19ad399

Please sign in to comment.