fix: exchange proxy overhead scaled by gas price (#2723)

This commit is contained in:
Jacob Evans 2020-10-06 21:09:46 +10:00 committed by GitHub
parent 7698f21517
commit cd9e408ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -141,6 +141,10 @@
{
"note": "Added `Shell`",
"pr": 2722
},
{
"note": "Fix exchange proxy overhead gas being scaled by gas price",
"pr": 2723
}
]
},

View File

@ -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;