这个solid代码中的错误是什么?它在运行时编译但出错



函数如下:这是一个更大的合同的一部分,它完美地运行,没有错误。

address payable public coldStorage;
event toColdStorage (address from, uint256 amount, uint toBlockchain, string toAddress);
event removedFromColdStorage (address to, uint256 amount, uint fromBlockchain, string fromAddress);
function getFromStorage(address payable _to, uint _fromBlockchain, string memory _fromAddress) public payable {
require(msg.sender == coldStorage, "Only the owners can call this function");
_to.transfer(msg.value);
emit removedFromColdStorage(_to, msg.value, _fromBlockchain, _fromAddress);
}

当我调用这个函数(使用Python3)时,只有这个函数,合约没有完成交易,我得到这个错误

raise ContractLogicError(f'execution reverted: {response["error"]["message"]}')
web3.exceptions.ContractLogicError: execution reverted: VM Exception while processing transaction: revert

我像这样调用函数,

contract.functions.getFromStorage(w3.eth.accounts[2], 2, '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM').transact({'value':500000000000000000})

但我不认为错误在这里,因为相同的格式适用于本合同中的其他函数。

从错误来看,我好像犯了一个逻辑错误,但是我不能找出错误的位置。

事先感谢您的帮助

对我来说,您提供的地址看起来不像以太坊地址(快速谷歌搜索表明它是Solana地址)。您是否尝试为_to使用其他地址?

最新更新