James Towle ce04d3ce41 Fix regression in DevUtils (#2449)
* fix bug in OrderTransferSimulationUtils causing failures for 721 assets

* Patched the regression and added tests

* Added regression test for fillable order

* Created a test for in and out of process ganache

* Split up DevUtils into two contracts

* Updated migration

* Remove the in and out of process ganache test

* Fixed contract addresses

* Appease linter

* Addressed review comments and updated artifacts, wrappers, and snapshots

* Fixed regression after refactor

* Update DevUtils and libTransactionDecoder contracts on mainnet and testnets

* Addressed @mzhu's review feedback

* Addressed @hysz's review feedback

* Updated devUtils address on testnets and mainnet after deployment

Co-authored-by: mzhu25 <mchl.zhu.96@gmail.com>
Co-authored-by: Fabio B <kandinsky454@protonmail.ch>
2020-01-22 12:54:10 +10:00

58 lines
1.6 KiB
TypeScript

import * as _ from 'lodash';
import addresses from '../addresses.json';
export interface ContractAddresses {
erc20Proxy: string;
erc721Proxy: string;
zrxToken: string;
etherToken: string;
exchangeV2: string;
exchange: string;
assetProxyOwner: string;
zeroExGovernor: string;
forwarder: string;
coordinatorRegistry: string;
coordinator: string;
libTransactionDecoder: string;
multiAssetProxy: string;
staticCallProxy: string;
erc1155Proxy: string;
devUtils: string;
zrxVault: string;
staking: string;
stakingProxy: string;
erc20BridgeProxy: string;
erc20BridgeSampler: string;
uniswapBridge: string;
eth2DaiBridge: string;
kyberBridge: string;
chaiBridge: string;
dydxBridge: string;
}
export enum ChainId {
Mainnet = 1,
Ropsten = 3,
Rinkeby = 4,
Kovan = 42,
Ganache = 1337,
}
/**
* Used to get addresses of contracts that have been deployed to either the
* Ethereum mainnet or a supported testnet. Throws if there are no known
* contracts deployed on the corresponding chain.
* @param chainId The desired chainId.
* @returns The set of addresses for contracts which have been deployed on the
* given chainId.
*/
export function getContractAddressesForChainOrThrow(chainId: ChainId): ContractAddresses {
const chainToAddresses: { [chainId: number]: ContractAddresses } = addresses;
if (chainToAddresses[chainId] === undefined) {
throw new Error(`Unknown chain id (${chainId}). No known 0x contracts have been deployed on this chain.`);
}
return chainToAddresses[chainId];
}