Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix always add native wrapped gas infor to the token objects #624

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions fastlane_bot/events/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,11 @@ def populate_tokens(self):
self.token_list[token.address] = token
except AttributeError:
pass
if self.ConfigObj.GAS_TKN_IN_FLASHLOAN_TOKENS:
native_gas_tkn = Token(symbol=self.ConfigObj.NATIVE_GAS_TOKEN_SYMBOL, address=self.ConfigObj.NATIVE_GAS_TOKEN_ADDRESS, decimals=18)
wrapped_gas_tkn = Token(symbol=self.ConfigObj.WRAPPED_GAS_TOKEN_SYMBOL, address=self.ConfigObj.WRAPPED_GAS_TOKEN_ADDRESS, decimals=18)
self.token_list[native_gas_tkn.address] = native_gas_tkn
self.token_list[wrapped_gas_tkn.address] = wrapped_gas_tkn
# native and wrapped gas token info populated everytime
native_gas_tkn = Token(symbol=self.ConfigObj.NATIVE_GAS_TOKEN_SYMBOL, address=self.ConfigObj.NATIVE_GAS_TOKEN_ADDRESS, decimals=18)
wrapped_gas_tkn = Token(symbol=self.ConfigObj.WRAPPED_GAS_TOKEN_SYMBOL, address=self.ConfigObj.WRAPPED_GAS_TOKEN_ADDRESS, decimals=18)
self.token_list[native_gas_tkn.address] = native_gas_tkn
self.token_list[wrapped_gas_tkn.address] = wrapped_gas_tkn

def create_token(self, record: Dict[str, Any], prefix: str) -> Token:
"""
Expand Down
21 changes: 21 additions & 0 deletions fastlane_bot/events/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,27 @@ def handle_target_token_addresses(static_pool_data: pd.DataFrame, target_tokens:
return target_token_addresses


def verify_min_bnt_is_respected(bot: CarbonBot, mgr: Any):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never used

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced this PR with #632 since some merge mistakes were made

"""
Verifies that the bot respects the min profit. Used for testing.

Parameters
----------
bot : CarbonBot
The bot object.
mgr : Any
The manager object.

"""
# Verify MIN_PROFIT_BNT is set and respected
assert (
bot.ConfigObj.DEFAULT_MIN_PROFIT_GAS_TOKEN
== mgr.cfg.DEFAULT_MIN_PROFIT_GAS_TOKEN
), "bot failed to update min profit"
mgr.cfg.logger.debug(
"[events.utils.verify_min_bnt_is_respected] Bot successfully updated min profit"
)

def get_current_block(
last_block: int,
mgr: Any,
Expand Down
7 changes: 2 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
set_network_to_mainnet_if_replay,
set_network_to_tenderly_if_replay,
handle_target_token_addresses,
verify_min_bnt_is_respected,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never used

get_current_block,
handle_tenderly_event_exchanges,
handle_static_pools_update,
Expand Down Expand Up @@ -255,10 +256,6 @@ def main(args: argparse.Namespace) -> None:
cfg, exchanges, args.blockchain, args.static_pool_data_filename, args.read_only
)

target_token_addresses = handle_target_token_addresses(
static_pool_data, args.target_tokens
)

# Break if timeout is hit to test the bot flags
if args.timeout == 1:
cfg.logger.info("Timeout to test the bot flags")
Expand All @@ -284,7 +281,7 @@ def main(args: argparse.Namespace) -> None:
solidly_v2_event_mappings=solidly_v2_event_mappings,
tokens=tokens.to_dict(orient="records"),
replay_from_block=args.replay_from_block,
target_tokens=target_token_addresses,
target_tokens=args.target_tokens,
tenderly_fork_id=args.tenderly_fork_id,
tenderly_event_exchanges=tenderly_event_exchanges,
w3_tenderly=w3_tenderly,
Expand Down
Loading