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

fix(swap): change limit when pool change #2763

Merged
merged 8 commits into from
Oct 12, 2023

Conversation

banklesss
Copy link
Contributor

@banklesss banklesss commented Oct 12, 2023

Related to YOMO-857

@banklesss banklesss self-assigned this Oct 12, 2023
@banklesss banklesss added this to the 5.0.0 milestone Oct 12, 2023
@stackchain
Copy link
Member

I believe this should happen at the state level.

@banklesss
Copy link
Contributor Author

I believe this should happen at the state level.

i will take a look

Copy link
Contributor

@jorbuedo jorbuedo left a comment

Choose a reason for hiding this comment

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

Should be a 1 line change inside

      case SwapCreateOrderActionType.SelectedPoolChanged:

@banklesss
Copy link
Contributor Author

Working on it already

case SwapCreateOrderActionType.SelectedPoolChanged:
        if (state.orderData.type === 'market') break

        draft.orderData.selectedPoolId = action.poolId

        draft.orderData.selectedPoolCalculation =
          selectedPoolCalculationSelector(draft.orderData)

        if (draft.orderData.selectedPoolCalculation === undefined) break

        draft.orderData.amounts.buy =
          draft.orderData.selectedPoolCalculation.sides.buy

        draft.orderData.limitPrice = getMarketPrice(
          draft.orderData.selectedPoolCalculation.pool,
          draft.orderData.selectedPoolCalculation.sides.sell,
        )
        break

@banklesss banklesss force-pushed the fix/change-limit-when-pool-change branch from d4e434a to f4e35e1 Compare October 12, 2023 11:41
@banklesss banklesss requested a review from jorbuedo October 12, 2023 11:42
banklesss and others added 2 commits October 12, 2023 16:04
Co-authored-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com>
Signed-off-by: banklesss <105349292+banklesss@users.noreply.github.com>
Co-authored-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com>
Signed-off-by: banklesss <105349292+banklesss@users.noreply.github.com>
Signed-off-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com>
Signed-off-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com>
@stackchain stackchain merged commit 24b8dcc into develop Oct 12, 2023
@stackchain stackchain deleted the fix/change-limit-when-pool-change branch October 12, 2023 14:44
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.

4 participants