Skip to content

Commit

Permalink
bugfix: block ERC721 on sync (#1005)
Browse files Browse the repository at this point in the history
* filter erc20 mainnet

* only filter mainnet
  • Loading branch information
estebanmino authored Aug 20, 2019
1 parent 89959ae commit 433b31e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/core/Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import AppConstants from './AppConstants';
import { store } from '../store';
import { renderFromTokenMinimalUnit, balanceToFiatNumber, weiToFiatNumber } from '../util/number';
import TransactionsNotificationManager from './TransactionsNotificationManager';
import contractMap from 'eth-contract-metadata';

const OPENSEA_API_KEY = process.env['MM_OPENSEA_KEY']; // eslint-disable-line dot-notation
const encryptor = new Encryptor();
Expand Down Expand Up @@ -277,9 +278,16 @@ class Engine {
allTokens[checksummedAddress] = {};
Object.keys(preferences.accountTokens[address]).forEach(
networkType =>
(allTokens[checksummedAddress][networkType] = preferences.accountTokens[address][networkType].map(
token => ({ ...token, address: toChecksumAddress(token.address) })
))
(allTokens[checksummedAddress][networkType] =
networkType !== 'mainnet'
? preferences.accountTokens[address][networkType]
: preferences.accountTokens[address][networkType]
.filter(({ address }) =>
contractMap[toChecksumAddress(address)]
? contractMap[toChecksumAddress(address)].erc20
: true
)
.map(token => ({ ...token, address: toChecksumAddress(token.address) })))
);
});
await AssetsController.update({ allTokens });
Expand Down

0 comments on commit 433b31e

Please sign in to comment.