Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Check if there is an allowance already before trying to make one. #184

Closed
mfornet opened this issue Apr 2, 2021 · 2 comments
Closed

Check if there is an allowance already before trying to make one. #184

mfornet opened this issue Apr 2, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mfornet
Copy link

mfornet commented Apr 2, 2021

Suppose the following scenario happens:

  1. User sets an allowance from the ERC20 token to the Locker in the frontend successfully
  2. User tries to call lock on the Locker but it fails for any reason (timeout, low fees, or something else)

There is no way to recover from that state in case of failure in the second step, and frontend will ask to set a new allowance. Instead the contract should check first if such allowance exist, and not ask for it in case it exists and is enough. Right now users should submit a second transaction to set a new allowance which is suboptimal.

@mfornet mfornet added the bug Something isn't working label Apr 2, 2021
@paouvrard paouvrard mentioned this issue Apr 8, 2021
@paouvrard
Copy link
Member

I cannot reproduce this. If approval succeded but lock fails, then retrying lock will not prompt for setting allowance again but retry the lock.
If the lock tx fails for any reason, the user is able to retry the lock tx.
If the lock tx fails because allowance is not enough to make the lock (user used it in another app):
It would be confusing to request approval again since approval is already marked as succeeded.
This is quite a rare scenario, so the process can be for the user to remove this transfer which was not started (not locked) and try a new one.

@mfornet
Copy link
Author

mfornet commented Apr 19, 2021

Ok, if I find a new report about this, will inspect further and give you conditions to reproduce.

@mfornet mfornet closed this as completed Apr 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants