"execution reverted: Insufficient WETH9" on Polygon
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
The traceback identifies uniswap/uniswap.py, especially make_trade and _token_to_eth_swap_input; the report also points to constants.py and the Polygon token addresses. Start by checking how the client represents native MATIC and WETH9 on Polygon, then trace the swap path and its tests. Done means the reported AMP-to-MATIC trade no longer reverts and existing swap behavior remains covered.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
I want to transfer AMP to MATIC(not WMATIC),but I got a error
Traceback (most recent call last):
File "D:\uniswap-python\examples\qyx_test.py", line 29, in <module>
data = uniswap.make_trade(amp, matic, qty=qty, slippage=0.1, fee=3000)
File "D:\uniswap-python\uniswap\decorators.py", line 38, in approved
return method(self, *args, **kwargs)
File "D:\uniswap-python\uniswap\uniswap.py", line 473, in make_trade
input_token, qty, recipient, fee, slippage, fee_on_transfer
File "D:\uniswap-python\uniswap\uniswap.py", line 690, in _token_to_eth_swap_input
self._get_tx_params(),
File "D:\uniswap-python\uniswap\uniswap.py", line 1443, in _build_and_send_tx
transaction = function.build_transaction(tx_params)
File "D:\uniswap-python\venv\lib\site-packages\web3\contract\contract.py", line 340, in build_transaction
**self.kwargs,
File "D:\uniswap-python\venv\lib\site-packages\web3\contract\utils.py", line 232, in build_transaction_for_function
prepared_transaction = fill_transaction_defaults(w3, prepared_transaction)
File "cytoolz\\functoolz.pyx", line 263, in cytoolz.functoolz.curry.__call__
File "D:\uniswap-python\venv\lib\site-packages\web3\_utils\transactions.py", line 132, in fill_transaction_defaults
default_val = default_getter(w3, transaction)
File "D:\uniswap-python\venv\lib\site-packages\web3\_utils\transactions.py", line 72, in <lambda>
"gas": lambda w3, tx: w3.eth.estimate_gas(tx),
File "D:\uniswap-python\venv\lib\site-packages\web3\eth\eth.py", line 293, in estimate_gas
return self._estimate_gas(transaction, block_identifier)
File "D:\uniswap-python\venv\lib\site-packages\web3\module.py", line 74, in caller
method_str, params, error_formatters, null_result_formatters
File "D:\uniswap-python\venv\lib\site-packages\web3\manager.py", line 251, in request_blocking
response, params, error_formatters, null_result_formatters
File "D:\uniswap-python\venv\lib\site-packages\web3\manager.py", line 209, in formatted_response
apply_error_formatters(error_formatters, response)
File "D:\uniswap-python\venv\lib\site-packages\web3\manager.py", line 85, in apply_error_formatters
formatted_resp = pipe(response, error_formatters)
File "cytoolz\\functoolz.pyx", line 680, in cytoolz.functoolz.pipe
File "cytoolz\\functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe
File "D:\uniswap-python\venv\lib\site-packages\web3\_utils\contract_error_handling.py", line 139, in raise_contract_logic_error_on_revert
raise ContractLogicError(message, data=data)
web3.exceptions.ContractLogicError: execution reverted: Insufficient WETH9
To Reproduce
this is my code
w3 = Web3(Web3.HTTPProvider('https://rpc-mainnet.maticvigil.com',
request_kwargs={"proxies": proxies}))
w3.middleware_onion.inject(geth_poa_middleware, layer=0)
uniswap = Uniswap(address=address, private_key=private_key, version=3, web3=w3)
qty = 5 * 10 ** 18
amp = w3.to_checksum_address("0x0621d647cecbFb64b79E44302c1933cB4f27054d")
matic = w3.to_checksum_address("0x0000000000000000000000000000000000001010")
data = uniswap.make_trade(amp, matic, qty=qty, slippage=0.1, fee=3000)
print(data)
Additional context
I set in the constants.py ETH_ADDRESS = "0x0000000000000000000000000000000000001010"
- 主要言語
- Python
- スター
- 1k
- フォーク
- 373
- 平均マージ
- 2日 6時間
- マージ済み PR(30日)
- 6
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uniswap-python/uniswap-python のほかの issue
-
Broken links in the docs対応中かも @ankush-dev-eng が 1 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
uniswap-python/uniswap-python#487 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
uniswap-python/uniswap-python#492 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
uniswap-python/uniswap-python#415 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 20/100
uniswap-python/uniswap-python#405 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
uniswap-python/uniswap-python#404 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
uniswap-python/uniswap-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
WingedGuardian/GENesis-AGI#3375 ·
メンテナーはふだん 1 日以内に返信
-
curriculum documentation quality
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
githubnext/gh-aw-workshop#4601 ·
メンテナーはふだん 1 日以内に返信
-
approved Good First Issue scope: docs
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
hiero-ledger/hiero-sdk-python#2730 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信