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

Refactor nestedPoolState logic to fetch mainTokens from api #489

Merged
merged 3 commits into from
Nov 14, 2024

Conversation

brunoguerios
Copy link
Member

Closes #488

});
// mainTokens are pool tokens filtering out nested pools and phantomBPTs
const mainTokens = pool.poolTokens.flatMap((t) => {
if (t.nestedPool) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Think you need to filter the phantomBPT first, otherwise you get the mainTokens of the parent pool twice.

Also think about duplicated tokens. A usdc/bb-a-usd pool would have 2x usdc, do you need it twice or just once?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right about filtering out phantomBPT from the parent pool - I'll fix that.
But we don't have to worry about duplicate tokens as that's not supported by the SDK - it will fail in the validator. There shouldn't exist such a pool composition.

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the logic a bit to make it simpler and easier to read/understand

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good!

@brunoguerios brunoguerios merged commit 0117f7b into main Nov 14, 2024
4 checks passed
@brunoguerios brunoguerios deleted the 488-refactor-nested-pool-tokens branch November 14, 2024 18: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.

Refactor nested pool data schema to follow api update
2 participants