Skip to content

Commit

Permalink
Merge pull request #668 from bancorprotocol/pool-finder-logging
Browse files Browse the repository at this point in the history
Pool finder logging
  • Loading branch information
zavelevsky authored May 22, 2024
2 parents 7f5ebd7 + 7469fe9 commit 719c406
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion fastlane_bot/pool_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from typing import List, Tuple, Dict, Any

from fastlane_bot.config import Config
from fastlane_bot.config.constants import ZERO_ADDRESS, UNISWAP_V2_NAME, UNISWAP_V3_NAME, SOLIDLY_V2_NAME
from fastlane_bot.config.multicaller import MultiCaller
from fastlane_bot.events.exchanges.base import Exchange
Expand Down Expand Up @@ -51,7 +52,7 @@ def extract_univ3_fee_tiers(self, pools: List[Dict[str, Any]]):
self._uni_v3_fee_tiers[pool["exchange_name"]].add(int(pool["fee"]))


def get_pools_for_unsupported_pairs(self, pools: List[Dict[str, Any]], arb_mode: str):
def get_pools_for_unsupported_pairs(self, config: Config, pools: List[Dict[str, Any]], arb_mode: str):
"""
Main flow for Poolfinder.
Expand All @@ -73,6 +74,9 @@ def get_pools_for_unsupported_pairs(self, pools: List[Dict[str, Any]], arb_mode:
unsupported_pairs = PoolFinder._find_unsupported_triangles(self._flashloan_tokens, carbon_pairs=carbon_pairs, external_pairs=other_pairs)
else:
unsupported_pairs = PoolFinder._find_unsupported_pairs(self._flashloan_tokens, carbon_pairs=carbon_pairs, external_pairs=other_pairs)
config.logger.info(f"Searching pools to support the following carbon pairs:")
for pair in unsupported_pairs:
config.logger.info(pair)

pairs = [(tkn, token) for pair in unsupported_pairs for tkn in pair for token in self._flashloan_tokens]
chunk_size = 400
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,10 @@ def run(mgr, args, tenderly_uri=None) -> None:
mgr.solidly_v2_event_mappings = dict(
solidly_v2_event_mappings[["address", "exchange"]].values
)

if args.pool_finder_period > 0 and (loop_idx - 1) % args.pool_finder_period == 0:
mgr.cfg.logger.info(f"Searching for unsupported Carbon pairs.")
uni_v2, uni_v3, solidly_v2 = pool_finder.get_pools_for_unsupported_pairs(mgr.pool_data, arb_mode=args.arb_mode)
uni_v2, uni_v3, solidly_v2 = pool_finder.get_pools_for_unsupported_pairs(mgr.cfg, mgr.pool_data, arb_mode=args.arb_mode)
process_new_events(uni_v2, mgr.uniswap_v2_event_mappings, f"fastlane_bot/data/blockchain_data/{args.blockchain}/uniswap_v2_event_mappings.csv", args.read_only)
process_new_events(uni_v3, mgr.uniswap_v3_event_mappings, f"fastlane_bot/data/blockchain_data/{args.blockchain}/uniswap_v3_event_mappings.csv", args.read_only)
process_new_events(solidly_v2, mgr.solidly_v2_event_mappings, f"fastlane_bot/data/blockchain_data/{args.blockchain}/solidly_v2_event_mappings.csv", args.read_only)
Expand Down

0 comments on commit 719c406

Please sign in to comment.