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:
parent
1cc59ab1ab
commit
a045a3afb8
@ -13,6 +13,10 @@
|
||||
{
|
||||
"note": "Add Velodrome support on Optimism",
|
||||
"pr": 494
|
||||
},
|
||||
{
|
||||
"note": "Do not send empty entries on Quote Report",
|
||||
"pr": 501
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -207,7 +207,7 @@ export function generateExtendedQuoteReportSources(
|
||||
..._.flatten(
|
||||
quotes.dexQuotes.map(dex =>
|
||||
dex
|
||||
.filter(quote => isDexSampleForTotalAmount(quote, amount))
|
||||
.filter(quote => isDexSampleFilter(quote, amount))
|
||||
.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
|
||||
* NOTE: this is used for the QuoteReport to filter samples
|
||||
*/
|
||||
function isDexSampleForTotalAmount(ds: DexSample, amount: BigNumber): boolean {
|
||||
return ds.input.eq(amount);
|
||||
function isDexSampleFilter(ds: DexSample, amount: BigNumber): boolean {
|
||||
// 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user