etherisc / depeg-ui

Web interface for depeg contracts
Apache License 2.0
2 stars 4 forks source link

Offer an option to create a higher approval for investing and insuring #97

Open christoph2806 opened 1 year ago

christoph2806 commented 1 year ago

Currently, you are asked to approve token transfers each time you purchase a policy or fund a riskpool. In DeFi it's pretty standard to give a high approval one time and use it many times afterwards. This comes at a certain risk because in case of a smart contract exploit, users funds would be at risk. Therefore I propose the following implementation:

  1. The current approval is displayed somewhere on the page. If the approval is higher than the current token balance, the balance is displayed in warning color or with a warning hint.
  2. Each time the user is asked for approval, a dialog offers the following three options:
    • Approve only the amount necessary for the next transaction
    • Approve the full current token balance
    • Approve an infinite amount, ie. maxInt

The user can select one of the options and then the approval is processed.

doerfli commented 1 year ago

This should also be done for the staking-ui

gebunu commented 1 year ago

agree with @doerfli this also happens in staking-ui