pendulum-chain / portal

The Pendulum/Amplitude portal UI
GNU General Public License v3.0
1 stars 1 forks source link

Remove 50% and Max from the Backstop pool withdraw UI #478

Closed prayagd closed 5 days ago

prayagd commented 1 month ago

Context

Currently the max values are not calculated properly in the Backstop pool(BSP) withdraw UI

Requirement

Note

This is both for the Pendulum and Foucoco deployment

Reference

Screenshot 2024-05-30 at 12 48 54 PM
prayagd commented 1 month ago

Hey team! Please add your planning poker estimate with Zenhub @ebma @Sharqiewicz @TorstenStueber

ebma commented 1 month ago

What does 'not calculated properly' mean? Can you give an example when it fails? Is removing the buttons the best idea to solve this though?

TorstenStueber commented 1 month ago

The way it was defined in the code (and I did not change this anymore when I took it over): the max button selects the maximum amount of tokens you could deposit in theory, i.e., 100% of your LP tokens. Similar for the 50% button.

However, that is not the actual maximum amount possible. In some situations you are not able to return all LP tokens because of some limits or because there are not enough tokens in the pool to return.

Here the argument is that the user would expect that the Max button does not select 100% of your LP tokens but the exact maximum of tokens you are able to return in this situation.

This kind of problem happens for four operations:

There is no function in the smart contracts to calculate these maximum values (and we can't add them, otherwise they become too big for pallet contracts).

That means that we would need to do the calculation of the current maximum amount in the UI. This is not trivial and I wanted to leave it out in the initial version of the Nabla UI.

TorstenStueber commented 1 month ago

What I mean: we should remove the 50% and Max buttons for all these four operations and not just for backstop pool withdrawals (and stated in this ticket).

prayagd commented 3 weeks ago

@TorstenStueber got it, updated the ticket