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

Add component quotes provider #4

Merged
merged 4 commits into from
Dec 30, 2022

Conversation

janndriessen
Copy link
Collaborator

@janndriessen janndriessen commented Dec 28, 2022

  • Adds component quotes provider
  • Fixes issues with FlashMintZeroEx quotes e.g. when there is only one component and it is equal to the input/output token
  • Docs: indicate deprecated tokens


components.forEach((component, index) => {
const buyAmount = positions[index]
const sellAmount = positions[index]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking, here I should just be able to do something like amount = positions[index] right? Because it's always the same no matter if buy/sell?

if (buyToken === sellToken) {
const amount = isMinting ? buyAmount : sellAmount
const emptyResponse = this.getFakeZeroExResponse(amount)
quotePromises.push(emptyResponse)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My solution was to create this fake response which made the processing of results way easier and more flexible with different amounts of components.

* component and input/output token are the same.
*/
async getFakeZeroExResponse(amount: BigNumber): Promise<any> {
return Promise.resolve({ buyAmount: amount, data: '', sellAmount: amount })
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would it be ok to just pass an empty string for componentQuotes? @ckoopmann
Or should I rather add something like 0x0?

@janndriessen janndriessen merged commit 376889c into main Dec 30, 2022
@janndriessen janndriessen deleted the feat/add-components-quote-provider branch December 30, 2022 07:14
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.

1 participant