Add contract address validation for token swaps#10912
Merged
brad-decker merged 9 commits intoMetaMask:developfrom Apr 23, 2021
dan437:swaps-validation-weth
Merged
Add contract address validation for token swaps#10912brad-decker merged 9 commits intoMetaMask:developfrom dan437:swaps-validation-weth
brad-decker merged 9 commits intoMetaMask:developfrom
dan437:swaps-validation-weth
Conversation
Contributor
|
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. |
brad-decker
suggested changes
Apr 22, 2021
ui/app/ducks/swaps/swaps.js
Outdated
Contributor
There was a problem hiding this comment.
[REQ] Could we add a jsdoc block to this function to describe its purpose briefly and expected parameters?
Contributor
There was a problem hiding this comment.
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
…invalid contract address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
