I have very simple solidity code as below -
pragma solidity ^0.5.6;
contract SaveData {
uint public salary;
function setSalary(uint input) public {
salary=input;
}
function getSalary() public view returns(uint) {
return salary;
}
}
I am calling savedata.setSalary(5000)
from eth console. It generates a transaction. However after mining the transaction when I ran savedata.getSalary()
it always return me 0. I tried allocating a lot of GAS as well.
await
for the function to complete, or resolve the promise it returns before you read the state variable. – goodvibration Mar 26 '19 at 11:15