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
web3.exceptions.ContractLogicError: execution reverted: Unexpected error uniswapv3 EUROC USDC pair #355
Comments
That's V3 pool, but you set |
This is happening in V3 as well. The line that raises the error: uniswap-python/uniswap/uniswap.py Line 349 in ad8c8a1
Debug info:
|
@yuriescl It's a 0.05% pool, so you have the wrong fee set. We should probably catch such exceptions and rethrow them with better error message telling users to check the (version, token0, token1, fee) params. |
The fee is being set by the uniswap library: uniswap-python/uniswap/uniswap.py Line 240 in ad8c8a1
|
In this scenario, is it expected that my code sets the fee, or is the uniswap library setting the wrong default fee? |
Indeed setting fee to |
@yuriescl There is no "default" fee in V3, you need to check the fee of the pool you want to use and set it appropriately (which is what the warning is about). Perhaps we should stop assuming a 0.3% fee and just raise an exception if not explicitly set. |
Back in the days 0.3% fee was pretty much standard as total majority of pools had it. Now it doesn't coz there are tons of stable pools with .05 fee; memecoins have 1% quite often as well. Tend to agree, these methods need to require explicit fee specification. |
Describe the bug
A pool exists for EUROC/EURC and USDC on Eth newtwork
https://info.uniswap.org/#/pools/0x95dbb3c7546f22bce375900abfdd64a4e5bd73d6
I can call USDC to ETH but for rate = uniswap.get_price_input on EUROC I get the below error
address used is
"0x1abaea1f7c830bd89acc67ec4af516284b1bc33c"
To Reproduce
0|lightecho | [2023-10-27 09:30:31,775 api.py:458 ERROR] Exception raised by task: <coroutine object as_completed.._wait_for_one at 0x7f60b6712b20>
0|lightecho | Traceback (most recent call last):
0|lightecho | File "/home/lightecho/lightecho/./api/api.py", line 456, in ws_rates
0|lightecho | result = await task
0|lightecho | File "/usr/lib/python3.10/asyncio/tasks.py", line 571, in _wait_for_one
0|lightecho | return f.result() # May raise f.exception().
0|lightecho | File "/home/lightecho/lightecho/./api/api.py", line 167, in cached_rates
0|lightecho | result = await mod.rates(
0|lightecho | File "/home/lightecho/lightecho/api/integrations/uniswap_v3.py", line 118, in rates
0|lightecho | rate = await get_rate(
0|lightecho | File "/home/lightecho/lightecho/api/integrations/uniswap_v3.py", line 165, in get_rate
0|lightecho | rate = uniswap.get_price_input(
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/uniswap/uniswap.py", line 247, in get_price_input
0|lightecho | return self._get_token_token_input_price(token0, token1, qty, fee, route)
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/uniswap/uniswap.py", line 351, in _get_token_token_input_price
0|lightecho | ).call()
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/contract/contract.py", line 305, in call
0|lightecho | return call_contract_function(
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/contract/utils.py", line 96, in call_contract_function
0|lightecho | return_data = w3.eth.call(
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/eth/eth.py", line 256, in call
0|lightecho | return self._durin_call(transaction, block_identifier, state_override)
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/eth/eth.py", line 275, in _durin_call
0|lightecho | return self._call(transaction, block_identifier, state_override)
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/module.py", line 75, in caller
0|lightecho | result = w3.manager.request_blocking(
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/manager.py", line 321, in request_blocking
0|lightecho | return self.formatted_response(
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/manager.py", line 282, in formatted_response
0|lightecho | apply_error_formatters(error_formatters, response)
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/manager.py", line 99, in apply_error_formatters
0|lightecho | formatted_resp = pipe(response, error_formatters)
0|lightecho | File "cytoolz/functoolz.pyx", line 666, in cytoolz.functoolz.pipe
0|lightecho | File "cytoolz/functoolz.pyx", line 641, in cytoolz.functoolz.c_pipe
0|lightecho | File "/home/lightecho/lightecho/.venv/lib/python3.10/site-packages/web3/_utils/contract_error_handling.py", line 161, in raise_contract_logic_error_on_revert
0|lightecho | raise ContractLogicError(message, data=data)
0|lightecho | web3.exceptions.ContractLogicError: execution reverted: Unexpected error
The text was updated successfully, but these errors were encountered: