Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Not coneecting to Arbitrum network

未关闭
#415 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
api, backend

调研方向

The traceback points to uniswap.py in __init__, where the router address is looked up using self.netname; the issue identifies the V2 factory and router address maps as the proposed change. Read the network name handling and those constants first, then check the existing tests for V2 network addresses. Done means the arb network name resolves to the supplied Arbitrum addresses and initialization no longer raises a lookup error.

由索引模型根据 Issue 内容生成。

描述

bug

Describe the bug
Not connectiong to arbitrum network

To Reproduce

ARBITRUM_NETWORK = 'arb'
NETWORK = ARBITRUM_NETWORK # ETHEREUM_NETWORK # 

ALCHEMY_KEY = 'dZ0m4G7NDDk0nAw_vmLprqyJzZMchoEH'
ALCHEMY_URL = f"https://{NETWORK}-mainnet.g.alchemy.com/v2/{ALCHEMY_KEY}"
provider = ALCHEMY_URL

arbitrum_wbtc = '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f'
arbitrum_usdc = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'

uniswap = Uniswap(address=None, private_key=None, version=2, provider=provider)

Raises the following error

    uniswap = Uniswap(address=None, private_key=None, version=2, provider=provider)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/i751898/Documents/personal/tests/crypto/uniswap-env/lib/python3.12/site-packages/uniswap/uniswap.py", line 165, in __init__
    router_contract_addr = _router_contract_addresses_v2[self.netname]
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^

Expected behavior
Connect to arbitrum network

Additional context
The fix seems prety simple
in the constant files, update

_factory_contract_addresses_v2 = {
    "mainnet": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
    ...
    "arbitrum": "0xc35dadb65012ec5796536bd9864ed8773abc74c4" # SushiSwap Factory on Arbitrum
}

_router_contract_addresses_v2 = {
    "mainnet": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
    ...
    "arbitrum": "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506" # SushiSwap Router on Arbitrum
}

I did try manually and it worked fine|

uniswap = Uniswap(
    address=WALLET_ADDRESS,
    private_key=WALLET_PRIVATE_KEY,
    version=2,
    provider=provider,
    router_contract_addr="0x1b02da8cb0d097eb8d57a175b88c7d8b47997506",
    factory_contract_addr="0xc35dadb65012ec5796536bd9864ed8773abc74c4"
)

thanks in advanve

主要语言
Python
星标
1k
派生
373
平均合并
2 天 6 小时
30 天内合并 PR
6

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

uniswap-python/uniswap-python 的其他 Issue

查看 uniswap-python/uniswap-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。