Skip to content

Not coneecting to Arbitrum network #415

@SamuelJansen

Description

@SamuelJansen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions