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

[Request for comment] Alow selected pool to be undefined #2729

Closed
wants to merge 2 commits into from

Conversation

jorbuedo
Copy link
Contributor

Let me know how you'd see this change.

WIP: No tests, no app changes yet.

@jorbuedo jorbuedo added wip Shows that a PR shouldn't be merge refactor waiting-approval labels Sep 28, 2023
@jorbuedo jorbuedo self-assigned this Sep 28, 2023
@stackchain
Copy link
Member

stackchain commented Sep 28, 2023

I was mapping all states yesterday, the suggested pool based on price is ok, but is not 100% correct it should be based on the price after the fee, cuz if you have pool products that are similar (bouncing around the same price), the fee + the amount that the user is trading are needed to actually find the best price, I'd say that the all pools calculations are also part of the state:

{
  createOrderData:...,
  unsignedTx:...,
  poolWithPrices: Swap.Pool[] & {calcs: {priceAfterFee: x, price: y, whateverelse: weneed}}
}

@stackchain
Copy link
Member

I was mapping all states yesterday, the suggested pool based on price is ok, but is not 100% correct it should be based on the price after the fee, cuz if you have pool products that are similar (bouncing around the same price), the fee + the amount that the user is trading are needed to actually find the best price, I'd say that the all pools calculations are also part of the state:

{
  createOrderData:...,
  unsignedTx:...,
  poolWithPrices: Swap.Pool[] & {calcs: {priceAfterFee: x, price: y, whateverelse: weneed}}
}

So the list displayed of pools should come from here, and it can have more important info such as the affected price for all pools, and the selected pool will become the index of this list or undefined.

@jorbuedo jorbuedo closed this Sep 28, 2023
@stackchain stackchain deleted the undefined-selected-pool branch February 6, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor wip Shows that a PR shouldn't be merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants