Hello i have problem with simply smartcontract:
[Function("saveData")]
public class SmartContractDataFunc : FunctionMessage
{
[Parameter("uint256","_id", 1)]
public UInt64 Id { get; set; }
[Parameter("string", "_data", 2)]
public string Data { get; set; }
[Parameter("string", "_projectName", 3)]
public string ProjectName { get; set; }
}
function saveData(uint256 _id, string memory _data, string memory _projectName) public onlyAdmin {
dataRecords[_id] = DataRecord(_id, _data, _projectName);
}
and calling:
public async Task<TransactionReceipt> SaveDataAsync(SmartContractData dataRecord)
{
var handler = _web3.Eth.GetContractTransactionHandler<SmartContractDataFunc>();
var message = new SmartContractDataFunc()
{
Id = ulong.Parse(dataRecord.Id.ToString()),
Data = dataRecord.Data,
ProjectName = dataRecord.ProjectName,
AmountToSend = new HexBigInteger(0),
GasPrice = new HexBigInteger(await _web3.Eth.GasPrice.SendRequestAsync()),
//Gas = Nethereum.Web3.Web3.Convert.ToWei(new BigDecimal(0.00099), UnitConversion.EthUnit.Ether),
FromAddress = _sender,
Nonce = new HexBigInteger(await _web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(_sender)).Value + 1
};
var estimation = await handler.EstimateGasAsync(_contractAddress, message);
message.Gas = estimation != null ? estimation.Value : new HexBigInteger(1000000);
var x = await handler.SendRequestAndWaitForReceiptAsync(_contractAddress, message);
return x;
}
Nethereum Version Web3: v4.18, Autogen.ContractAbi: v4.11
I always receive error from title and System.ArgumentOutOfRangeException' in System.Private.CoreLib.dll
I managed this object with a lot of tries of changing parameters but it also not works. I also checked it on another contract, admin address, and it gives same result