Fix exchangeProxyGasOverhead used to compute fallback orders (#215)

* Fix exchangeProxyGasOverhead used to compute fallback orders

* update changelog
This commit is contained in:
mzhu25 2021-05-03 20:41:21 -07:00 committed by GitHub
parent 9bede5d331
commit 4be4a1a30b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,10 @@
{
"note": "Add LUSD Curve pool",
"pr": 218
},
{
"note": "Fix exchangeProxyGasOverhead for fallback path",
"pr": 215
}
]
},

View File

@ -560,7 +560,12 @@ export class MarketOperationUtils {
// We create a fallback path that is exclusive of Native liquidity
// This is the optimal on-chain path for the entire input amount
const nonNativeFills = fills.filter(p => p.length > 0 && p[0].source !== ERC20BridgeSource.Native);
const nonNativeOptimalPath = await findOptimalPathAsync(side, nonNativeFills, inputAmount, opts.runLimit);
const nonNativeOptimalPath = await findOptimalPathAsync(side, nonNativeFills, inputAmount, opts.runLimit, {
...penaltyOpts,
exchangeProxyOverhead: (sourceFlags: number) =>
// tslint:disable-next-line: no-bitwise
penaltyOpts.exchangeProxyOverhead(sourceFlags | optimalPath.sourceFlags),
});
// Calculate the slippage of on-chain sources compared to the most optimal path
if (
nonNativeOptimalPath !== undefined &&