diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-18 08:18:33 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-12-18 08:18:33 +0800 |
commit | 951fbc9b76faf6b0f9f44fd2b729bcb54cf9d565 (patch) | |
tree | 6a1979a9a611d2dca92d8e453b3315f0f59b4421 /packages/website/ts/blockchain.ts | |
parent | 89f368a8b8b2419f9f347ad20da94199d533fa26 (diff) | |
download | dexon-sol-tools-951fbc9b76faf6b0f9f44fd2b729bcb54cf9d565.tar dexon-sol-tools-951fbc9b76faf6b0f9f44fd2b729bcb54cf9d565.tar.gz dexon-sol-tools-951fbc9b76faf6b0f9f44fd2b729bcb54cf9d565.tar.bz2 dexon-sol-tools-951fbc9b76faf6b0f9f44fd2b729bcb54cf9d565.tar.lz dexon-sol-tools-951fbc9b76faf6b0f9f44fd2b729bcb54cf9d565.tar.xz dexon-sol-tools-951fbc9b76faf6b0f9f44fd2b729bcb54cf9d565.tar.zst dexon-sol-tools-951fbc9b76faf6b0f9f44fd2b729bcb54cf9d565.zip |
Temporarily pretend as if new WETH contracts are already whitelisted by tokenRegistry and put hacks behind the shouldDeprecateOldWethToken flag
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index a42b19cff..7a0d546b4 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -158,6 +158,12 @@ 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. + if (configs.shouldDeprecateOldWethToken && + tokenAddress === configs.newWrappedEthers[this.networkId]) { + return true; + } const tokenIfExists = await this.zeroEx.tokenRegistry.getTokenIfExistsAsync(tokenAddress); return !_.isUndefined(tokenIfExists); } @@ -598,12 +604,11 @@ export class Blockchain { // new canonical WETH. // TODO: Remove this hack once we've updated the TokenRegistries let address = t.address; - if (t.symbol === 'WETH') { - if (this.networkId === 1) { - address = '0xe495bcacaf29a0eb00fb67b86e9cd2a994dd55d8'; - } else if (this.networkId === 42) { - address = '0x739e78d6bebbdf24105a5145fa04436589d1cbd9'; - } + if (configs.shouldDeprecateOldWethToken && t.symbol === 'WETH') { + const newEtherTokenAddressIfExists = configs.newWrappedEthers[this.networkId]; + if (!_.isUndefined(newEtherTokenAddressIfExists)) { + address = newEtherTokenAddressIfExists; + } } const token: Token = { iconUrl, |