Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function testContractConfigsAsync(provider: SupportedProvider): Promise {
const web3Wrapper = new Web3Wrapper(provider);
const chainId = await web3Wrapper.getChainIdAsync();
const addresses = getContractAddressesForChainOrThrow(chainId);
const configs = getConfigsByChainId(chainId);
function warnIfMismatch(actual: any, expected: any, message: string): void {
if (actual !== expected) {
logUtils.warn(`${message}: actual: ${actual}, expected: ${expected}, chainId: ${chainId}`);
}
}
const exchange = new ExchangeContract(addresses.exchange, provider);
const exchangeV2 = new ExchangeContract(addresses.exchangeV2, provider);
const erc20Proxy = new ERC20ProxyContract(addresses.erc20Proxy, provider);
const erc721Proxy = new ERC721ProxyContract(addresses.erc721Proxy, provider);
const erc1155Proxy = new ERC1155ProxyContract(addresses.erc1155Proxy, provider);
const multiAssetProxy = new MultiAssetProxyContract(addresses.multiAssetProxy, provider);
const erc20BridgeProxy = new ERC20ProxyContract(addresses.erc20BridgeProxy, provider);
const governor = new ZeroExGovernorContract(addresses.zeroExGovernor, provider);
const stakingProxy = new StakingProxyContract(addresses.stakingProxy, provider);
const stakingContract = new StakingContract(addresses.stakingProxy, provider);
const zrxVault = new ZrxVaultContract(addresses.zrxVault, provider);
async function verifyExchangeV2ConfigsAsync(): Promise {
const exchangeOwner = await exchangeV2.owner().callAsync();
warnIfMismatch(exchangeOwner, governor.address, 'Unexpected ExchangeV2 owner');
const registeredERC20Proxy = await exchangeV2.getAssetProxy(AssetProxyId.ERC20).callAsync();
warnIfMismatch(registeredERC20Proxy, erc20Proxy.address, 'Unexpected ERC20Proxy registered in ExchangeV2');
const registeredERC721Proxy = await exchangeV2.getAssetProxy(AssetProxyId.ERC721).callAsync();