-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add contract address validation for token swaps #10912
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
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
ui/app/ducks/swaps/swaps.js
Outdated
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.
[REQ] Could we add a jsdoc block to this function to describe its purpose briefly and expected parameters?
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.
Also because this doesn't interact with state or dispatch directly I think its better suited to be in the swaps utils file in the page folder. It can be directly exported from there instead of the testtables object
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.
Done.
…invalid contract address
brad-decker
left a comment
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.
LGTM, thanks!
Explanation
Add contract address validation for token swaps before sending it to blockchain. That is done in 2 ways:
Manual testing steps
Validation is triggered on the page with a quote:

It would be great to manually test scenarios that are covered in unit tests.
Screenshots and videos
Validation passed for TESTETH -> WETH on Testnet:

Contract address validation failed:
