go-sdk icon indicating copy to clipboard operation
go-sdk copied to clipboard

transaction underpriced

Open nanom1t opened this issue 2 years ago • 0 comments

Hi.

I get an error while sending transaction in Polygon network: "transaction underpriced" or "execution reverted".

tx, err := contract.Transfer(context.Background(), trx.ToAddress, trx.Amount)
...
tx, err := contract.TransferBatch(context.Background(), transactions)

Looks like I need to increase gas price to send transaction.

I've found that transaction options are hardcoded to 2500000000 and maybe this is an issue:

block, err := provider.BlockByNumber(context.Background(), nil)
if err == nil && block.BaseFee() != nil {
tipCap, _ = big.NewInt(0).SetString("**2500000000**", 10)
baseFee := big.NewInt(0).Mul(block.BaseFee(), big.NewInt(2))
feeCap = big.NewInt(0).Add(baseFee, tipCap)
}

How can I fix this error?

Thanks

nanom1t avatar Oct 18 '22 06:10 nanom1t