From 85fde8f9a525da4e397c940309d20257ff65bd45 Mon Sep 17 00:00:00 2001 From: Daniel Pyrathon Date: Mon, 19 Oct 2020 17:03:26 -0700 Subject: [PATCH] comments and renaming --- packages/asset-swapper/src/constants.ts | 8 +++++++- packages/asset-swapper/src/swap_quoter.ts | 4 ++-- .../src/utils/market_operation_utils/index.ts | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/asset-swapper/src/constants.ts b/packages/asset-swapper/src/constants.ts index 6b5bd1a792..745e816bbf 100644 --- a/packages/asset-swapper/src/constants.ts +++ b/packages/asset-swapper/src/constants.ts @@ -123,4 +123,10 @@ export const constants = { DEFAULT_WARNING_LOGGER, }; -export const ENABLE_PRICE_AWARE_RFQ: boolean = false; +// This feature flag allows us to merge the price-aware RFQ pricing +// project while still controlling when to activate the feature. We plan to do some +// data analysis work and address some of the issues with maker fillable amounts +// in later milestones. Once the feature is fully rolled out and is providing value +// and we have assessed that there is no user impact, we will proceed in cleaning up +// the feature flag. +export const IS_PRICE_AWARE_RFQ_ENABLED: boolean = false; diff --git a/packages/asset-swapper/src/swap_quoter.ts b/packages/asset-swapper/src/swap_quoter.ts index 0f55949545..e6c5513100 100644 --- a/packages/asset-swapper/src/swap_quoter.ts +++ b/packages/asset-swapper/src/swap_quoter.ts @@ -8,7 +8,7 @@ import { BlockParamLiteral, SupportedProvider, ZeroExProvider } from 'ethereum-t import * as _ from 'lodash'; import { artifacts } from './artifacts'; -import { constants, ENABLE_PRICE_AWARE_RFQ } from './constants'; +import { constants, IS_PRICE_AWARE_RFQ_ENABLED } from './constants'; import { CalculateSwapQuoteOpts, LiquidityForTakerMakerAssetDataPair, @@ -697,7 +697,7 @@ export class SwapQuoter { } if ( - !ENABLE_PRICE_AWARE_RFQ && // Price-aware RFQ is disabled. + !IS_PRICE_AWARE_RFQ_ENABLED && // Price-aware RFQ is disabled. opts.rfqt && // This is an RFQT-enabled API request opts.rfqt.intentOnFilling && // The requestor is asking for a firm quote opts.rfqt.apiKey && diff --git a/packages/asset-swapper/src/utils/market_operation_utils/index.ts b/packages/asset-swapper/src/utils/market_operation_utils/index.ts index c2a2af7c4b..6daf6d2b66 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/index.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/index.ts @@ -4,7 +4,7 @@ import { RFQTIndicativeQuote } from '@0x/quote-server'; import { SignedOrder } from '@0x/types'; import { BigNumber, NULL_ADDRESS } from '@0x/utils'; import * as _ from 'lodash'; -import { ENABLE_PRICE_AWARE_RFQ } from '../../constants'; +import { IS_PRICE_AWARE_RFQ_ENABLED } from '../../constants'; import { MarketOperation, Omit } from '../../types'; import { QuoteRequestor } from '../quote_requestor'; @@ -217,7 +217,7 @@ export class MarketOperationUtils { ), ); - const rfqtPromise = !ENABLE_PRICE_AWARE_RFQ && quoteSourceFilters.isAllowed(ERC20BridgeSource.Native) + const rfqtPromise = !IS_PRICE_AWARE_RFQ_ENABLED && quoteSourceFilters.isAllowed(ERC20BridgeSource.Native) ? getRfqtIndicativeQuotesAsync( nativeOrders[0].makerAssetData, nativeOrders[0].takerAssetData, @@ -364,7 +364,7 @@ export class MarketOperationUtils { this._liquidityProviderRegistry, ), ); - const rfqtPromise = !ENABLE_PRICE_AWARE_RFQ && quoteSourceFilters.isAllowed(ERC20BridgeSource.Native) + const rfqtPromise = !IS_PRICE_AWARE_RFQ_ENABLED && quoteSourceFilters.isAllowed(ERC20BridgeSource.Native) ? getRfqtIndicativeQuotesAsync( nativeOrders[0].makerAssetData, nativeOrders[0].takerAssetData, @@ -675,7 +675,7 @@ export class MarketOperationUtils { // If RFQ liquidity is enabled, make a request to check RFQ liquidity const { rfqt } = _opts; - if (ENABLE_PRICE_AWARE_RFQ && rfqt && rfqt.quoteRequestor && marketSideLiquidity.quoteSourceFilters.isAllowed(ERC20BridgeSource.Native)) { + if (IS_PRICE_AWARE_RFQ_ENABLED && rfqt && rfqt.quoteRequestor && marketSideLiquidity.quoteSourceFilters.isAllowed(ERC20BridgeSource.Native)) { // Calculate a suggested price. For now, this is simply the overall price of the aggregation. let comparisonPrice: BigNumber | undefined; if (optimizerResult) {