Update ETH Token List (#1498)

* update ETH token list (as of April 11th, 2018)

* fix SMT duplicated tokens

* adjust tokens test to gather errors instead of failing on first test

* separate duplicate tokens

* update token list (april 13th, 2018)
This commit is contained in:
Daniel Ternyak 2018-04-13 12:14:29 -05:00 committed by GitHub
parent 574c628e61
commit f63bd92edf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2873 additions and 367 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,18 +9,21 @@ describe('Tokens JSON', () => {
const tokens = (TOKENS as any)[network]; const tokens = (TOKENS as any)[network];
const addressCollisionMap: any = {}; const addressCollisionMap: any = {};
const symbolCollisionMap: any = {}; const symbolCollisionMap: any = {};
const validationErrors: string[] = [];
tokens.forEach((token: any) => { tokens.forEach((token: any) => {
if (!isValidETHAddress(token.address)) { if (!isValidETHAddress(token.address)) {
throw Error(`Token ${token.symbol} has invalid contract address '${token.address}'`); validationErrors.push(
`Token ${token.symbol} has invalid contract address '${token.address}'`
);
} }
if (addressCollisionMap[token.address]) { if (addressCollisionMap[token.address]) {
throw Error( validationErrors.push(
`Token ${token.symbol} has the same address as ${addressCollisionMap[token.address]}` `Token ${token.symbol} has the same address as ${addressCollisionMap[token.address]}`
); );
} }
if (symbolCollisionMap[token.symbol]) { if (symbolCollisionMap[token.symbol]) {
throw Error( validationErrors.push(
`Symbol ${token.symbol} is repeated between tokens at ${token.address} and ${ `Symbol ${token.symbol} is repeated between tokens at ${token.address} and ${
symbolCollisionMap[token.symbol] symbolCollisionMap[token.symbol]
}` }`
@ -32,11 +35,14 @@ describe('Tokens JSON', () => {
token.decimal === null || token.decimal === null ||
token.decimal === undefined token.decimal === undefined
) { ) {
throw Error(`Token ${token.symbol} has invalid decimal '${token.decimal}'`); validationErrors.push(`Token ${token.symbol} has invalid decimal '${token.decimal}'`);
} }
addressCollisionMap[token.address] = token.symbol; addressCollisionMap[token.address] = token.symbol;
symbolCollisionMap[token.symbol] = token.address; symbolCollisionMap[token.symbol] = token.address;
}); });
if (validationErrors.length > 0) {
throw Error(validationErrors.join('\n'));
}
}); });
}); });
}); });