Skip to content

Conversation

@brunoguerios
Copy link
Member

@brunoguerios brunoguerios commented Dec 12, 2025

Closes #2452

@brunoguerios brunoguerios requested a review from franzns December 12, 2025 18:40
@brunoguerios brunoguerios self-assigned this Dec 12, 2025
@changeset-bot
Copy link

changeset-bot bot commented Dec 12, 2025

🦋 Changeset detected

Latest commit: 78dc526

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
backend Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brunoguerios brunoguerios requested a review from jubeira December 12, 2025 19:11
@brunoguerios
Copy link
Member Author

brunoguerios commented Dec 12, 2025

@jubeira - tagging you so you can provide feedback on the expected behavior:

Comparing this tenderly simulation with the SOR I found out that the SOR was applying rates to the bptAmountIn on the swapExit givenIn operation while on-chain math wasn’t.
The logical conclusion is that we shouldn’t consider rates on these cases, but I’m not sure of the expected behavior.
So, my assumption is that:

  • we shouldn’t take BPT priceRate into account when swapping it with its pool tokens (i.e. swapExit/swapJoin)
  • we should take BPT priceRate into account when swapping it with a token in another pool (i.e. regular swap in a nested pool)

Let me know if you think that makes sense.

@jubeira
Copy link

jubeira commented Dec 12, 2025

Yes, that's correct. In any case in a nested pool the rate of the bpt token will be consumed via a rate provider, so it shouldn't be a special case.

@brunoguerios brunoguerios marked this pull request as ready for review December 12, 2025 20:16
@brunoguerios brunoguerios changed the title SOR - Fix swap through CSP with remove liquidity step (WIP) SOR - Fix BPT rates on swap with add/remove liquidity step Dec 12, 2025
@franzns franzns merged commit b058441 into v3-canary Dec 12, 2025
1 check passed
@franzns franzns deleted the sor-fix-swap-with-remove-step branch December 12, 2025 20:50
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.

SOR - Swap not routing through QuantAMM despite better price

4 participants