skip scam check on whitelisted tokens

This commit is contained in:
OmarHatem 2025-04-11 14:51:19 +02:00
parent c0283a37ee
commit 277dde4614
2 changed files with 8 additions and 7 deletions

View file

@ -207,15 +207,15 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
onPressed: () async {
if (_formKey.currentState!.validate() &&
(!_showDisclaimer || _disclaimerChecked)) {
final hasPotentialError = await widget.homeSettingsViewModel
final isWhitelisted = await widget.homeSettingsViewModel
.checkIfTokenIsWhitelisted(_contractAddressController.text);
final hasPotentialError = !isWhitelisted && await widget.homeSettingsViewModel
.checkIfERC20TokenContractAddressIsAPotentialScamAddress(
_contractAddressController.text,
);
final isWhitelisted = await widget.homeSettingsViewModel
.checkIfTokenIsWhitelisted(_contractAddressController.text);
bool isPotentialScam = hasPotentialError;
bool isPotentialScam = hasPotentialError && !isWhitelisted;
final tokenSymbol = _tokenSymbolController.text.toUpperCase();
// check if the token symbol is the same as any of the base currencies symbols (ETH, SOL, POL, TRX, etc):
@ -258,7 +258,7 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
}
};
if (hasPotentialError) {
if (hasPotentialError && !isWhitelisted) {
showPopUp<void>(
context: context,
builder: (dialogContext) {

View file

@ -221,7 +221,8 @@ abstract class HomeSettingsViewModelBase with Store {
}
// check if the contractAddress is in the defaultTokenAddresses
bool isInWhitelist = defaultTokenAddresses.any((element) => element == contractAddress);
bool isInWhitelist = defaultTokenAddresses
.any((element) => element.toLowerCase() == contractAddress.toLowerCase());
return isInWhitelist;
}