Chore: Do not send empty entries on Quote Report (#501)

* Chore: Do not send empty entries on Quote Report

* Changelog
This commit is contained in:
Jorge Pérez 2022-06-13 15:52:59 -05:00 committed by GitHub
parent 1cc59ab1ab
commit a045a3afb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -13,6 +13,10 @@
{ {
"note": "Add Velodrome support on Optimism", "note": "Add Velodrome support on Optimism",
"pr": 494 "pr": 494
},
{
"note": "Do not send empty entries on Quote Report",
"pr": 501
} }
] ]
}, },

View File

@ -207,7 +207,7 @@ export function generateExtendedQuoteReportSources(
..._.flatten( ..._.flatten(
quotes.dexQuotes.map(dex => quotes.dexQuotes.map(dex =>
dex dex
.filter(quote => isDexSampleForTotalAmount(quote, amount)) .filter(quote => isDexSampleFilter(quote, amount))
.map(quote => dexSampleToReportSource(quote, marketOperation)), .map(quote => dexSampleToReportSource(quote, marketOperation)),
), ),
), ),
@ -306,8 +306,9 @@ export function dexSampleToReportSource(ds: DexSample, marketOperation: MarketOp
* Checks if a DEX sample is the one that represents the whole amount requested by taker * Checks if a DEX sample is the one that represents the whole amount requested by taker
* NOTE: this is used for the QuoteReport to filter samples * NOTE: this is used for the QuoteReport to filter samples
*/ */
function isDexSampleForTotalAmount(ds: DexSample, amount: BigNumber): boolean { function isDexSampleFilter(ds: DexSample, amount: BigNumber): boolean {
return ds.input.eq(amount); // The entry is for the total amont, not a sampler entry && there was liquidity in the source
return ds.input.eq(amount) && ds.output.isGreaterThan(0);
} }
/** /**