Skip to content

Commit

Permalink
Retry arb transaction as long as it throws "max fee per gas less than…
Browse files Browse the repository at this point in the history
… block base fee"
  • Loading branch information
barak manos committed Jun 10, 2024
1 parent da55923 commit fe385fa
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions fastlane_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,19 @@ def _handle_trade_instructions(
)

# Validate and submit the transaction
tx_hash, tx_receipt = self.tx_helpers.validate_and_submit_transaction(
route_struct=route_struct_processed,
src_amt=flashloan_amount_wei,
src_address=fl_token,
expected_profit_gastkn=best_profit_gastkn,
expected_profit_usd=best_profit_usd,
flashloan_struct=flashloan_struct,
)

return tx_hash, tx_receipt
while True:
try:
tx_hash, tx_receipt = self.tx_helpers.validate_and_submit_transaction(
route_struct=route_struct_processed,
src_amt=flashloan_amount_wei,
src_address=fl_token,
expected_profit_gastkn=best_profit_gastkn,
expected_profit_usd=best_profit_usd,
flashloan_struct=flashloan_struct,
)
return tx_hash, tx_receipt
except Exception as e:
if "max fee per gas less than block base fee" in str(e):
self.ConfigObj.logger.error(f"{e}; retrying...")
else:
raise

0 comments on commit fe385fa

Please sign in to comment.