Everyone. I deployed this smart contract on Avalanche Testnet.
contract Storage {
uint256 number;
/**
* @dev Store value in variable
* @param num value to store
*/
function store(uint256 num) public {
number = num;
}
/**
* @dev Return value
* @return value of 'number'
*/
function retrieve() public view returns (uint256){
return number;
}
}
I'm trying to call write function("store" in this contract) using Nethereum.
Task<BigInteger> retrieveFunction = tmpContract.GetFunction("retrieve").CallAsync<BigInteger>();
retrieveFunction.Wait();
int result1 = (int)retrieveFunction.Result;
//Prompts for the account address.
Console.Write("Current stored amount: {0}\n", result1);
string accountAddress = "0xa40e61095202Afe72dFfc4Aae70bc631429293B2";
BigInteger value = 450000;
try
{
Task<string> storeFunction = tmpContract.GetFunction("store").SendTransactionAsync(accountAddress, value);
storeFunction.Wait();
Console.WriteLine("Succesfully Stored!");
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e.Message);
}
As a result, retrieve function is working well but in store function side, occurs errors.