aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations/src/migrate.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/migrations/src/migrate.ts')
-rw-r--r--packages/migrations/src/migrate.ts58
1 files changed, 10 insertions, 48 deletions
diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts
index c46d3580a..d7a76d2f8 100644
--- a/packages/migrations/src/migrate.ts
+++ b/packages/migrations/src/migrate.ts
@@ -1,59 +1,21 @@
#!/usr/bin/env node
-import { devConstants, web3Factory } from '@0xproject/dev-utils';
-import { logUtils } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { devConstants, web3Factory } from '@0x/dev-utils';
+import { logUtils } from '@0x/utils';
import { Provider } from 'ethereum-types';
-import * as yargs from 'yargs';
-import { runV1MigrationsAsync } from './1.0.0/migration';
-import { runV2TestnetMigrationsAsync } from './2.0.0-beta-testnet/migration';
-import { runV2MigrationsAsync } from './2.0.0/migration';
-
-import { providerFactory } from './utils/provider_factory';
-
-enum ContractVersions {
- V1 = '1.0.0',
- V2 = '2.0.0',
- V2Testnet = '2.0.0-beta-testnet',
-}
-const args = yargs.argv;
+import { runMigrationsAsync } from './migration';
(async () => {
- const contractsVersion = args.contractsVersion;
- const artifactsDir = `artifacts/${contractsVersion}`;
let providerConfigs;
let provider: Provider;
let txDefaults;
- switch (contractsVersion) {
- case ContractVersions.V1:
- providerConfigs = { shouldUseInProcessGanache: false };
- provider = web3Factory.getRpcProvider(providerConfigs);
- txDefaults = {
- from: devConstants.TESTRPC_FIRST_ADDRESS,
- };
- await runV1MigrationsAsync(provider, artifactsDir, txDefaults);
- break;
- case ContractVersions.V2:
- providerConfigs = { shouldUseInProcessGanache: false };
- provider = web3Factory.getRpcProvider(providerConfigs);
- txDefaults = {
- from: devConstants.TESTRPC_FIRST_ADDRESS,
- };
- await runV2MigrationsAsync(provider, artifactsDir, txDefaults);
- break;
- case ContractVersions.V2Testnet:
- provider = await providerFactory.getLedgerProviderAsync();
- const web3Wrapper = new Web3Wrapper(provider);
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- txDefaults = {
- from: accounts[0],
- gas: devConstants.GAS_LIMIT,
- };
- await runV2TestnetMigrationsAsync(provider, artifactsDir, txDefaults);
- break;
- default:
- throw new Error(`Unsupported contract version: ${contractsVersion}`);
- }
+
+ providerConfigs = { shouldUseInProcessGanache: false };
+ provider = web3Factory.getRpcProvider(providerConfigs);
+ txDefaults = {
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+ };
+ await runMigrationsAsync(provider, txDefaults);
process.exit(0);
})().catch(err => {
logUtils.log(err);