"execution reverted" when using make_trade()
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- python
研究方向
Start with make_trade() in uniswap/uniswap.py, then follow the call into _token_to_token_swap_input() and _get_token_token_input_price() shown in the traceback. Reproduce the call against the reported WETH and APE pair and inspect the fee argument and pool lookup. Done when the cause is identified and the example either completes the swap or returns a clear explanation of the revert.
由索引模型根據 Issue 內容生成。
描述
Hello!
When trying to execute a swap using the make_trade() method I consistently get "web3.exceptions.ContractLogicError: execution reverted" error
This is the code that can be used to reproduce the error:
import os
from uniswap import Uniswap
weth_address = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" # WETH
token_address = "0x4d224452801ACEd8B2F0aebE155379bb5D594381" # APE
uniswap = Uniswap(
address=os.environ.get('WALLET_ADDRESS'),
private_key=os.environ.get('WALLET_PRIVATE_KEY'),
provider=os.environ.get('PROVIDER_URL'),
version=3
)
tx = uniswap.make_trade(weth_address, token_address, qty=9000000000000000, slippage=0.3, fee=10000000)
print(tx)
Checking the APE/WETH pair on the Uniswap UI it seems to exist and also has good amount of liquidity.
Am I doing something wrong there?
Here is the full trace of the error:
File "/home/example/example.py", line 17, in <module>
tx = uniswap.make_trade(weth_address, token_address, qty=9000000000000000, slippage=0.3, fee=10000000)
File "/home/example/venv/lib64/python3.10/site-packages/uniswap/decorators.py", line 38, in approved
return method(self, *args, **kwargs)
File "/home/example/venv/lib64/python3.10/site-packages/uniswap/uniswap.py", line 476, in make_trade
return self._token_to_token_swap_input(
File "/home/example/venv/lib64/python3.10/site-packages/uniswap/uniswap.py", line 766, in _token_to_token_swap_input
* self._get_token_token_input_price(
File "/home/example/venv/lib64/python3.10/site-packages/uniswap/uniswap.py", line 340, in _get_token_token_input_price
).call()
File "/home/example/venv/lib64/python3.10/site-packages/web3/contract/contract.py", line 461, in call
return call_contract_function(
File "/home/example/venv/lib64/python3.10/site-packages/web3/contract/utils.py", line 96, in call_contract_function
return_data = w3.eth.call(
File "/home/example/venv/lib64/python3.10/site-packages/web3/eth/eth.py", line 255, in call
return self._durin_call(transaction, block_identifier, state_override)
File "/home/example/venv/lib64/python3.10/site-packages/web3/eth/eth.py", line 274, in _durin_call
return self._call(transaction, block_identifier, state_override)
File "/home/example/venv/lib64/python3.10/site-packages/web3/module.py", line 68, in caller
result = w3.manager.request_blocking(
File "/home/example/venv/lib64/python3.10/site-packages/web3/manager.py", line 232, in request_blocking
return self.formatted_response(
File "/home/example/venv/lib64/python3.10/site-packages/web3/manager.py", line 197, in formatted_response
apply_error_formatters(error_formatters, response)
File "/home/example/venv/lib64/python3.10/site-packages/web3/manager.py", line 73, in apply_error_formatters
formatted_resp = pipe(response, error_formatters)
File "cytoolz/functoolz.pyx", line 666, in cytoolz.functoolz.pipe
File "cytoolz/functoolz.pyx", line 641, in cytoolz.functoolz.c_pipe
File "/home/example/venv/lib64/python3.10/site-packages/web3/_utils/method_formatters.py", line 766, in raise_contract_logic_error_on_revert
raise ContractLogicError("execution reverted")
web3.exceptions.ContractLogicError: execution reverted
- 主要語言
- Python
- 星號
- 1k
- 分支
- 373
- 平均合併
- 4 天 11 小時
- 30 天內合併 PR
- 3
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
uniswap-python/uniswap-python 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 78/100
uniswap-python/uniswap-python#487 ·
-
bug
難度 2/5 1-3 小時 新手友好度 35/100
uniswap-python/uniswap-python#415 · 1 則留言 ·
-
難度 1/5 1 小時以內 新手友好度 20/100
uniswap-python/uniswap-python#405 · 1 則留言 ·
-
難度 4/5 3-5 天 新手友好度 25/100
uniswap-python/uniswap-python#404 · 1 個 reaction ·
-
難度 4/5 3-5 天 新手友好度 20/100
uniswap-python/uniswap-python#380 · 13 則留言 · 6 個 reaction ·
查看 uniswap-python/uniswap-python 的全部 Issue
相似的 Issue
-
[Bug]: LangGraph Store sync put bypasses namespace validation可能已有人在做 @ktz03 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
volcengine/OpenViking#6050 ·
維護者通常 1 天內回覆
-
[Bug]: Streamed /v1/chat/completions sends unredacted agent error text (keys) in the final chunk可能已有人在做 @rodricksz4h5 今天認領。 未關閉area/streaming comp/gateway P2 type/security
難度 2/5 1-3 小時 新手友好度 78/100
NousResearch/hermes-agent#138245 ·
維護者通常 1 天內回覆
-
[oblt-aw][autodoc] Update user onboarding guide for mandatory trigger CODEOWNERS step可能已有人在做 @github-actions 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 66/100
維護者通常 1 天內回覆
-
correction metadata
難度 2/5 1 小時以內 新手友好度 68/100
acl-org/acl-anthology#10378 · 1 則留言 ·
維護者通常 1 天內回覆
-
cloudtrail_multi_region_enabled_logging_management_events fails when the advanced event selector has a custom name可能已有人在做 @12YYCCYY16 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
prowler-cloud/prowler#13033 ·
維護者通常 1 天內回覆