Temporarily pretend as if new WETH contracts are already whitelisted by tokenRegistry and put hacks behind the shouldDeprecateOldWethToken flag
This commit is contained in:
@@ -158,6 +158,12 @@ export class Blockchain {
|
|||||||
}
|
}
|
||||||
public async isAddressInTokenRegistryAsync(tokenAddress: string): Promise<boolean> {
|
public async isAddressInTokenRegistryAsync(tokenAddress: string): Promise<boolean> {
|
||||||
utils.assert(!_.isUndefined(this.zeroEx), 'ZeroEx must be instantiated.');
|
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);
|
const tokenIfExists = await this.zeroEx.tokenRegistry.getTokenIfExistsAsync(tokenAddress);
|
||||||
return !_.isUndefined(tokenIfExists);
|
return !_.isUndefined(tokenIfExists);
|
||||||
}
|
}
|
||||||
@@ -598,12 +604,11 @@ export class Blockchain {
|
|||||||
// new canonical WETH.
|
// new canonical WETH.
|
||||||
// TODO: Remove this hack once we've updated the TokenRegistries
|
// TODO: Remove this hack once we've updated the TokenRegistries
|
||||||
let address = t.address;
|
let address = t.address;
|
||||||
if (t.symbol === 'WETH') {
|
if (configs.shouldDeprecateOldWethToken && t.symbol === 'WETH') {
|
||||||
if (this.networkId === 1) {
|
const newEtherTokenAddressIfExists = configs.newWrappedEthers[this.networkId];
|
||||||
address = '0xe495bcacaf29a0eb00fb67b86e9cd2a994dd55d8';
|
if (!_.isUndefined(newEtherTokenAddressIfExists)) {
|
||||||
} else if (this.networkId === 42) {
|
address = newEtherTokenAddressIfExists;
|
||||||
address = '0x739e78d6bebbdf24105a5145fa04436589d1cbd9';
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const token: Token = {
|
const token: Token = {
|
||||||
iconUrl,
|
iconUrl,
|
||||||
|
@@ -19,6 +19,13 @@ export const configs = {
|
|||||||
lastLocalStorageFillClearanceDate: '2017-11-22',
|
lastLocalStorageFillClearanceDate: '2017-11-22',
|
||||||
lastLocalStorageTrackedTokenClearanceDate: '2017-12-13',
|
lastLocalStorageTrackedTokenClearanceDate: '2017-12-13',
|
||||||
isMainnetEnabled: true,
|
isMainnetEnabled: true,
|
||||||
|
shouldDeprecateOldWethToken: true,
|
||||||
|
// newWrappedEthers is temporary until we remove the shouldDeprecateOldWethToken flag
|
||||||
|
// and add the new WETHs to the tokenRegistry
|
||||||
|
newWrappedEthers: {
|
||||||
|
1: '0xe495bcacaf29a0eb00fb67b86e9cd2a994dd55d8',
|
||||||
|
42: '0x739e78d6bebbdf24105a5145fa04436589d1cbd9',
|
||||||
|
} as {[networkId: string]: string},
|
||||||
outdatedWrappedEthers: [
|
outdatedWrappedEthers: [
|
||||||
{
|
{
|
||||||
42: {
|
42: {
|
||||||
|
Reference in New Issue
Block a user