diff --git a/fastlane_bot/events/interface.py b/fastlane_bot/events/interface.py index 2ac06c39c..3ded75c26 100644 --- a/fastlane_bot/events/interface.py +++ b/fastlane_bot/events/interface.py @@ -14,7 +14,6 @@ @dataclass class Token: - __VERSION__ = "0.0.1" __DATE__ = "2023-07-03" @@ -32,7 +31,6 @@ def __hash__(self): @dataclass class Pool(PoolAndTokens): - __VERSION__ = "0.0.1" __DATE__ = "2023-07-03" @@ -56,6 +54,7 @@ class QueryInterface: uniswap_v2_event_mappings: Dict[str, str] = field(default_factory=dict) uniswap_v3_event_mappings: Dict[str, str] = field(default_factory=dict) exchanges: List[str] = field(default_factory=list) + @property def cfg(self) -> Config: return self.ConfigObj @@ -124,7 +123,6 @@ def has_balance(self, pool: Dict[str, Any], keys: List[str]) -> bool: return True return False - def get_tokens_from_exchange(self, exchange_name: str) -> List[str]: """ This token gets all tokens that exist in pools on the specified exchange. @@ -173,11 +171,15 @@ def filter_pools(self, exchange_name: str, keys: List[str] = "") -> List[Dict[st pool for pool in self.state if pool["exchange_name"] == exchange_name - and self.has_balance(pool, keys) + and self.has_balance(pool, keys) + and pool['tkn0_decimals'] is not None + and pool['tkn1_decimals'] is not None ] else: return [ pool for pool in self.state if pool["exchange_name"] == exchange_name + and pool['tkn0_decimals'] is not None + and pool['tkn1_decimals'] is not None ] def log_pool_numbers(self, pools: List[Dict[str, Any]], exchange_name: str) -> None: @@ -260,10 +262,10 @@ def remove_unmapped_uniswap_v2_pools(self) -> None: pool for pool in self.state if pool["exchange_name"] != "uniswap_v2" - or ( - pool["exchange_name"] in self.cfg.UNI_V2_FORKS - and pool["address"] in self.uniswap_v2_event_mappings - ) + or ( + pool["exchange_name"] in self.cfg.UNI_V2_FORKS + and pool["address"] in self.uniswap_v2_event_mappings + ) ] self.cfg.logger.info( f"Removed {len(initial_state) - len(self.state)} unmapped uniswap_v2/sushi pools. {len(self.state)} uniswap_v2/sushi pools remaining" @@ -279,10 +281,10 @@ def remove_unmapped_uniswap_v3_pools(self) -> None: pool for pool in self.state if pool["exchange_name"] != "uniswap_v3" - or ( - pool["exchange_name"] in self.cfg.UNI_V3_FORKS - and pool["address"] in self.uniswap_v3_event_mappings - ) + or ( + pool["exchange_name"] in self.cfg.UNI_V3_FORKS + and pool["address"] in self.uniswap_v3_event_mappings + ) ] self.cfg.logger.info( f"Removed {len(initial_state) - len(self.state)} unmapped uniswap_v2/sushi pools. {len(self.state)} uniswap_v2/sushi pools remaining" @@ -297,7 +299,7 @@ def log_umapped_pools_by_exchange(self, initial_state): # uniswap_v3_unmapped = [ # pool for pool in unmapped_pools if pool["exchange_name"] == "uniswap_v3" # ] - #self.log_pool_numbers(uniswap_v3_unmapped, "uniswap_v3") + # self.log_pool_numbers(uniswap_v3_unmapped, "uniswap_v3") uniswap_v2_unmapped = [ pool for pool in unmapped_pools if pool["exchange_name"] == "uniswap_v2" ] @@ -307,9 +309,6 @@ def log_umapped_pools_by_exchange(self, initial_state): ] self.log_pool_numbers(sushiswap_v2_unmapped, "sushiswap_v2") - - - def remove_faulty_token_pools(self) -> None: """ Remove pools with faulty tokens