diff --git a/packages/asset-swapper/CHANGELOG.json b/packages/asset-swapper/CHANGELOG.json index 16e90e191a..81f87838c8 100644 --- a/packages/asset-swapper/CHANGELOG.json +++ b/packages/asset-swapper/CHANGELOG.json @@ -141,6 +141,10 @@ { "note": "Added `Shell`", "pr": 2722 + }, + { + "note": "Fix exchange proxy overhead gas being scaled by gas price", + "pr": 2723 } ] }, diff --git a/packages/asset-swapper/src/utils/swap_quote_calculator.ts b/packages/asset-swapper/src/utils/swap_quote_calculator.ts index 9ed44ba2c2..22f09fe4d6 100644 --- a/packages/asset-swapper/src/utils/swap_quote_calculator.ts +++ b/packages/asset-swapper/src/utils/swap_quote_calculator.ts @@ -25,10 +25,9 @@ import { GetMarketOrdersOpts, OptimizedMarketOrder, } from './market_operation_utils/types'; -import { getTokenFromAssetData, isSupportedAssetDataInOrders } from './utils'; - import { QuoteReport } from './quote_report_generator'; import { QuoteFillResult, simulateBestCaseFill, simulateWorstCaseFill } from './quote_simulation'; +import { getTokenFromAssetData, isSupportedAssetDataInOrders } from './utils'; // TODO(dave4506) How do we want to reintroduce InsufficientAssetLiquidityError? export class SwapQuoteCalculator { @@ -195,7 +194,8 @@ export class SwapQuoteCalculator { opts.gasSchedule, quoteReport, ); - const exchangeProxyOverhead = _opts.exchangeProxyOverhead(sourceFlags).toNumber(); + // Use the raw gas, not scaled by gas price + const exchangeProxyOverhead = opts.exchangeProxyOverhead(sourceFlags).toNumber(); swapQuote.bestCaseQuoteInfo.gas += exchangeProxyOverhead; swapQuote.worstCaseQuoteInfo.gas += exchangeProxyOverhead; return swapQuote;