-
Notifications
You must be signed in to change notification settings - Fork 12
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
Nested Exit #107
Nested Exit #107
Conversation
brunoguerios
commented
Oct 17, 2023
•
edited
Loading
edited
- Add proportional nested exit
- Add single token nested exit
// TODO: previous implementation of nested exit didn't add an outputReferenceKey for the BPT token, | ||
// but if I remove it from here, peek logic fails. Need to investigate why. | ||
// Once we figure this out, we should be able to replace sortedTokens by sortedTokensWithoutBpt | ||
outputReferenceKeys: sortedTokens.map( | ||
(token) => | ||
100n + | ||
BigInt(poolsSortedByLevel.indexOf(pool)) * 10n + | ||
BigInt(sortedTokens.indexOf(token)), | ||
), |
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.
@johngrantuk - I'd like to highlight this part of the code here - at the end I think we'll need input from the SC team, but I'd like to run by someone internally first, to make sure there's nothing obvious that I'm missing regarding indexes, etc..
Basically it seems that relayerQueries ignores the outputReference index
I set and query fails if I remove the outputReference related to the BPT token, because it reads the incorrect amount.
On the other hand, having an outputReference related to the BPT token breaks the transaction itself.
To fix this, I first add it to the query and later remove when building the transaction.
It works, but I'd expect this kind of manipulation to not be necessary between query vs actual transaction.
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 able to replicate the same behavior for single token nested exit, so I decided to reach out to the SC team to check this out.