diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-20 06:36:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-20 06:36:37 +0800 |
commit | d1c36f50d5849e70e16b785f5fff8f58435536d7 (patch) | |
tree | 713c69e926fefa4953fa80fa98bc903ba94f6da3 /packages/website/ts/blockchain.ts | |
parent | c39ac903a972930d538f8fa3292c658201b1c5e5 (diff) | |
parent | 484312e677d1f1f1b280cdada92acddf5effd525 (diff) | |
download | dexon-sol-tools-d1c36f50d5849e70e16b785f5fff8f58435536d7.tar dexon-sol-tools-d1c36f50d5849e70e16b785f5fff8f58435536d7.tar.gz dexon-sol-tools-d1c36f50d5849e70e16b785f5fff8f58435536d7.tar.bz2 dexon-sol-tools-d1c36f50d5849e70e16b785f5fff8f58435536d7.tar.lz dexon-sol-tools-d1c36f50d5849e70e16b785f5fff8f58435536d7.tar.xz dexon-sol-tools-d1c36f50d5849e70e16b785f5fff8f58435536d7.tar.zst dexon-sol-tools-d1c36f50d5849e70e16b785f5fff8f58435536d7.zip |
Merge pull request #283 from 0xProject/createWethPage
Merge WETH page improvements into development
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index d3bf6dda4..481917934 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -158,6 +158,14 @@ export class Blockchain { } public async isAddressInTokenRegistryAsync(tokenAddress: string): Promise<boolean> { utils.assert(!_.isUndefined(this.zeroEx), 'ZeroEx must be instantiated.'); + // HACK: temporarily whitelist the new WETH token address `as if` they were + // already in the tokenRegistry. + // TODO: Remove this hack once we've updated the TokenRegistries + // Airtable task: https://airtable.com/tblFe0Q9JuKJPYbTn/viwsOG2Y97qdIeCIO/recv3VGmIorFzHBVz + if (configs.SHOULD_DEPRECATE_OLD_WETH_TOKEN && + tokenAddress === configs.NEW_WRAPPED_ETHERS[this.networkId]) { + return true; + } const tokenIfExists = await this.zeroEx.tokenRegistry.getTokenIfExistsAsync(tokenAddress); return !_.isUndefined(tokenIfExists); } @@ -597,13 +605,13 @@ export class Blockchain { // we deploy the new WETH page, everyone will re-fill their trackedTokens with the // new canonical WETH. // TODO: Remove this hack once we've updated the TokenRegistries + // Airtable task: https://airtable.com/tblFe0Q9JuKJPYbTn/viwsOG2Y97qdIeCIO/recv3VGmIorFzHBVz let address = t.address; - if (t.symbol === 'WETH') { - if (this.networkId === 1) { - address = '0xe495bcacaf29a0eb00fb67b86e9cd2a994dd55d8'; - } else if (this.networkId === 42) { - address = '0x739e78d6bebbdf24105a5145fa04436589d1cbd9'; - } + if (configs.SHOULD_DEPRECATE_OLD_WETH_TOKEN && t.symbol === 'WETH') { + const newEtherTokenAddressIfExists = configs.NEW_WRAPPED_ETHERS[this.networkId]; + if (!_.isUndefined(newEtherTokenAddressIfExists)) { + address = newEtherTokenAddressIfExists; + } } const token: Token = { iconUrl, |