I have a contract on Ropsten, and when I do this is python, I get a result:
result = contract.functions.getLastUpdateTime(0).call()
So I know the ABI is there, the address, etc.
There's another function getCurrentPrice
on that same contract, which only differs in that it is restricted to be readable only for those querying with a certain address (ie, require(msg.sender = '0x123...')
). I can get this to work in Remix, and have the public and private key that satisfies this restriction, so the problem is not that this function is screwed up.
Clearly, I need to tell it my public and/or private key info. Where do I add that to my transaction?
with open(contract_abi0) as f:
contract_abi = json.load(f)
contract = w3.eth.contract(address = contract_address, abi = contract_abi['abi'])
UpdateTime = contract.functions.getLastUpdateTime(0).call() # works!
Price = contract.functions.getCurrentPrice(0).call() # does not work :(