I started learning solidity but when I use construct im getting the error, please help:
here's the code
pragma solidity >=0.7.0 <0.9.0;
contract base{
uint data;
constructor (uint _data) public {
data = _data;
}
function getData() public view returns(uint) {
return data;
}
}
Error – creation of Base errored: Error encoding arguments: Error:
invalid BigNumber string (argument="value", value="",
code=INVALID_ARGUMENT, version=bignumber/5.5.0)
Best Answer
Your contract works fine. As the two previous replies mentioned, you're "deploying" your contract with a void input. In other words, you haven't specified the value of your
data
.type any
uint
value in "deploy" section and it will work fine.All the best.