Transactions
交易收據為 0x1,但執行失敗。這怎麼可能
https://etherscan.io/tx/0x20081e3012905d97961c2f1a18e1f3fe39f72a46b24e078df2fe446051366dca
正如你所看到的
web3.eth.getTransactionReceipt
{塊雜湊:'0xbd4c1f27df055d4aa7e1540808f1e63a6126e178ecb5324062d8df2525137ad7', 區塊編號:4891051, 契約地址:空, 累計GasUsed:4035801, 來自:'0x2b5634c42055806a59e9107ed44d43c426e58258', 使用氣體:25236, 日誌:[], logsBloom:“0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 狀態:'0x1', 至:'0x1063ce524265d5a3a624f4914acd573dd89ce988', transactionHash: '0x20081e3012905d97961c2f1a18e1f3fe39f72a46b24e078df2fe446051366dca', 交易指數:151 }
狀態為 0x1,表示成功。但是,此傳輸的氣體限制較低(50k)。那麼,那裡究竟發生了什麼?
我想我想通了:
aigangToken.methods.balanceOfAt('0x1f38ac62e62ecbc08e124297f84165b5f61cc96b', 4891051).call().then(console.log)
發件人沒有任何代幣餘額。
所以,由於發送方沒有token餘額,tx簡單地執行了這個return: https ://github.com/AigangNetwork/aigang-crowdsale-contracts/blob/master/contracts/MiniMeToken.sol#L220 所以交易成功