mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
skip scam check on whitelisted tokens
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user