[英]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.