Merge pull request #202 from poanetwork/detect-tokens-fix

(Fix) Detect tokens: handle undefined tokenAddresses
This commit is contained in:
Victor Baranov 2018-11-26 20:54:37 +03:00 committed by GitHub
commit 268cb4067e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,9 @@ class DetectTokensController {
this.web3.setProvider(this._network._provider)
const contracts = this.getContracts()
for (const contractAddress in contracts) {
if (contracts[contractAddress].erc20 && !(this.tokenAddresses.includes(contractAddress.toLowerCase()))) {
const isERC20 = contracts[contractAddress].erc20
const isIncluded = this.tokenAddresses ? this.tokenAddresses.includes(contractAddress.toLowerCase()) : false
if (isERC20 && !isIncluded) {
this.detectTokenBalance(contractAddress)
}
}