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

fix: uniswap v2 factory helper ContractLogicError case #847

Merged
merged 3 commits into from
Dec 4, 2024
Merged
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
9 changes: 5 additions & 4 deletions y/prices/dex/uniswap/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from eth_typing import HexAddress
from multicall import Call
from typing_extensions import Self
from web3.exceptions import ContractLogicError

from y import ENVIRONMENT_VARIABLES as ENVS
from y import convert
Expand Down Expand Up @@ -436,7 +437,7 @@ def _log_factory_helper_failure(
elif "invalid request" in stre:
# TODO: debug where these come from
msg = "invalid request"
elif isinstance(e, Revert):
elif isinstance(e, (Revert, ContractLogicError)):
# TODO: debug me!
msg = "reverted"
else:
Expand Down Expand Up @@ -674,7 +675,7 @@ async def get_pools_for(
except Exception as e:
okay_errs = "out of gas", "timeout"
stre = str(e).lower()
if "invalid request" in str(e):
if "invalid request" in stre:
# TODO: debug where this invalid request is coming from
self._skip_factory_helper.add(token_in)
elif call_reverted(e) or any(err in stre for err in okay_errs):
Expand Down Expand Up @@ -757,7 +758,7 @@ async def deepest_pool(
if deepest_pool == brownie.ZERO_ADDRESS
else UniswapV2Pool(deepest_pool, asynchronous=self.asynchronous)
)
except (Revert, ValueError) as e:
except (Revert, ValueError, ContractLogicError) as e:
if "invalid request" in str(e):
self._skip_factory_helper.add(token_address)
_log_factory_helper_failure(e, token_address, block, _ignore_pools)
Expand Down Expand Up @@ -910,7 +911,7 @@ async def check_liquidity(
(self, token, block, liquidity),
)
return liquidity
except (Revert, ValueError) as e:
except (Revert, ValueError, ContractLogicError) as e:
_log_factory_helper_failure(e, token, block, ignore_pools)

pools = self.pools_for_token(token, block=block, _ignore_pools=ignore_pools)
Expand Down
Loading