From 4513ef938437dfdb68b138d9e39cb7c67ffecb83 Mon Sep 17 00:00:00 2001 From: Nicholas Welch Date: Wed, 22 May 2024 10:21:34 +1000 Subject: [PATCH] update constants, add gas price, add tax token --- fastlane_bot/config/constants.py | 2 ++ fastlane_bot/config/network.py | 4 ++++ fastlane_bot/helpers/txhelpers.py | 18 +++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/fastlane_bot/config/constants.py b/fastlane_bot/config/constants.py index ad855d546..af4c1ed65 100644 --- a/fastlane_bot/config/constants.py +++ b/fastlane_bot/config/constants.py @@ -16,6 +16,7 @@ "coinbase_base": 0, "fantom": 0.0003, "mantle": 0, + "telos": 0, } ETHEREUM = "ethereum" @@ -46,4 +47,5 @@ "mantle": 0, "linea": 0, "sei": 0, + "telos": 0, } diff --git a/fastlane_bot/config/network.py b/fastlane_bot/config/network.py index b8b1d1b0d..b6cf9fb8b 100644 --- a/fastlane_bot/config/network.py +++ b/fastlane_bot/config/network.py @@ -872,6 +872,10 @@ class _ConfigNetworkTelos(ConfigNetwork): # Add any exchanges unique to the chain here CHAIN_SPECIFIC_EXCHANGES = [] + TAX_TOKENS = set([ + "0x3E51e37350356B2D3ad84bD8146e48ac63E371a8", # BABYZAP + ]) + class _ConfigNetworkTenderly(ConfigNetwork): """ Fastlane bot config -- network [Ethereum Tenderly] diff --git a/fastlane_bot/helpers/txhelpers.py b/fastlane_bot/helpers/txhelpers.py index 0e5c6ee82..1e946de33 100644 --- a/fastlane_bot/helpers/txhelpers.py +++ b/fastlane_bot/helpers/txhelpers.py @@ -113,7 +113,7 @@ def validate_and_submit_transaction( if self.cfg.SUPPORTS_EIP1559: gas_cost_wei = tx["gas"] * tx["maxFeePerGas"] else: - gas_cost_wei = tx["gas"] + gas_cost_wei = tx["gas"] * tx["gasPrice"] if self.cfg.network.GAS_ORACLE_ADDRESS: gas_cost_wei += self.cfg.GAS_ORACLE_CONTRACT.caller.getL1Fee(raw_tx) @@ -129,15 +129,15 @@ def validate_and_submit_transaction( f"- Expected gain: {num_format(gas_gain_eth)} GAS token ({num_format(gas_gain_usd)} USD)\n" ) - if gas_gain_eth > gas_cost_eth: - self.cfg.logger.info(f"Sending transaction {dumps(tx, indent=4)}") - tx_hash = self.send_transaction(raw_tx) - self.cfg.logger.info(f"Waiting for transaction {tx_hash} receipt") - tx_receipt = self._wait_for_transaction_receipt(tx_hash) - self.cfg.logger.info(f"Transaction receipt: {dumps(tx_receipt, indent=4)}") - return tx_hash, tx_receipt + # if gas_gain_eth > gas_cost_eth: + self.cfg.logger.info(f"Sending transaction {dumps(tx, indent=4)}") + tx_hash = self.send_transaction(raw_tx) + self.cfg.logger.info(f"Waiting for transaction {tx_hash} receipt") + tx_receipt = self._wait_for_transaction_receipt(tx_hash) + self.cfg.logger.info(f"Transaction receipt: {dumps(tx_receipt, indent=4)}") + return tx_hash, tx_receipt - return None, None + # return None, None def check_and_approve_tokens(self, tokens: List): """