简体   繁体   English

警告! 合约执行期间遇到的错误 [已恢复]

[英]Warning! Error encountered during contract execution [Reverted]

1)What can cause this message error to appear while depositing ERC20 on allowance? 1) 将 ERC20 存入配额时出现此消息错误的原因是什么? "Warning! Error encountered during contract execution [Reverted]" “警告!合约执行过程中遇到错误[已恢复]”

2)Also from what I noticed while debugging it has something to do with 'require(b <= a)' while depositing. 2)此外,我在调试时注意到它与存款时的“require(b <= a)”有关。 I haven't seen it with tokens using 'assert' instead of 'require' for their SafeMath, would using 'assert' display different error message for the same problem?我还没有看到它使用'assert'而不是'require'作为他们的SafeMath的令牌,使用'assert'会为同一个问题显示不同的错误消息吗? Or I'm just missing something?或者我只是错过了什么?

What can cause this message error to appear while depositing ERC20 on allowance?将 ERC20 存入配额时出现此消息错误的原因是什么? "Warning! Error encountered during contract execution [Reverted]" “警告!合约执行过程中遇到错误[已恢复]”

It depends on the actual contract implementation.这取决于实际的合同执行情况。 Revert happens when a contract produces an invalid opcode, most likely as a result of failed validation in require() , assert() or throws the exception directly using throw() .当合约产生无效的操作码时会发生还原,这很可能是由于require()assert()中的验证失败或直接使用throw()引发异常。

Most likely, it's going to fail a validation whether the transaction sender is allowed to send this amount of the owner's tokens, or whether the owner has this amount available.最有可能的是,交易发送者是否被允许发送这个数量的所有者令牌,或者所有者是否有这个可用的数量,验证将失败。


Would using 'assert' display different error message for the same problem?使用“断言”会为同一问题显示不同的错误消息吗?

assert() doesn't allow for custom error message. assert()不允许自定义错误消息。

The "Warning. Error encountered..." is a message from your web3, not the contract itself. “警告。遇到错误...”是来自您的 web3 的消息,而不是合同本身。 It's going to display the same message when the transaction reverts - no matter whether it reverted because of assert() or require() .当事务恢复时,它将显示相同的消息——无论它是因为assert()还是require()而恢复的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 合约执行期间遇到错误[堆栈下溢(0 &lt;=&gt; 2)] - Error encountered during contract execution [stack underflow (0 <=> 2)] 以太坊 Solidity NFT 合约执行过程中遇到错误 [Out of gas]? - Error encountered during Ethereum solidity NFT contract execution [Out of gas]? MetaMask - RPC 错误:执行恢复 {code: -32000, message: 'execution reverted'} 在尝试连接到智能合约时 - MetaMask - RPC Error: execution reverted {code: -32000, message: 'execution reverted'} while trying to connect to smart contract 在智能合约 Fundme 中出现错误,错误是“VM 执行错误。恢复为 0x” - Getting an error in smart contract Fundme, The error is "VM execution error. Reverted to 0x" MetaMask - RPC 错误:执行恢复{代码:-32000,消息:&#39;执行恢复&#39;} - MetaMask - RPC Error: execution reverted {code: -32000, message: 'execution reverted'} Web3.js 返回错误:执行已恢复 - Web3.js returned error: execution reverted tokenOfOwnerByIndexERC721 时执行恢复错误 - Execution reverted error while tokenOfOwnerByIndexERC721 无法在安全帽上创建合约克隆。 “错误:交易恢复:function 调用非合约账户” - Unable to create contract clone on Hardhat. "Error: Transaction reverted: function call to a non-contract account" 从 next.js 调用智能合约时,RPC 错误:执行已恢复 - RPC Error: excution reverted" when calling smart contract from next.js 无法将合约从 web3 部署到 geth 节点,错误:交易已被 EVM 还原 - can't deploy contract from web3 to geth node , Error: Transaction has been reverted by the EVM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM