Add more contract configs tests
This commit is contained in:
@@ -97,7 +97,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
|
|||||||
devUtils: '0x2d4a9abda7b8b3605c8dbd34e3550a7467c78287',
|
devUtils: '0x2d4a9abda7b8b3605c8dbd34e3550a7467c78287',
|
||||||
zrxVault: '0xa5bf6ac73bc40790fc6ffc9dbbbce76c9176e224',
|
zrxVault: '0xa5bf6ac73bc40790fc6ffc9dbbbce76c9176e224',
|
||||||
readOnlyProxy: '0xffd161026865ad8b4ab28a76840474935eec4dfa',
|
readOnlyProxy: '0xffd161026865ad8b4ab28a76840474935eec4dfa',
|
||||||
staking: '0x725bc2f8c85ed0289d3da79cde3125d33fc1d7e6',
|
staking: '0x8ec5a989a06432dace637c8d592727627a45a592',
|
||||||
stakingProxy: '0xb2ca5824630e526f0f3181a4ea0447c795a84411',
|
stakingProxy: '0xb2ca5824630e526f0f3181a4ea0447c795a84411',
|
||||||
},
|
},
|
||||||
42: {
|
42: {
|
||||||
@@ -119,7 +119,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
|
|||||||
devUtils: '0xb1863ac46ae23ec55d6eeb8ecc8815655ee638a8',
|
devUtils: '0xb1863ac46ae23ec55d6eeb8ecc8815655ee638a8',
|
||||||
zrxVault: '0xf36eabdfe986b35b62c8fd5a98a7f2aebb79b291',
|
zrxVault: '0xf36eabdfe986b35b62c8fd5a98a7f2aebb79b291',
|
||||||
readOnlyProxy: '0x25397d8aa7e6844dae70ee658fe072d45d6cf528',
|
readOnlyProxy: '0x25397d8aa7e6844dae70ee658fe072d45d6cf528',
|
||||||
staking: '0xa9290221e4632394e0209abe893a90f5445e1f23',
|
staking: '0xd67f2f346f6e85db70632d9f18f50e04192ab54d',
|
||||||
stakingProxy: '0x9e7eef766702c3d9056a3de779e5d9d976bc3bdb',
|
stakingProxy: '0x9e7eef766702c3d9056a3de779e5d9d976bc3bdb',
|
||||||
},
|
},
|
||||||
// NetworkId 50 represents our Ganache snapshot generated from migrations.
|
// NetworkId 50 represents our Ganache snapshot generated from migrations.
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import * as wrappers from '@0x/abi-gen-wrappers';
|
import * as wrappers from '@0x/abi-gen-wrappers';
|
||||||
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
||||||
|
import { ExchangeContract } from '@0x/contracts-exchange';
|
||||||
|
import { StakingContract, StakingProxyContract, ZrxVaultContract } from '@0x/contracts-staking';
|
||||||
import { EmptyWalletSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
|
import { EmptyWalletSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
|
||||||
import { AssetProxyId } from '@0x/types';
|
import { AssetProxyId } from '@0x/types';
|
||||||
import { logUtils, providerUtils } from '@0x/utils';
|
import { logUtils, providerUtils } from '@0x/utils';
|
||||||
@@ -8,11 +10,13 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
|
|||||||
import { SupportedProvider } from 'ethereum-types';
|
import { SupportedProvider } from 'ethereum-types';
|
||||||
|
|
||||||
// NOTE: add your own Infura Project ID to RPC urls before running
|
// NOTE: add your own Infura Project ID to RPC urls before running
|
||||||
|
const INFURA_PROJECT_ID = '';
|
||||||
|
|
||||||
const networkIdToRpcUrl = {
|
const networkIdToRpcUrl = {
|
||||||
1: 'https://mainnet.infura.io/v3/',
|
1: `https://mainnet.infura.io/v3/${INFURA_PROJECT_ID}`,
|
||||||
3: 'https://ropsten.infura.io/v3/',
|
3: `https://ropsten.infura.io/v3/${INFURA_PROJECT_ID}`,
|
||||||
4: 'https://rinkeby.infura.io/v3/',
|
4: `https://rinkeby.infura.io/v3/${INFURA_PROJECT_ID}`,
|
||||||
42: 'https://kovan.infura.io/v3/',
|
42: `https://kovan.infura.io/v3/${INFURA_PROJECT_ID}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
async function testContractConfigsAsync(provider: SupportedProvider): Promise<void> {
|
async function testContractConfigsAsync(provider: SupportedProvider): Promise<void> {
|
||||||
@@ -26,140 +30,234 @@ async function testContractConfigsAsync(provider: SupportedProvider): Promise<vo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const exchange = new wrappers.ExchangeContract(addresses.exchange, provider);
|
const exchange = new ExchangeContract(addresses.exchange, provider);
|
||||||
|
const exchangeV2 = new ExchangeContract(addresses.exchangeV2, provider);
|
||||||
const erc20Proxy = new wrappers.ERC20ProxyContract(addresses.erc20Proxy, provider);
|
const erc20Proxy = new wrappers.ERC20ProxyContract(addresses.erc20Proxy, provider);
|
||||||
const erc721Proxy = new wrappers.ERC721ProxyContract(addresses.erc721Proxy, provider);
|
const erc721Proxy = new wrappers.ERC721ProxyContract(addresses.erc721Proxy, provider);
|
||||||
const erc1155Proxy = new wrappers.ERC1155ProxyContract(addresses.erc1155Proxy, provider);
|
const erc1155Proxy = new wrappers.ERC1155ProxyContract(addresses.erc1155Proxy, provider);
|
||||||
const multiAssetProxy = new wrappers.MultiAssetProxyContract(addresses.multiAssetProxy, provider);
|
const multiAssetProxy = new wrappers.MultiAssetProxyContract(addresses.multiAssetProxy, provider);
|
||||||
const assetProxyOwner = new wrappers.AssetProxyOwnerContract(addresses.assetProxyOwner, provider);
|
const assetProxyOwner = new wrappers.AssetProxyOwnerContract(addresses.assetProxyOwner, provider);
|
||||||
|
const stakingProxy = new StakingProxyContract(addresses.stakingProxy, provider);
|
||||||
|
const stakingContract = new StakingContract(addresses.staking, provider);
|
||||||
|
const zrxVault = new ZrxVaultContract(addresses.zrxVault, provider);
|
||||||
|
|
||||||
// Verify Exchange configs
|
async function verifyExchangeV2ConfigsAsync(): Promise<void> {
|
||||||
const exchangeOwner = await exchange.owner.callAsync();
|
const exchangeOwner = await exchangeV2.owner.callAsync();
|
||||||
warnIfMismatch(exchangeOwner, assetProxyOwner.address, 'Unexpected Exchange owner');
|
warnIfMismatch(exchangeOwner, assetProxyOwner.address, 'Unexpected ExchangeV2 owner');
|
||||||
|
|
||||||
const registeredERC20Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
const registeredERC20Proxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
||||||
warnIfMismatch(registeredERC20Proxy, erc20Proxy.address, 'Unexpected ERC20Proxy registered in Exchange');
|
warnIfMismatch(registeredERC20Proxy, erc20Proxy.address, 'Unexpected ERC20Proxy registered in ExchangeV2');
|
||||||
|
|
||||||
const registeredERC721Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC721);
|
const registeredERC721Proxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.ERC721);
|
||||||
warnIfMismatch(registeredERC721Proxy, erc721Proxy.address, 'Unexpected ERC721Proxy registered in Exchange');
|
warnIfMismatch(registeredERC721Proxy, erc721Proxy.address, 'Unexpected ERC721Proxy registered in ExchangeV2');
|
||||||
|
|
||||||
const registeredERC1155Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC1155);
|
const registeredERC1155Proxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.ERC1155);
|
||||||
warnIfMismatch(registeredERC1155Proxy, erc1155Proxy.address, 'Unexpected ERC1155Proxy registered in Exchange');
|
warnIfMismatch(
|
||||||
|
registeredERC1155Proxy,
|
||||||
|
erc1155Proxy.address,
|
||||||
|
'Unexpected ERC1155Proxy registered in ExchangeV2',
|
||||||
|
);
|
||||||
|
|
||||||
const registeredMultiAssetProxy = await exchange.getAssetProxy.callAsync(AssetProxyId.MultiAsset);
|
const registeredMultiAssetProxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.MultiAsset);
|
||||||
warnIfMismatch(
|
warnIfMismatch(
|
||||||
registeredMultiAssetProxy,
|
registeredMultiAssetProxy,
|
||||||
multiAssetProxy.address,
|
multiAssetProxy.address,
|
||||||
'Unexpected MultiAssetProxy registered in Exchange',
|
'Unexpected MultiAssetProxy registered in ExchangeV2',
|
||||||
);
|
);
|
||||||
|
|
||||||
const registeredStaticCallProxy = await exchange.getAssetProxy.callAsync(AssetProxyId.StaticCall);
|
const registeredStaticCallProxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.StaticCall);
|
||||||
warnIfMismatch(
|
warnIfMismatch(
|
||||||
registeredStaticCallProxy,
|
registeredStaticCallProxy,
|
||||||
addresses.staticCallProxy,
|
addresses.staticCallProxy,
|
||||||
'Unexpected StaticCallProxy registered in Exchange',
|
'Unexpected StaticCallProxy registered in ExchangeV2',
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Verify ERC20Proxy configs
|
async function verifyExchangeV3ConfigsAsync(): Promise<void> {
|
||||||
const erc20ProxyOwner = await erc20Proxy.owner.callAsync();
|
const exchangeOwner = await exchange.owner.callAsync();
|
||||||
warnIfMismatch(erc20ProxyOwner, assetProxyOwner.address, 'Unexpected ERC20Proxy owner');
|
warnIfMismatch(exchangeOwner, assetProxyOwner.address, 'Unexpected Exchange owner');
|
||||||
|
|
||||||
const erc20AuthorizedAddresses = await erc20Proxy.getAuthorizedAddresses.callAsync();
|
const registeredERC20Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
||||||
warnIfMismatch(erc20AuthorizedAddresses.length, 2, 'Unexpected number of authorized addresses in ERC20Proxy');
|
warnIfMismatch(registeredERC20Proxy, erc20Proxy.address, 'Unexpected ERC20Proxy registered in Exchange');
|
||||||
|
|
||||||
const isExchangeAuthorizedInERC20Proxy = await erc20Proxy.authorized.callAsync(exchange.address);
|
const registeredERC721Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC721);
|
||||||
warnIfMismatch(isExchangeAuthorizedInERC20Proxy, true, 'Exchange not authorized in ERC20Proxy');
|
warnIfMismatch(registeredERC721Proxy, erc721Proxy.address, 'Unexpected ERC721Proxy registered in Exchange');
|
||||||
|
|
||||||
const isMAPAuthorizedInER20Proxy = await erc20Proxy.authorized.callAsync(multiAssetProxy.address);
|
const registeredERC1155Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC1155);
|
||||||
warnIfMismatch(isMAPAuthorizedInER20Proxy, true, 'MultiAssetProxy not authorized in ERC20Proxy');
|
warnIfMismatch(registeredERC1155Proxy, erc1155Proxy.address, 'Unexpected ERC1155Proxy registered in Exchange');
|
||||||
|
|
||||||
// Verify ERC721Proxy configs
|
const registeredMultiAssetProxy = await exchange.getAssetProxy.callAsync(AssetProxyId.MultiAsset);
|
||||||
const erc721ProxyOwner = await erc721Proxy.owner.callAsync();
|
warnIfMismatch(
|
||||||
warnIfMismatch(erc721ProxyOwner, assetProxyOwner.address, 'Unexpected ERC721Proxy owner');
|
registeredMultiAssetProxy,
|
||||||
|
multiAssetProxy.address,
|
||||||
|
'Unexpected MultiAssetProxy registered in Exchange',
|
||||||
|
);
|
||||||
|
|
||||||
const erc721AuthorizedAddresses = await erc721Proxy.getAuthorizedAddresses.callAsync();
|
const registeredStaticCallProxy = await exchange.getAssetProxy.callAsync(AssetProxyId.StaticCall);
|
||||||
warnIfMismatch(erc721AuthorizedAddresses.length, 2, 'Unexpected number of authorized addresses in ERC721Proxy');
|
warnIfMismatch(
|
||||||
|
registeredStaticCallProxy,
|
||||||
|
addresses.staticCallProxy,
|
||||||
|
'Unexpected StaticCallProxy registered in Exchange',
|
||||||
|
);
|
||||||
|
|
||||||
const isExchangeAuthorizedInERC721Proxy = await erc721Proxy.authorized.callAsync(exchange.address);
|
const protocolFeeCollector = await exchange.protocolFeeCollector.callAsync();
|
||||||
warnIfMismatch(isExchangeAuthorizedInERC721Proxy, true, 'Exchange not authorized in ERC721Proxy');
|
warnIfMismatch(protocolFeeCollector, addresses.stakingProxy, 'Unexpected StakingProxy attached to Exchange');
|
||||||
|
|
||||||
const isMAPAuthorizedInER721Proxy = await erc721Proxy.authorized.callAsync(multiAssetProxy.address);
|
const protocolFeeMultiplier = await exchange.protocolFeeMultiplier.callAsync();
|
||||||
warnIfMismatch(isMAPAuthorizedInER721Proxy, true, 'MultiAssetProxy not authorized in ERC721Proxy');
|
warnIfMismatch(protocolFeeMultiplier.toString(), '150000', 'Unexpected protocolFeeMultiplier in Exchange');
|
||||||
|
}
|
||||||
|
|
||||||
// Verify ERC1155Proxy configs
|
async function verifyAssetProxyConfigsAsync(): Promise<void> {
|
||||||
const erc1155ProxyOwner = await erc1155Proxy.owner.callAsync();
|
// Verify ERC20Proxy configs
|
||||||
warnIfMismatch(erc1155ProxyOwner, assetProxyOwner.address, 'Unexpected ERC1155Proxy owner');
|
const erc20ProxyOwner = await erc20Proxy.owner.callAsync();
|
||||||
|
warnIfMismatch(erc20ProxyOwner, assetProxyOwner.address, 'Unexpected ERC20Proxy owner');
|
||||||
|
|
||||||
const erc1155AuthorizedAddresses = await erc1155Proxy.getAuthorizedAddresses.callAsync();
|
const erc20AuthorizedAddresses = await erc20Proxy.getAuthorizedAddresses.callAsync();
|
||||||
warnIfMismatch(erc1155AuthorizedAddresses.length, 2, 'Unexpected number of authorized addresses in ERC1155Proxy');
|
warnIfMismatch(erc20AuthorizedAddresses.length, 4, 'Unexpected number of authorized addresses in ERC20Proxy');
|
||||||
|
|
||||||
const isExchangeAuthorizedInERC1155Proxy = await erc1155Proxy.authorized.callAsync(exchange.address);
|
const isExchangeV2AuthorizedInERC20Proxy = await erc20Proxy.authorized.callAsync(exchangeV2.address);
|
||||||
warnIfMismatch(isExchangeAuthorizedInERC1155Proxy, true, 'Exchange not authorized in ERC1155Proxy');
|
warnIfMismatch(isExchangeV2AuthorizedInERC20Proxy, true, 'ExchangeV2 not authorized in ERC20Proxy');
|
||||||
|
|
||||||
const isMAPAuthorizedInER1155Proxy = await erc1155Proxy.authorized.callAsync(multiAssetProxy.address);
|
const isExchangeAuthorizedInERC20Proxy = await erc20Proxy.authorized.callAsync(exchange.address);
|
||||||
warnIfMismatch(isMAPAuthorizedInER1155Proxy, true, 'MultiAssetProxy not authorized in ERC1155Proxy');
|
warnIfMismatch(isExchangeAuthorizedInERC20Proxy, true, 'Exchange not authorized in ERC20Proxy');
|
||||||
|
|
||||||
// Verify MultiAssetProxy configs
|
const isMAPAuthorizedInER20Proxy = await erc20Proxy.authorized.callAsync(multiAssetProxy.address);
|
||||||
const multiAssetProxyOwner = await multiAssetProxy.owner.callAsync();
|
warnIfMismatch(isMAPAuthorizedInER20Proxy, true, 'MultiAssetProxy not authorized in ERC20Proxy');
|
||||||
warnIfMismatch(multiAssetProxyOwner, assetProxyOwner.address, 'Unexpected MultiAssetProxy owner');
|
|
||||||
|
|
||||||
const multiAssetProxyAuthorizedAddresses = await multiAssetProxy.getAuthorizedAddresses.callAsync();
|
const isZrxVaultAuthorizedInER20Proxy = await erc20Proxy.authorized.callAsync(zrxVault.address);
|
||||||
warnIfMismatch(
|
warnIfMismatch(isZrxVaultAuthorizedInER20Proxy, true, 'ZrxVault not authorized in ERC20Proxy');
|
||||||
multiAssetProxyAuthorizedAddresses.length,
|
|
||||||
1,
|
|
||||||
'Unexpected number of authorized addresses in MultiAssetProxy',
|
|
||||||
);
|
|
||||||
|
|
||||||
const isExchangeAuthorizedInMultiAssetProxy = await multiAssetProxy.authorized.callAsync(exchange.address);
|
// Verify ERC721Proxy configs
|
||||||
warnIfMismatch(isExchangeAuthorizedInMultiAssetProxy, true, 'Exchange not authorized in MultiAssetProxy');
|
const erc721ProxyOwner = await erc721Proxy.owner.callAsync();
|
||||||
|
warnIfMismatch(erc721ProxyOwner, assetProxyOwner.address, 'Unexpected ERC721Proxy owner');
|
||||||
|
|
||||||
const registeredERC20ProxyInMAP = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
const erc721AuthorizedAddresses = await erc721Proxy.getAuthorizedAddresses.callAsync();
|
||||||
warnIfMismatch(
|
warnIfMismatch(erc721AuthorizedAddresses.length, 3, 'Unexpected number of authorized addresses in ERC721Proxy');
|
||||||
registeredERC20ProxyInMAP,
|
|
||||||
erc20Proxy.address,
|
|
||||||
'Unexpected ERC20Proxy registered in MultiAssetProxy',
|
|
||||||
);
|
|
||||||
|
|
||||||
const registeredERC721ProxyInMAP = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC721);
|
const isExchangeV2AuthorizedInERC721Proxy = await erc721Proxy.authorized.callAsync(exchangeV2.address);
|
||||||
warnIfMismatch(
|
warnIfMismatch(isExchangeV2AuthorizedInERC721Proxy, true, 'ExchangeV2 not authorized in ERC721Proxy');
|
||||||
registeredERC721ProxyInMAP,
|
|
||||||
erc721Proxy.address,
|
|
||||||
'Unexpected ERC721Proxy registered in MultiAssetProxy',
|
|
||||||
);
|
|
||||||
|
|
||||||
const registeredERC1155ProxyInMAP = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC1155);
|
const isExchangeAuthorizedInERC721Proxy = await erc721Proxy.authorized.callAsync(exchange.address);
|
||||||
warnIfMismatch(
|
warnIfMismatch(isExchangeAuthorizedInERC721Proxy, true, 'Exchange not authorized in ERC721Proxy');
|
||||||
registeredERC1155ProxyInMAP,
|
|
||||||
erc1155Proxy.address,
|
|
||||||
'Unexpected ERC1155Proxy registered in MultiAssetProxy',
|
|
||||||
);
|
|
||||||
|
|
||||||
const registeredStaticCallProxyInMAP = await exchange.getAssetProxy.callAsync(AssetProxyId.StaticCall);
|
const isMAPAuthorizedInER721Proxy = await erc721Proxy.authorized.callAsync(multiAssetProxy.address);
|
||||||
warnIfMismatch(
|
warnIfMismatch(isMAPAuthorizedInER721Proxy, true, 'MultiAssetProxy not authorized in ERC721Proxy');
|
||||||
registeredStaticCallProxyInMAP,
|
|
||||||
addresses.staticCallProxy,
|
|
||||||
'Unexpected StaticCallProxy registered in MultiAssetProxy',
|
|
||||||
);
|
|
||||||
|
|
||||||
// Verify AssetProxyOwner configs
|
// Verify ERC1155Proxy configs
|
||||||
// TODO (xianny): re-enable when AssetProxyOwner contract is finalised
|
const erc1155ProxyOwner = await erc1155Proxy.owner.callAsync();
|
||||||
// const isERC20ProxyRegisteredInAPOwner = await assetProxyOwner.getAssetProxy.callAsync(erc20Proxy.address);
|
warnIfMismatch(erc1155ProxyOwner, assetProxyOwner.address, 'Unexpected ERC1155Proxy owner');
|
||||||
// warnIfMismatch(isERC20ProxyRegisteredInAPOwner, true, 'ERC20Proxy not registered in AssetProxyOwner');
|
|
||||||
|
|
||||||
// const isERC721ProxyRegisteredInAPOwner = await assetProxyOwner.getAssetProxy.callAsync(
|
const erc1155AuthorizedAddresses = await erc1155Proxy.getAuthorizedAddresses.callAsync();
|
||||||
// erc721Proxy.address,
|
warnIfMismatch(
|
||||||
// );
|
erc1155AuthorizedAddresses.length,
|
||||||
// warnIfMismatch(isERC721ProxyRegisteredInAPOwner, true, 'ERC721Proxy not registered in AssetProxyOwner');
|
3,
|
||||||
|
'Unexpected number of authorized addresses in ERC1155Proxy',
|
||||||
|
);
|
||||||
|
|
||||||
// const isERC1155ProxyRegisteredInAPOwner = await assetProxyOwner.getAssetProxy.callAsync(
|
const isExchangeV2AuthorizedInERC1155Proxy = await erc1155Proxy.authorized.callAsync(exchangeV2.address);
|
||||||
// erc1155Proxy.address,
|
warnIfMismatch(isExchangeV2AuthorizedInERC1155Proxy, true, 'ExchangeV2 not authorized in ERC1155Proxy');
|
||||||
// );
|
|
||||||
// warnIfMismatch(isERC1155ProxyRegisteredInAPOwner, true, 'ERC1155Proxy not registered in AssetProxyOwner');
|
|
||||||
|
|
||||||
// const isMultiAssetProxyRegisteredInAPOwner = await assetProxyOwner.getAssetProxy.callAsync(
|
const isExchangeAuthorizedInERC1155Proxy = await erc1155Proxy.authorized.callAsync(exchange.address);
|
||||||
// multiAssetProxy.address,
|
warnIfMismatch(isExchangeAuthorizedInERC1155Proxy, true, 'Exchange not authorized in ERC1155Proxy');
|
||||||
// );
|
|
||||||
// warnIfMismatch(isMultiAssetProxyRegisteredInAPOwner, true, 'MultiAssetProxy not registered in AssetProxyOwner');
|
const isMAPAuthorizedInER1155Proxy = await erc1155Proxy.authorized.callAsync(multiAssetProxy.address);
|
||||||
|
warnIfMismatch(isMAPAuthorizedInER1155Proxy, true, 'MultiAssetProxy not authorized in ERC1155Proxy');
|
||||||
|
|
||||||
|
// Verify MultiAssetProxy configs
|
||||||
|
const multiAssetProxyOwner = await multiAssetProxy.owner.callAsync();
|
||||||
|
warnIfMismatch(multiAssetProxyOwner, assetProxyOwner.address, 'Unexpected MultiAssetProxy owner');
|
||||||
|
|
||||||
|
const multiAssetProxyAuthorizedAddresses = await multiAssetProxy.getAuthorizedAddresses.callAsync();
|
||||||
|
warnIfMismatch(
|
||||||
|
multiAssetProxyAuthorizedAddresses.length,
|
||||||
|
2,
|
||||||
|
'Unexpected number of authorized addresses in MultiAssetProxy',
|
||||||
|
);
|
||||||
|
|
||||||
|
const isExchangeV2AuthorizedInMultiAssetProxy = await multiAssetProxy.authorized.callAsync(exchangeV2.address);
|
||||||
|
warnIfMismatch(isExchangeV2AuthorizedInMultiAssetProxy, true, 'ExchangeV2 not authorized in MultiAssetProxy');
|
||||||
|
|
||||||
|
const isExchangeAuthorizedInMultiAssetProxy = await multiAssetProxy.authorized.callAsync(exchange.address);
|
||||||
|
warnIfMismatch(isExchangeAuthorizedInMultiAssetProxy, true, 'Exchange not authorized in MultiAssetProxy');
|
||||||
|
|
||||||
|
const registeredERC20ProxyInMAP = await multiAssetProxy.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
||||||
|
warnIfMismatch(
|
||||||
|
registeredERC20ProxyInMAP,
|
||||||
|
erc20Proxy.address,
|
||||||
|
'Unexpected ERC20Proxy registered in MultiAssetProxy',
|
||||||
|
);
|
||||||
|
|
||||||
|
const registeredERC721ProxyInMAP = await multiAssetProxy.getAssetProxy.callAsync(AssetProxyId.ERC721);
|
||||||
|
warnIfMismatch(
|
||||||
|
registeredERC721ProxyInMAP,
|
||||||
|
erc721Proxy.address,
|
||||||
|
'Unexpected ERC721Proxy registered in MultiAssetProxy',
|
||||||
|
);
|
||||||
|
|
||||||
|
const registeredERC1155ProxyInMAP = await multiAssetProxy.getAssetProxy.callAsync(AssetProxyId.ERC1155);
|
||||||
|
warnIfMismatch(
|
||||||
|
registeredERC1155ProxyInMAP,
|
||||||
|
erc1155Proxy.address,
|
||||||
|
'Unexpected ERC1155Proxy registered in MultiAssetProxy',
|
||||||
|
);
|
||||||
|
|
||||||
|
const registeredStaticCallProxyInMAP = await multiAssetProxy.getAssetProxy.callAsync(AssetProxyId.StaticCall);
|
||||||
|
warnIfMismatch(
|
||||||
|
registeredStaticCallProxyInMAP,
|
||||||
|
addresses.staticCallProxy,
|
||||||
|
'Unexpected StaticCallProxy registered in MultiAssetProxy',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function verifyStakingConfigsAsync(): Promise<void> {
|
||||||
|
const stakingLogicAddress = await stakingProxy.stakingContract.callAsync();
|
||||||
|
warnIfMismatch(stakingLogicAddress, addresses.staking, 'Unexpected Staking contract attached to StakingProxy');
|
||||||
|
|
||||||
|
const readOnlyProxy = await stakingProxy.readOnlyProxy.callAsync();
|
||||||
|
warnIfMismatch(readOnlyProxy, addresses.readOnlyProxy, 'Unexpected ReadOnlyProxy set in StakingProxy');
|
||||||
|
|
||||||
|
const readOnlyCallee = await stakingProxy.readOnlyProxyCallee.callAsync();
|
||||||
|
warnIfMismatch(readOnlyCallee, addresses.staking, 'Unexpected readOnlyProxyCallee');
|
||||||
|
|
||||||
|
const zrxVaultAddress = await stakingContract.getZrxVault.callAsync();
|
||||||
|
warnIfMismatch(zrxVaultAddress, addresses.zrxVault, 'Unexpected ZrxVault set in Staking contract');
|
||||||
|
|
||||||
|
const wethAddress = await stakingContract.getWethContract.callAsync();
|
||||||
|
warnIfMismatch(wethAddress, addresses.etherToken, 'Unexpected WETH contract set in Staking contract');
|
||||||
|
|
||||||
|
const stakingProxyOwner = await stakingProxy.owner.callAsync();
|
||||||
|
warnIfMismatch(stakingProxyOwner, addresses.assetProxyOwner, 'Unexpected StakingProxy owner');
|
||||||
|
|
||||||
|
const zrxVaultOwner = await zrxVault.owner.callAsync();
|
||||||
|
warnIfMismatch(zrxVaultOwner, addresses.assetProxyOwner, 'Unexpected ZrxVault owner');
|
||||||
|
|
||||||
|
const stakingProxyAuthorizedAddresses = await stakingProxy.getAuthorizedAddresses.callAsync();
|
||||||
|
warnIfMismatch(
|
||||||
|
stakingProxyAuthorizedAddresses.length,
|
||||||
|
1,
|
||||||
|
'Unexpected number of authorized addresses in StakingProxy',
|
||||||
|
);
|
||||||
|
const isAssetProxyOwnerAuthorizedInStakingProxy = await stakingProxy.authorized.callAsync(
|
||||||
|
addresses.assetProxyOwner,
|
||||||
|
);
|
||||||
|
warnIfMismatch(
|
||||||
|
isAssetProxyOwnerAuthorizedInStakingProxy,
|
||||||
|
true,
|
||||||
|
'AssetProxyOwner not authorized in StakingProxy',
|
||||||
|
);
|
||||||
|
|
||||||
|
const zrxVaultAuthorizedAddresses = await zrxVault.getAuthorizedAddresses.callAsync();
|
||||||
|
warnIfMismatch(zrxVaultAuthorizedAddresses.length, 1, 'Unexpected number of authorized addresses in ZrxVault');
|
||||||
|
const isAssetProxyOwnerAuthorizedInZrxVault = await zrxVault.authorized.callAsync(addresses.assetProxyOwner);
|
||||||
|
warnIfMismatch(isAssetProxyOwnerAuthorizedInZrxVault, true, 'AssetProxyOwner not authorized in ZrxVault');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function verifyAssetProxyOwnerConfigsAsync(): Promise<void> {}
|
||||||
|
|
||||||
|
await verifyExchangeV2ConfigsAsync();
|
||||||
|
await verifyExchangeV3ConfigsAsync();
|
||||||
|
await verifyAssetProxyConfigsAsync();
|
||||||
|
await verifyStakingConfigsAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
@@ -249,10 +249,10 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t
|
|||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const networkId = 3;
|
const networkId = 4;
|
||||||
const rpcUrl = 'https://ropsten.infura.io/v3/';
|
const rpcUrl = 'https://rinkeby.infura.io/v3/';
|
||||||
const provider = await providerFactory.getLedgerProviderAsync(networkId, rpcUrl);
|
const provider = await providerFactory.getLedgerProviderAsync(networkId, rpcUrl);
|
||||||
await runMigrationsAsync(provider, { from: constants.ASSET_PROXY_OWNER_OWNERS[0], gasPrice: 40000000000 });
|
await runMigrationsAsync(provider, { from: constants.ASSET_PROXY_OWNER_OWNERS[0], gasPrice: 60000000000 });
|
||||||
})().catch(err => {
|
})().catch(err => {
|
||||||
logUtils.log(err);
|
logUtils.log(err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
Reference in New Issue
Block a user