-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix ERC20 token approval #2018
Fix ERC20 token approval #2018
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2018 +/- ##
==========================================
- Coverage 95.96% 95.94% -0.02%
==========================================
Files 155 155
Lines 5896 5922 +26
Branches 1057 1121 +64
==========================================
+ Hits 5658 5682 +24
- Misses 179 181 +2
Partials 59 59
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked into much details of the tests. Sorry.
Rest in the comments. Function wise this should be fine. Therefore you get the approval (since this seems to be the convention).
79d1e11
to
29e17e3
Compare
29e17e3
to
ad639d9
Compare
ad639d9
to
1f203eb
Compare
Thanks for your adjustment! 🤗 |
Fixes #2010
Fixes UDC deposit part of #1908
Short description
This makes 2 important changes:
depositChannel
anddepositToUDC
), if the current allowance is less than required to deposit but different than0
, we must first set it to0
then set the needed allowance; this is a requirement on secure ERC20 contracts like RDNMaxUint256
(i.e. a very big number), trusting thespender
(i.e.TokenNetwork
contract andUserDeposit
contract, respectively); this way, only anapprove
per token is needed, and the following deposits can happen without the need to mineapprove
againconfig.minimumAllowance
to a small value, likeZero
, which will make it default to the strictly requesteddeposit
amount, and/or, on Metamask's prompt (perapprove
transaction), simply set theallowance
to any desired amount (as long as it's greater than or equal the requesteddeposit
, or else thedeposit
tx will fail)Additionally, this also refactor the
depositToUDC
logic, which was on the publicRaiden
class, to its own epic, and interact with it throughudcDeposit
async actions.Definition of Done
Steps to manually test the change (dApp)
approve
is now a very big numbergasLimit
), but on the next deposit, it'll be required to firstapprove(0)
and then the new value, which still defaults to a very big number