get_tvl_in_pool crashes with "Provided tick is out of bounds" error
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
The traceback points to get_tvl_in_pool in uniswap/uniswap.py, find_tick_from_bitmap and get_min_tick_from_wordpos there, and nearest_tick in uniswap/util.py. Start by tracing how the pool's current tick and fee are passed through those calls, then compare the failing WETH/USDC pool with the working WETH/APE case. Done means get_tvl_in_pool handles the reported out-of-bounds case correctly and the relevant tests cover it.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am trying to use get_tvl_in_pool to get the best option between 0.3% and 1% pools on UniV3
When I use it for WETH/USDC pair 0.3% pair it gets reverted with "Provided tick is out of bounds: (-887220, 887220)" error.
My code:
from web3 import Web3
from uniswap import Uniswap
from config.config import get_provider
address = None # or None if you're not going to make transactions
private_key = None # or None if you're not going to make transactions
version = 3 # specify which version of Uniswap to use
provider = get_provider('ethereum')['rpc'] # can also be set through the environment variable `PROVIDER`
uniswap = Uniswap(address=address, private_key=private_key, provider=provider, version=version)
token_address_usdc = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
# token_address_ape = '0x4d224452801ACEd8B2F0aebE155379bb5D594381'
weth_address = uniswap.get_weth_address()
token_address = Web3.toChecksumAddress(token_address_usdc)
pool_03 = uniswap.get_pool_instance(weth_address, token_address, 3000)
tvl = uniswap.get_tvl_in_pool(pool_03)
print(tvl)
Error
Traceback (most recent call last):
File "/home/iurii/Desktop/blockchain/retrodrop/arbitrum/test.py", line 20, in <module>
tvl = uniswap.get_tvl_in_pool(pool_03)
File "/home/iurii/Desktop/blockchain/retrodrop/arbitrum/venv/lib/python3.8/site-packages/uniswap/uniswap.py", line 1342, in get_tvl_in_pool
_min_tick = self.find_tick_from_bitmap(
File "/home/iurii/Desktop/blockchain/retrodrop/arbitrum/venv/lib/python3.8/site-packages/uniswap/uniswap.py", line 1298, in find_tick_from_bitmap
_min_tick = self.get_min_tick_from_wordpos(
File "/home/iurii/Desktop/blockchain/retrodrop/arbitrum/venv/lib/python3.8/site-packages/uniswap/uniswap.py", line 1255, in get_min_tick_from_wordpos
min_tick_in_word = nearest_tick(_tick, fee)
File "/home/iurii/Desktop/blockchain/retrodrop/arbitrum/venv/lib/python3.8/site-packages/uniswap/util.py", line 111, in nearest_tick
assert (
AssertionError: Provided tick is out of bounds: (-887220, 887220)
Process finished with exit code 1
However, for the WETH/APE pool it works just fine.
So this is probably some corner case that makes script fail. Not really sure how to fix it
- Ngôn ngữ chính
- Python
- Star
- 1k
- Fork
- 373
- Merge trung bình
- 2 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của uniswap-python/uniswap-python
-
Broken links in the docsCó thể đã có người làm @ankush-dev-eng đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
uniswap-python/uniswap-python#487 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
uniswap-python/uniswap-python#492 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
uniswap-python/uniswap-python#415 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 20/100
uniswap-python/uniswap-python#405 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
uniswap-python/uniswap-python#404 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của uniswap-python/uniswap-python
Issue tương tự
-
customer-reported question
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Azure/azure-sdk-for-python#49548 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
btclib-org/btclib-wallet#409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Phase 2 PSA Capability & Career Profile
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bcgov/digital-journeys#2310 ·
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
fastmachinelearning/hls4ml#1582 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Sort modelsĐang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày