问题描述
我正在学习以太坊精读本,然后做一个练习,创建合约,在那里接收以太坊并撤回合约。但是考虑到我已按照所有步骤进行操作,我遇到了一个错误,我不知道为什么。
代码:
// 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识别为字符串,则输入数字。不带引号。