警告!合约执行期间遇到错误 [已恢复]
Warning! Error encountered during contract execution [Reverted]
1)在存入ERC20配额时出现此消息错误的原因是什么?
“警告!合同执行期间遇到错误 [已恢复]”
2) 另外从我在调试时注意到的情况来看,它与存款时的 'require(b <= a)' 有关。
我还没有看到使用 'assert' 而不是 'require' 的令牌用于他们的 SafeMath,使用 'assert' 会针对同一问题显示不同的错误消息吗?或者我只是遗漏了什么?
What can cause this message error to appear while depositing ERC20 on allowance? "Warning! Error encountered during contract execution [Reverted]"
以实际合约执行为准。当合约产生无效操作码时会发生还原,很可能是由于 require()
、assert()
中的验证失败或直接使用 throw()
.
引发异常
最有可能的是,验证交易发送者是否被允许发送此数量的所有者代币,或者所有者是否有此数量的可用代币。
Would using 'assert' display different error message for the same problem?
assert()
不允许自定义错误消息。
“警告!遇到错误...” 是来自您的 web3 的消息,而不是合同本身。当交易恢复时,它会显示相同的消息——无论它是因为 assert()
还是 require()
.
而恢复
1)在存入ERC20配额时出现此消息错误的原因是什么? “警告!合同执行期间遇到错误 [已恢复]”
2) 另外从我在调试时注意到的情况来看,它与存款时的 'require(b <= a)' 有关。 我还没有看到使用 'assert' 而不是 'require' 的令牌用于他们的 SafeMath,使用 'assert' 会针对同一问题显示不同的错误消息吗?或者我只是遗漏了什么?
What can cause this message error to appear while depositing ERC20 on allowance? "Warning! Error encountered during contract execution [Reverted]"
以实际合约执行为准。当合约产生无效操作码时会发生还原,很可能是由于 require()
、assert()
中的验证失败或直接使用 throw()
.
最有可能的是,验证交易发送者是否被允许发送此数量的所有者代币,或者所有者是否有此数量的可用代币。
Would using 'assert' display different error message for the same problem?
assert()
不允许自定义错误消息。
“警告!遇到错误...” 是来自您的 web3 的消息,而不是合同本身。当交易恢复时,它会显示相同的消息——无论它是因为 assert()
还是 require()
.