Skip to content

estimateGas uses constant 21.9 gwei gasPrice for estimateGas #39

@wjmelements

Description

@wjmelements

GASPRICE being an Ethereum opcode (3a), it is important to supply the correct gasPrice parameter, else you will estimate the wrong amount of gas.

An example of a token that conditions on GASPRICE is TrueUSD, which spends an additional ~21k gas if the GASPRICE is sufficiently high. Supplying insufficient gas will cause the transaction to revert. Even when the amount supplied is sufficient, there is danger that transactions that estimateGas with a different gasPrice than they pay could fail deterministically.

You might also consider padding the estimated gasLimit by 50%, which is what MetaMask does, except for regular eth transfers to accounts that aren't contracts. MetaMask checks if the recipient is a contract using eth_getCode.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions