如何解决可靠性:“错误:数字值无效”,即使在引号内使用数字值,为什么?
我正在学习以太坊精读本,然后做一个练习,创建合约,在那里接收以太坊并撤回合约。但是考虑到我已按照所有步骤进行操作,我遇到了一个错误,我不知道为什么。
代码:
// Version of Solidity compiler this program was written for
pragma solidity ^0.6.0;
// Our first contract is a faucet!
contract Faucet {
// Accept any incoming amount
receive () external payable {}
// Give out ether to anyone who asks
function withdraw(uint withdraw_amount) public {
// Limit withdrawal amount
require(withdraw_amount <= 100000000000000000);
// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
}
}
在撤消功能字段上输入“ 100000000000000000”后的错误:
transact to Faucet.withdraw errored: Error encoding arguments: Error: invalid number value (arg="",coderType="uint256",value="1.0000000000000000",version=4.0.47)
这是我的屏幕:
我只是遵循“精通以太坊”书中的确切代码描述,这是我使用引号的原因:
为什么?
解决方法
尝试在不带引号的情况下输入值。如果在带引号的情况下将值输入copiler或EVM识别为字符串,则输入数字。不带引号。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。