0

Good day to you.
I'm using Nethereum.Generator.Console to automaticly generate bindings for ERC20 token smart contract.

I'm trying to call approve method for other contract to charge tokens from me.

This is my code:

var account = /* my account */;
var token = new ERC20TokenService(web3, erc20TokenAdress);

var tokenApproveResult = token.ApproveRequestAndWaitForReceiptAsync(new ApproveFunction
{
    Amount = amount,
    Spender = otherContractAddress,
    FromAddress = account.Address,
    GasPrice = Web3.Convert.ToWei(Globals.GasPrice)
}).Result;

Which throws insufficient funds for gas * price + value exception.

But I can clearly see the 'account is locked' error in my node logs.

How do I sign this request with my account? What am I doing wrong?

Edit:

public static decimal GasPrice = 0.00000002m;

Update 1:

I debugged and figured out transaction is indeed getting signed. Still getting 'not enough gas' error with few ETHs on my account. Gas price is stated above. What am I doing wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.