From 1a9063a55b1ee9c345e8d330c4752ce137311fa9 Mon Sep 17 00:00:00 2001 From: Lawrence Forman Date: Wed, 11 Mar 2020 12:19:00 -0400 Subject: [PATCH] `@0x/asset-swapper`: Address review comments. --- .../src/utils/market_operation_utils/constants.ts | 4 ++-- .../src/utils/market_operation_utils/fills.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/asset-swapper/src/utils/market_operation_utils/constants.ts b/packages/asset-swapper/src/utils/market_operation_utils/constants.ts index c3a94add09..6a37a77850 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/constants.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/constants.ts @@ -28,8 +28,8 @@ export const DEFAULT_GET_MARKET_ORDERS_OPTS: GetMarketOrdersOpts = { runLimit: 2 ** 15, excludedSources: [], bridgeSlippage: 0.005, - maxFallbackSlippage: 0.1, - numSamples: 20, + maxFallbackSlippage: 0.05, + numSamples: 13, sampleDistributionBase: 1.05, feeSchedule: {}, gasSchedule: {}, diff --git a/packages/asset-swapper/src/utils/market_operation_utils/fills.ts b/packages/asset-swapper/src/utils/market_operation_utils/fills.ts index 74124da85a..0f7564330e 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/fills.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/fills.ts @@ -87,9 +87,9 @@ function nativeOrdersToPath( rate, adjustedRate, adjustedOutput, - index: path.length, flags: 0, - parent: path.length !== 0 ? path[path.length - 1] : undefined, + index: 0, // TBD + parent: undefined, // TBD source: ERC20BridgeSource.Native, fillData: { order }, }); @@ -131,8 +131,7 @@ function dexQuotesToPaths( : ZERO_AMOUNT; const adjustedOutput = side === MarketOperation.Sell ? output.minus(penalty) : output.plus(penalty); const rate = side === MarketOperation.Sell ? output.div(input) : input.div(output); - const adjustedRate = - side === MarketOperation.Sell ? output.minus(penalty).div(input) : input.div(output.plus(penalty)); + const adjustedRate = side === MarketOperation.Sell ? adjustedOutput.div(input) : input.div(adjustedOutput); path.push({ input,