我用remix部署了一个合约,我在remix上调用合约的函数都没问题,但是使用web3.py来调合约函数的时候,就不成功,总是提示:execution reverted: failed to execute message。
这是怎么回事呢?
python代码:
deadline = int(time.time()) + 300
 func = self.arb_contract.functions.swap(address,deadline)
 tx = {
                'from': address,
                'value': self.w3.toWei(value, 'ether'),
                'gas': 250000,
                'gasPrice': self.w3.eth.gas_price,
                'nonce': self.w3.eth.getTransactionCount(address)
   }
  transaction = func.buildTransaction(tx)
  signed_tx = self.w3.eth.account.sign_transaction(transaction, private_key)
  tx_hash = self.w3.eth.sendRawTransaction(signed_tx.rawTransaction).hex()
  self.w3.eth.waitForTransactionReceipt(tx_hash)在remix上调用的结果:

使用python调用的结果:
