Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: filter out zero value quotes #180

Merged
merged 9 commits into from
Jul 10, 2023
Merged

Conversation

zhongeric
Copy link
Collaborator

@zhongeric zhongeric commented Jul 6, 2023

No description provided.

lib/entities/context/DutchQuoteContext.ts Outdated Show resolved Hide resolved
lib/entities/context/DutchQuoteContext.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@rileydcampbell rileydcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

// return either the rfq quote or a synthetic quote from the classic dependency
async resolve(dependencies: QuoteByKey): Promise<Quote | null> {
const quote = await this.resolveHandler(dependencies);
if (!quote || (quote as DutchQuote).amountOutEnd.eq(0)) return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!quote || (quote as DutchQuote).amountOutEnd.eq(0)) return null;
if (!quote || (quote as DutchQuote).amountOutEnd.lte(0)) return null;

maybe overkill ?

const quote = await context.resolve({
[QUOTE_REQUEST_DL.key()]: rfqQuote,
});
expect(quote).toMatchObject(rfqQuote);
expect((quote?.toJSON() as DutchQuoteDataJSON).orderInfo.exclusiveFiller).toEqual(filler);
});

it('returns null if quotes have 0 amountOut', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@zhongeric zhongeric merged commit 6881778 into main Jul 10, 2023
4 checks passed
@zhongeric zhongeric deleted the feat-filter-out-0-value-quotes branch July 10, 2023 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants