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

Nested pools release #448

Merged
merged 8 commits into from
Oct 30, 2024
Merged

Nested pools release #448

merged 8 commits into from
Oct 30, 2024

Conversation

johngrantuk
Copy link
Member

No description provided.

* V3 nested removes are always proportional.
* User must approve composite router to spend BPT token - See tests in test/v3/removeLiquidityNested for full flow.
* (Runs against a local Anvil fork)
* Note - remove transaction is not fully run in this example because we cannot use slot method to artificially give test account BPT balance.
Copy link
Member

@MattPereira MattPereira Oct 29, 2024

Choose a reason for hiding this comment

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

When we get around to the major refactor of examples, should be able to give test account BPT by performing an add liquidity behind the scenes in fork setup right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, exactly. Didn't want to get too deep into that at this stage.

Comment on lines +76 to +93
console.table({
tokensOut: queryOutput.amountsOut.map((a) => a.token.address),
amountsOut: queryOutput.amountsOut.map((a) => a.amount),
});
console.log(`BPT In: ${queryOutput.bptAmountIn.amount.toString()}`);

// Build the transaction data with slippage applied
const call = removeLiquidityNested.buildCall(
removeLiquidityNested.buildRemoveLiquidityInput(queryOutput, {
slippage,
}),
);

console.log('\nWith slippage applied:');
console.table({
tokensOut: call.minAmountsOut.map((a) => a.token.address),
minAmountsOut: call.minAmountsOut.map((a) => a.amount),
});
Copy link
Member

@MattPereira MattPereira Oct 29, 2024

Choose a reason for hiding this comment

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

Love the tables!
In some future refactor, maybe we combine them into single table that includes difference btwn query and minAmountsOut after slippage is applied to group data and make a little easier to digest

image

Copy link
Member

@MattPereira MattPereira Oct 29, 2024

Choose a reason for hiding this comment

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

Hell of a lot easier to follow than makeForkTx 👏
Nice job exposing the approval steps!

Comment on lines +313 to +315
// TODO - Leave this in as useful as basis for manual debug
// await client.simulateContract({
// address:
Copy link
Member

Choose a reason for hiding this comment

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

❤️ ❤️ ❤️

Copy link
Member

@MattPereira MattPereira left a comment

Choose a reason for hiding this comment

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

Well done ser! 🍻

@johngrantuk johngrantuk merged commit c89ebc3 into main Oct 30, 2024
4 checks passed
@johngrantuk johngrantuk deleted the nested-pools-release branch October 30, 2024 09:41
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.

2 participants