I am using the Hardhat console to test my smart contract, which worked flawlessly until I removed the getter functions I wrote for my public state variables in favor of the automatically generated view functions. For example, I had a function like this:
function getName() public view returns(string memory) {
return name;
}
Running Contract.getName()
returned my name variable as expected. However, after I removed this function and tried using Contract.name()
, I get an error saying cannot estimate gas; transaction may fail or may require manual gas limit
. What is this inconsistency?
By the way, I'm using ethers.js and the Hardhat console, and my contract is deployed to the Ropsten testnet.