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: ensure unstake max will unstake all user shares #12283

Conversation

nickewansmith
Copy link
Contributor

@nickewansmith nickewansmith commented Nov 13, 2024

Description

  1. This PR addresses a bug where when unstaking entire balance staked causes 1 share to be left in the vault that cannot be unstaked from the UI.
  2. The solution is for mobile only and is a quick fix, note that the issue currently exists in portfolio as well and will need to be fixed properly. We solve the issue by calling the getShares contract method to get the total user shares instead of converting the total assets into shares with the convertToShares contract method. We add the interface for the getShares contract method on the fly as it is not part of the contract abi in the stake-sdk where we get the contract instance from.

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/STAKE-867

Manual testing steps

  1. Stake some amount of ETH or have some ETH staked already
  2. Unstake All of the ETH
  3. When the transaction is successful, there should be no ETH listed for the Staked Ethereum asset value. It should be exactly 0 and not < .0001
  4. If there is an account that has 1 share left, it should now be able to exit that 1 share.

Screenshots/Recordings

Before

Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2024-11-13.at.17.58.39.mp4

After

Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2024-11-13.at.17.13.59.mp4

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@nickewansmith nickewansmith marked this pull request as ready for review November 14, 2024 00:01
@nickewansmith nickewansmith requested a review from a team as a code owner November 14, 2024 00:01
@nickewansmith nickewansmith added the Run Smoke E2E Triggers smoke e2e on Bitrise label Nov 14, 2024
Copy link
Contributor

github-actions bot commented Nov 14, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 22bdd42
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/0443ee8d-ff0f-4533-bfd7-b952eef39c2c

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@nickewansmith nickewansmith added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Nov 14, 2024
@nickewansmith nickewansmith added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Nov 14, 2024
Copy link
Contributor

github-actions bot commented Nov 14, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 85b2157
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/7aee3007-6d01-4d76-a800-8ef7db2fafb7

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link

sonarcloud bot commented Nov 14, 2024

@nickewansmith nickewansmith added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Nov 14, 2024
Copy link
Contributor

@amitabh94 amitabh94 left a comment

Choose a reason for hiding this comment

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

LGTM!

@nickewansmith nickewansmith added this pull request to the merge queue Nov 14, 2024
Merged via the queue into main with commit 42e2c7e Nov 14, 2024
49 checks passed
@nickewansmith nickewansmith deleted the STAKE-867-unstaking-max-amount-leaves-some-assets-still-to-be-unstaked branch November 14, 2024 15:36
@github-actions github-actions bot locked and limited conversation to collaborators Nov 14, 2024
@metamaskbot metamaskbot added the release-7.36.0 Issue or pull request that will be included in release 7.36.0 label Nov 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.36.0 Issue or pull request that will be included in release 7.36.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-stake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants