mstable / mStable-apps

All mStable apps
GNU Lesser General Public License v3.0
14 stars 24 forks source link

[Staking App] Button to stake is activated despite needing ERC20 Approval first #152

Open dimsome opened 2 years ago

dimsome commented 2 years ago

Describe the bug The button "Stake" is clickable despite needing ERC-20 Approval first.

Screen Shot 2022-05-20 at 12 20 03

To Reproduce Steps to reproduce the behavior:

  1. Go to https://staking.mstable.app/#/stake
  2. Click on staking MTA or mBPT
  3. Enter the amount in stake App
  4. Lock appears, and is enabled, but "Stake" button is also clickable

Expected behavior Throwing the error is expected if there is a missing approval. However, the Stake button should not be activated until such approval has gone through. This results in users missing the approval button.

  1. Simple solution: deactivate the button until the approval is done. Replace text with "Allow the Staking contract to use your MTA" or "Allow the Staking contract to use your mBPT"
  2. Probably better solution: Add button above staking to create tx for approval.

See Uniswap example: Screen Shot 2022-05-20 at 12 19 40

Screenshots

Trying to send transactions without approval throws an error. Screen Shot 2022-05-20 at 12 13 43

dimsome commented 2 years ago

Non-consistent behaviour throughout the app, in another place e.g. Swap it's handled like this. We should consolidate the behaviour and make it consistent Screen Recording 2022-05-23 at 12 00 55 .