mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
skip scam check on whitelisted tokens
This commit is contained in:
parent
c0283a37ee
commit
277dde4614
2 changed files with 8 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue