-
-
Notifications
You must be signed in to change notification settings - Fork 278
Add validation of suggested metadata on ERC20 wallet_watchAsset confirmation #1207
Description
Description
This issue aims to improve the reliability of suggested metadata for ERC20 tokens in the MetaMask extension by validating it against the metadata fetched directly from the chain during the wallet_watchAsset confirmation process.
Expected behavior
When the wallet_watchAsset function is invoked, the extension should compare the suggested metadata with the on-chain metadata before displaying the confirmation dialog. This ensures the provided metadata is accurate and trustworthy.
Proposed solution
Update the wallet_watchAsset function to fetch token metadata directly from the blockchain, such as token name, symbol, and decimals.
Compare the fetched metadata with the suggested metadata. If discrepancies are found, either display an error message or just use the on-chain metadata.
Potential drawbacks
This approach may introduce additional latency during the wallet_watchAsset process due to blockchain data fetching. However, the benefits of providing accurate token metadata outweigh the potential drawbacks.