Skip to content

Commit

Permalink
Update gasUtils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcdb committed Jun 20, 2023
1 parent 72a42c0 commit 14a90fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/gasUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ export const getTransactionPrice = (
export const MIN_GAS_ESTIMATE = wei(21000, BASE_DECIMALS)

export const getGasEstimateWithBuffer = (gasLimit: Wei) => {
if (!gasLimit) return undefined
return gasLimit?.add(gasLimit?.mul(wei(GAS_LIMIT_BUFFER_MULTIPLIER, 0)).div(100)).toBN() ?? null
if (!gasLimit || gasLimit.eq(wei(0))) return undefined
return (
gasLimit?.add(gasLimit?.mul(wei(GAS_LIMIT_BUFFER_MULTIPLIER, 0)).div(100)).toBN() ?? undefined
)
}

export const getGasPriceFromProvider = async (provider: JsonRpcProvider) => {
Expand Down

0 comments on commit 14a90fe

Please sign in to comment.