-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/scaled sell amount #115
base: main
Are you sure you want to change the base?
Conversation
}); | ||
|
||
initialBuyAmounts.map(async ({ asset, amount }) => { | ||
if (isAddressEqual(asset as Address, sellToken as Address) || amount.isZero()) { |
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.
are you sure if amount is zero you should return an amount?
src/auto-router.ts
Outdated
swapTarget: constants.AddressZero, | ||
buyAssetMinAmount: scaledSellAmounts[i]!, | ||
swapTarget: zeroAddress, | ||
buyAssetMinAmount: scaledSellAmounts[i], |
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.
you can use scaledAmount
here
src/auto-router.ts
Outdated
const scaledAmount = scaledSellAmounts[i] as BigNumber; | ||
|
||
// If asset is sell token or amount is zero, no swap needed | ||
if (isAddressEqual(asset as Address, sellToken as Address) || scaledAmount.isZero()) { |
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.
are you sure you need to use a quote with zero amount? Maybe you should skip it?
src/auto-router.ts
Outdated
|
||
const amounts = await this.indexRouter.burnAmount(indexToken, sellAmount); | ||
|
||
const quotes = await Promise.all( | ||
amounts.map(async ({ amount, asset }) => { | ||
if (!amount || amount.isZero() || asset.toLowerCase() === routerBuyToken.toLowerCase()) { | ||
if (isAddressEqual(asset as Address, routerBuyToken as Address) || !amount || amount.isZero()) { |
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.
!amount
I am not sure that amount can be nullable/undefined, can you check it please?
No description provided.