Skip to content

Missing chain #331

Open
Open

Description

@1220moritz

I tried to use the package for the Metis Blockchain.
RPC: https://andromeda.metis.io/?owner=1088
ID: 1088
https://chainlist.org/chain/1088

`from uniswap import Uniswap

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 = 2 # specify which version of Uniswap to use
provider = "https://andromeda.metis.io/?owner=1088" # can also be set through the environment variable PROVIDER
uniswap = Uniswap(address=address, private_key=private_key, version=version, provider=provider)`

Error:
raise Exception(f"Unknown netid: {self.netid}") # pragma: no cover Exception: Unknown netid: 1088

How can I add the Metis Blockchain or is it even possible to use this package for the METIS Blockchain?

Activity

  1. liquid-8 commented on May 13, 2023

    @liquid-8
    Member

    Check constants.py it has quite a straightforward syntax. Not sure if Uniswap or its fork was deployed there though.

  2. 1220moritz commented on May 13, 2023

    @1220moritz
    Author

    Thanks, got rid of this error. But now I have new ones

    These are the contracts:
    UniswapV3Factory: 0xf5fd18Cd5325904cC7141cB9Daca1F2F964B9927
    UniversalRouter 0x749E46034618c6Cbf64938b8DE10092523228235
    Permit2: 0x2EE5407017B878774b58c34A8c09CAcC94aDd69B
    SwapRouter02: 0x07Da720AD5E434971dbe77C7fC85b7b44d5aC704
    QuoterV2: 0x2db8b665CE6928F9D1a7f83F4C6aCEA64Af6a6f6

    I added the chainId 1088 to the constants.py _netid_to_name dict.
    This solved the error: Exception: Unknown netid: 1088

    When I try to call the get_price_input(token1, token2, amount) method I get
    web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, is contract deployed correctly and chain synced?
    The get_price_input() uses the _get_token_token_input_price(token0, token1, qty, fee, route) which for my usecase (no routes set, no fee set->default 3000, uniswap version 3) calls :

    sqrtPriceLimitX96 = 0
    price = self.quoter.functions.quoteExactInputSingle(token0, token1, fee, qty, sqrtPriceLimitX96).call()
    

    self.quoter uses the quoter_addr "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6" which does not exist on Metis.
    I switched it with QuoterV2 from aboves list, but now I get web3.exceptions.ContractLogicError: execution reverted

  3. liquid-8 commented on May 13, 2023

    @liquid-8
    Member

    The quoter contract address is hardcoded here:

    https://github.com/uniswap-python/uniswap-python/blob/47ae05d24622d5565fb938b5fb7c3959c07973ab/uniswap/uniswap.py#L178

    Just replace it with a Metis address. Feel free to create PR which fixes mentioned hardcoding - it would be strongly appreciated. Check, as well, if a proper pool (token0, token1, fee) is deployed/has liquidity there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions