Skip to content

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

Open

Description

@kthenurseone

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?

Activity

  1. kthenurseone commented on Sep 18, 2023

    @kthenurseone
    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..

  2. liquid-8 commented on Sep 20, 2023

    @liquid-8
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions