Skip to content

Commit

Permalink
fix: uniswap v2 factory helper ContractLogicError case (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Dec 4, 2024
1 parent 96cf7ae commit 9fd0461
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit 9fd0461

Please sign in to comment.