Generic Token Fixes (#2873)

* feat: Automatically detect wallet tokens for EVM chains

* feat: Disable potential tg scam tokens by default

* feat: Add homoglyph normalization to detect spoofing attacks in token symbols

* refactor: Improve scam token detection and apply to automatically fetched EVM tokens

* refactor: Enhance scam detection for automatically detected tokens in evm wallets

* feat: Add fiat check to scam checks on automatically imported token and disable tokens that fail the check

* feat: Add fiat check to scam checks on automatically imported token and disable tokens that fail the check

* feat: Add fiat check to scam checks on automatically imported token and disable tokens that fail the check

* feat: Enable whitelisted tokens with balance when importing wallet tokens

* feat: Disable imported tokens with balance less than 0.1 usd

* feat: Disable imported tokens with balance less than 0.1 usd
- Update configure file

* fixes:
- default tokens marked as potential scam
- ui overflow for token name on balance page
- add more filters for spam tokens
This commit is contained in:
David Adegoke
2026-02-07 12:53:43 +01:00
committed by GitHub
parent d8a6766090
commit fa5149af7f
3 changed files with 60 additions and 55 deletions
+14 -6
View File
@@ -442,8 +442,6 @@ abstract class EVMChainWalletBase
}
bool isTokenPropertiesSuspicious(Erc20Token token) {
final baseCurrencySymbols = CryptoCurrency.all.map((e) => e.title.toUpperCase()).toList();
bool isTokenWhitelisted = getDefaultTokenContractAddresses
.any((element) => element.toLowerCase() == token.contractAddress.toLowerCase());
@@ -459,10 +457,18 @@ abstract class EVMChainWalletBase
'http',
'https',
'.com',
'.org',
'.top',
'.live',
'airdrop',
'reward',
'distribution',
'www',
'.xyz',
'🎁',
'bot',
'claim',
'reward',
];
final hasSuspiciousData = suspiciousStrings.any(
@@ -472,11 +478,10 @@ abstract class EVMChainWalletBase
normalizedTitle.toLowerCase().contains(element),
);
// Check if the token symbol is the same as any of the base currencies symbols (ETH, SOL, POL, TRX, etc).
// If it is, then it's probably a scam unless it's in the whitelist.
final hasSuspiciousSymbol = baseCurrencySymbols.contains(normalizedSymbol);
final nativeSymbol = currency.title.toUpperCase();
final hasSuspiciousSymbol = normalizedSymbol == nativeSymbol && !isTokenWhitelisted;
return hasSuspiciousData || (hasSuspiciousSymbol && !isTokenWhitelisted);
return hasSuspiciousData || hasSuspiciousSymbol;
}
Future<void> _checkForExistingScamTokens() async {
@@ -1287,6 +1292,9 @@ abstract class EVMChainWalletBase
}
Future<void> addErc20Token(Erc20Token token) async {
final isSuspicious = isTokenPropertiesSuspicious(token);
token.isPotentialScam = token.isPotentialScam || isSuspicious;
String? iconPath;
if ((token.iconPath == null || token.iconPath!.isEmpty) && !token.isPotentialScam) {