Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
@0x/asset-swapper: Clean up median price calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
merklejerk committed Mar 9, 2020
1 parent 3d4cd22 commit 3e5f7de
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions packages/asset-swapper/src/utils/market_operation_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,15 @@ export class MarketOperationUtils {
takerToken,
),
// Get ETH -> maker token price.
makerToken === this._wethAddress
? DexOrderSampler.ops.constant(new BigNumber(1))
: DexOrderSampler.ops.getMedianSellRate(
difference(FEE_QUOTE_SOURCES, _opts.excludedSources).concat(
this._liquidityProviderSourceIfAvailable(_opts.excludedSources),
),
makerToken,
this._wethAddress,
ONE_ETHER,
this._liquidityProviderRegistry,
DexOrderSampler.ops.getMedianSellRate(
difference(FEE_QUOTE_SOURCES, _opts.excludedSources).concat(
this._liquidityProviderSourceIfAvailable(_opts.excludedSources),
),
makerToken,
this._wethAddress,
ONE_ETHER,
this._liquidityProviderRegistry,
),
// Get sell quotes for taker -> maker.
DexOrderSampler.ops.getSellQuotes(
difference(SELL_SOURCES, _opts.excludedSources).concat(
Expand Down Expand Up @@ -139,17 +137,15 @@ export class MarketOperationUtils {
takerToken,
),
// Get ETH -> taker token price.
takerToken === this._wethAddress
? DexOrderSampler.ops.constant(new BigNumber(1))
: DexOrderSampler.ops.getMedianSellRate(
difference(FEE_QUOTE_SOURCES, _opts.excludedSources).concat(
this._liquidityProviderSourceIfAvailable(_opts.excludedSources),
),
takerToken,
this._wethAddress,
ONE_ETHER,
this._liquidityProviderRegistry,
DexOrderSampler.ops.getMedianSellRate(
difference(FEE_QUOTE_SOURCES, _opts.excludedSources).concat(
this._liquidityProviderSourceIfAvailable(_opts.excludedSources),
),
takerToken,
this._wethAddress,
ONE_ETHER,
this._liquidityProviderRegistry,
),
// Get buy quotes for taker -> maker.
DexOrderSampler.ops.getBuyQuotes(
difference(BUY_SOURCES, _opts.excludedSources).concat(
Expand Down

0 comments on commit 3e5f7de

Please sign in to comment.