aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations/src/migrate_snapshot.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/migrations/src/migrate_snapshot.ts')
-rw-r--r--packages/migrations/src/migrate_snapshot.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/migrations/src/migrate_snapshot.ts b/packages/migrations/src/migrate_snapshot.ts
index f9b7751a5..13fb063da 100644
--- a/packages/migrations/src/migrate_snapshot.ts
+++ b/packages/migrations/src/migrate_snapshot.ts
@@ -2,6 +2,9 @@
import { devConstants, web3Factory } from '@0x/dev-utils';
import { logUtils } from '@0x/utils';
import { Provider } from 'ethereum-types';
+import * as fs from 'fs';
+import * as _ from 'lodash';
+import * as path from 'path';
import { runMigrationsAsync } from './migration';
@@ -9,8 +12,14 @@ import { runMigrationsAsync } from './migration';
let providerConfigs;
let provider: Provider;
let txDefaults;
+ const packageJsonPath = path.join(__dirname, '..', 'package.json');
+ const packageJsonString = fs.readFileSync(packageJsonPath, 'utf8');
+ const packageJson = JSON.parse(packageJsonString);
+ if (_.isUndefined(packageJson.config) || _.isUndefined(packageJson.config.snapshot_name)) {
+ throw new Error(`Did not find 'snapshot_name' key in package.json config`);
+ }
- providerConfigs = { shouldUseInProcessGanache: true, ganacheDatabasePath: '0x_ganache_snapshot' };
+ providerConfigs = { shouldUseInProcessGanache: true, ganacheDatabasePath: packageJson.config.snapshot_name };
provider = web3Factory.getRpcProvider(providerConfigs);
txDefaults = {
from: devConstants.TESTRPC_FIRST_ADDRESS,