interface icon indicating copy to clipboard operation
interface copied to clipboard

Gas estimation for auto slippage uses only 10% of actual gas cost

Open ZumZoom opened this issue 3 years ago • 0 comments

Bug Description

#4213 was supposed to add 10% extra buffer to the gas estimation but instead it cut gas estimation by 90%.

Steps to Reproduce

See the following code that multiplies dollar gas cost by 10%:

https://github.com/Uniswap/interface/blob/578360269407c5cda2cb475b012439f974d9629f/src/hooks/useAutoSlippageTolerance.ts#L19

https://github.com/Uniswap/interface/blob/578360269407c5cda2cb475b012439f974d9629f/src/hooks/useAutoSlippageTolerance.ts#L103-L106

Expected Behavior

This code should instead add 10% extra buffer to the dollar gas cost. For example by changing GAS_ESTIMATE_BUFFER constant like this:

const GAS_ESTIMATE_BUFFER = new Percent(110, 100) // 110%

ZumZoom avatar Sep 28 '22 12:09 ZumZoom