-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
janndriessen
commented
Dec 28, 2022
•
edited
Loading
edited
- 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] |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 }) |
There was a problem hiding this comment.
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
?