MetaMask / MetaMask/core

Add validation of suggested metadata on ERC20 `wallet_watchAsset` confirmation

Open
#1,207 0 comments 0 reactions 2 assignees Claimed by @bergeron View on GitHub
team-assets team-wallet-api-platform
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.