Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not transact with/call contract function, is contract deployed correctly and chain synced? #348

Open
kthenurseone opened this issue Sep 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@kthenurseone
Copy link

kthenurseone commented Sep 18, 2023

My code is:
`

        print(f"Buying token with {address}")
        w3 = web3.Web3(web3.HTTPProvider(mySettings["RPC"]))
        w3.middleware_onion.inject(web3.middleware.geth_poa_middleware, layer=0)
        version = int(mySettings["VERSION"])
        provider = mySettings["RPC"]
        uniswap = Uniswap(address=address, private_key=private_key, version=version,default_slippage=1, provider=provider, web3=w3)
        token1 = to_checksum_address(mySettings["TOKEN1"])
        token2 = to_checksum_address(mySettings["TOKEN2"])

        # print(uniswap.get_price_input(token1, token2, 10**18))

        token1Balance = uniswap.get_token_balance(mySettings["TOKEN1"])-20
        print("Token1: ", token1Balance)




        # print(int(myETHBalance/100))
        uniswap.make_trade(token1, token2, token1Balance)
        time.sleep(int(mySettings["DELAY"]))

        print(f"Selling token with {address}")
        token2Balance = uniswap.get_token_balance(mySettings["TOKEN2"])
        print("Token2: ",token2Balance)


        uniswap.make_trade(token2, token1, token2Balance)
        time.sleep(int(mySettings["DELAY"]))`

and my settings are:

[SETTINGS]
TOKEN1= 0x55d398326f99059ff775485246999027b3197955
TOKEN2 = 0x643D89FBe699068353D24acf55Eb33366d57F533
VERSION = 3
RPC = https://binance.llamarpc.com
DELAY = 45

when I try to run the program it gives that error:

Web3 is connected: True Buying token with 0xFC2E975cd81807983d457A1732d887A55Ac8b36e Token1: 13138442028139619270 No fee set, assuming 0.3% Could not transact with/call contract function, is contract deployed correctly and chain synced?

@kthenurseone kthenurseone added the bug Something isn't working label Sep 18, 2023
@kthenurseone
Copy link
Author

+++ update:
I made a buy manually and I saw that router is universal router. and I updated the code like this:
uniswap = Uniswap(router_contract_addr="0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",address=address, private_key=private_key, version=version,default_slippage=1, provider=provider, web3=w3)

but I still get the same error as I get before..

@liquid-8
Copy link
Member

There is no support for the universal router. You can use a regular v3 router if it is deployed on BSC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants