From 5d8e35fb68dbd902cb8edbef5aea545f94e7d444 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 7 Oct 2020 12:01:43 -0400 Subject: [PATCH 1/2] asset-swapp: isBlacklisted in rfqtMakerInteraction --- packages/asset-swapper/src/utils/quote_requestor.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/asset-swapper/src/utils/quote_requestor.ts b/packages/asset-swapper/src/utils/quote_requestor.ts index ea889e5ebd..644ef1d8a6 100644 --- a/packages/asset-swapper/src/utils/quote_requestor.ts +++ b/packages/asset-swapper/src/utils/quote_requestor.ts @@ -337,10 +337,9 @@ export class QuoteRequestor { const result: Array<{ response: ResponseT; makerUri: string }> = []; await Promise.all( Object.keys(this._rfqtAssetOfferings).map(async url => { - if ( - this._makerSupportsPair(url, makerAssetData, takerAssetData) && - !rfqMakerBlacklist.isMakerBlacklisted(url) - ) { + if (rfqMakerBlacklist.isMakerBlacklisted(url)) { + this._infoLogger({ rfqtMakerInteraction: { url, quoteType, isBlacklisted: true } }); + } else if (this._makerSupportsPair(url, makerAssetData, takerAssetData)) { const requestParamsWithBigNumbers = { takerAddress: options.takerAddress, ...inferQueryParams(marketOperation, makerAssetData, takerAssetData, assetFillAmount), @@ -358,7 +357,8 @@ export class QuoteRequestor { : undefined, }; - const partialLogEntry = { url, quoteType, requestParams }; + const partialLogEntry = { url, quoteType, requestParams, isBlacklisted: false }; + const timeBeforeAwait = Date.now(); const maxResponseTimeMs = options.makerEndpointMaxResponseTimeMs === undefined From 6e954385cec5d7068a3ef5b89d0e0f58cd2df22f Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 8 Oct 2020 09:15:58 -0400 Subject: [PATCH 2/2] Include requestParams in maker-blacklisted log Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2726#discussion_r501332160 --- .../src/utils/quote_requestor.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/asset-swapper/src/utils/quote_requestor.ts b/packages/asset-swapper/src/utils/quote_requestor.ts index 644ef1d8a6..83d48e9bfa 100644 --- a/packages/asset-swapper/src/utils/quote_requestor.ts +++ b/packages/asset-swapper/src/utils/quote_requestor.ts @@ -334,31 +334,31 @@ export class QuoteRequestor { options: RfqtRequestOpts, quoteType: 'firm' | 'indicative', ): Promise> { + const requestParamsWithBigNumbers = { + takerAddress: options.takerAddress, + ...inferQueryParams(marketOperation, makerAssetData, takerAssetData, assetFillAmount), + }; + + // convert BigNumbers to strings + // so they are digestible by axios + const requestParams = { + ...requestParamsWithBigNumbers, + sellAmountBaseUnits: requestParamsWithBigNumbers.sellAmountBaseUnits + ? requestParamsWithBigNumbers.sellAmountBaseUnits.toString() + : undefined, + buyAmountBaseUnits: requestParamsWithBigNumbers.buyAmountBaseUnits + ? requestParamsWithBigNumbers.buyAmountBaseUnits.toString() + : undefined, + }; + const result: Array<{ response: ResponseT; makerUri: string }> = []; await Promise.all( Object.keys(this._rfqtAssetOfferings).map(async url => { - if (rfqMakerBlacklist.isMakerBlacklisted(url)) { - this._infoLogger({ rfqtMakerInteraction: { url, quoteType, isBlacklisted: true } }); + const isBlacklisted = rfqMakerBlacklist.isMakerBlacklisted(url); + const partialLogEntry = { url, quoteType, requestParams, isBlacklisted }; + if (isBlacklisted) { + this._infoLogger({ rfqtMakerInteraction: { ...partialLogEntry } }); } else if (this._makerSupportsPair(url, makerAssetData, takerAssetData)) { - const requestParamsWithBigNumbers = { - takerAddress: options.takerAddress, - ...inferQueryParams(marketOperation, makerAssetData, takerAssetData, assetFillAmount), - }; - - // convert BigNumbers to strings - // so they are digestible by axios - const requestParams = { - ...requestParamsWithBigNumbers, - sellAmountBaseUnits: requestParamsWithBigNumbers.sellAmountBaseUnits - ? requestParamsWithBigNumbers.sellAmountBaseUnits.toString() - : undefined, - buyAmountBaseUnits: requestParamsWithBigNumbers.buyAmountBaseUnits - ? requestParamsWithBigNumbers.buyAmountBaseUnits.toString() - : undefined, - }; - - const partialLogEntry = { url, quoteType, requestParams, isBlacklisted: false }; - const timeBeforeAwait = Date.now(); const maxResponseTimeMs = options.makerEndpointMaxResponseTimeMs === undefined