GeezerVison is showing github.com — Pancake and BSC fork · Issue #90 · uniswap-python/uniswap-python
Description
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
ErikBjare commented on Apr 27, 2021
See #62 (comment) and #58.
Some work required but should be easy to implement, please make a PR if you get around to it!
alb2001 commented on Apr 28, 2021
Hello
Thanks for your response. Unfortunately my knowledge is limited. But I could try. However, do you know of any pancakeswap wrapper for python?
wahid commented on May 2, 2021
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)ErikBjare commented on May 4, 2021
I adapted #58 to allow for overriding the factory and router contract addresses in the constructor. Should work, feedback/testing welcome.
ErikBjare commented on May 4, 2021
Closing. Please open a new issue if you stumble into problems.
Metadata
Metadata
Development
No branches or pull requestsIssue actions