1

你能告诉我,我如何调用合同中的函数https://bscscan.com/address/0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F#readContract

我用蟒蛇

def str_to_addr(s: str):
    if s.startswith("0x"):
        return Address(bytes.fromhex(s[2:]))
    elif s.endswith(".eth"):
        return ENS(s)

w3 = Web3(Web3.HTTPProvider('https://mainnet.infura.io/v3/....'))
router_address = str_to_addr("0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F")
router = w3.eth.contract(address=router_address, abi=abi)
print(router.functions.factory().call())

但是我收到错误 web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, 合约部署是否正确并且链同步?

我该做什么?

4

0 回答 0