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

Check allowance before depositing and skip token.approve #1642

Closed
andrevmatos opened this issue Jun 6, 2020 · 0 comments · Fixed by #1643
Closed

Check allowance before depositing and skip token.approve #1642

andrevmatos opened this issue Jun 6, 2020 · 0 comments · Fixed by #1643
Assignees
Labels
enhancement New feature or request optimization ⚡ Optimizations for the implementation or protocol sdk 🖥

Comments

@andrevmatos
Copy link
Contributor

Description

Very small issue. We should check token's allowance before depositing (to UDC deposit, on channelOpen or channelDeposit. If it's enough, we should skip approve and deposit directly.
Metamask's UI allows the user to edit the allowance required (instead of the standard value provided to approve calls, which are usually exactly the amount to deposit in the LC). If we do check it, users planning to do multiple deposits (e.g. for tests) can edit the allowance on Metamask and put a (possibly very) high value there, and next deposits would only require the actual beneficiary contract transaction (UDC or TokenNetworks), saving a possibly long waiting time for approval.
Note that, if editing in Metamask UI, it's advisable to also increase in a couple of thousand the gas limit (advanced gas edit), as a different value can cause a different gas requirement and could make tx to fail.

Acceptance criteria

  • Deposit operations in SDK checks for allowance and skip approval if enough

Tasks

  • [ ]
@andrevmatos andrevmatos added enhancement New feature or request sdk 🖥 optimization ⚡ Optimizations for the implementation or protocol labels Jun 6, 2020
@andrevmatos andrevmatos self-assigned this Jun 6, 2020
@andrevmatos andrevmatos linked a pull request Jun 6, 2020 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request optimization ⚡ Optimizations for the implementation or protocol sdk 🖥
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant