Skip to content

Pancake and BSC fork #90

Closed
Closed

Description

@alb2001

Hello

This wrapper is pretty good when interacting with Uniswap. However, BSC and Pancake share almost everything from the eth network. (even the functions are the same

So I wonder, is there a fork already which works with PancakeSwap and BSC? What would need to be changed to add support for Pancake?

Network ID, and pancake router contracts?

Thanks

Activity

  1. ErikBjare commented on Apr 27, 2021

    @ErikBjare
    Member

    See #62 (comment) and #58.

    Some work required but should be easy to implement, please make a PR if you get around to it!

  2. alb2001 commented on Apr 28, 2021

    @alb2001
    Author

    Hello

    Thanks for your response. Unfortunately my knowledge is limited. But I could try. However, do you know of any pancakeswap wrapper for python?

  3. wahid commented on May 2, 2021

    @wahid

    I think patching line 121 and line 184 in uniswap.py would do it.

    _netid_to_name = {1: "mainnet", 3: "ropsten", 4: "rinkeby", 56: "BSC"}
    
    elif self.version == 2:
        if self.network == "BSC":
            factory_contract_address_v2 = _str_to_addr("0xca143ce32fe78f1f7019d7d551a6402fc5350c73")
            self.router_address: AddressLike = _str_to_addr("0x10ed43c718714eb63d5aa57b78b54704e256024e")
        else:
            factory_contract_address_v2 = _str_to_addr(
                "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"
            )
    
            self.router_address: AddressLike = _str_to_addr(
                "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
            )
        self.factory_contract = self._load_contract(abi_name="uniswap-v2/factory", address=factory_contract_address_v2)
        self.router = self._load_contract(abi_name="uniswap-v2/router02", address=self.router_address)
  4. ErikBjare commented on May 4, 2021

    @ErikBjare
    Member

    I adapted #58 to allow for overriding the factory and router contract addresses in the constructor. Should work, feedback/testing welcome.

  5. ErikBjare commented on May 4, 2021

    @ErikBjare
    Member

    Closing. Please open a new issue if you stumble into problems.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions