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:
parent
574c628e61
commit
f63bd92edf
File diff suppressed because it is too large
Load Diff
|
@ -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'));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue