aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations/src
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-10 00:54:55 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-10 00:54:55 +0800
commitfb3605026ef63ef6897010a52bf3f4c116cdf271 (patch)
treeaf3887e5f785e049daeaf795e0f3e4a9ad370d93 /packages/migrations/src
parent76dde294f10bb3d5c1074cd6599668bcb1cdd8ec (diff)
parent5b8c9122a292f6558c45440b053ceae52d36d495 (diff)
downloaddexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.gz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.bz2
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.lz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.xz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.zst
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.zip
Merge branch 'development' into feature/instant/tell-amount-available
Diffstat (limited to 'packages/migrations/src')
-rw-r--r--packages/migrations/src/migrate_snapshot.ts32
-rw-r--r--packages/migrations/src/migration.ts9
2 files changed, 41 insertions, 0 deletions
diff --git a/packages/migrations/src/migrate_snapshot.ts b/packages/migrations/src/migrate_snapshot.ts
new file mode 100644
index 000000000..13fb063da
--- /dev/null
+++ b/packages/migrations/src/migrate_snapshot.ts
@@ -0,0 +1,32 @@
+#!/usr/bin/env node
+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';
+
+(async () => {
+ 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: packageJson.config.snapshot_name };
+ provider = web3Factory.getRpcProvider(providerConfigs);
+ txDefaults = {
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+ };
+ await runMigrationsAsync(provider, txDefaults);
+ process.exit(0);
+})().catch(err => {
+ logUtils.log(err);
+ process.exit(1);
+});
diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts
index c684c4970..99d1719f1 100644
--- a/packages/migrations/src/migration.ts
+++ b/packages/migrations/src/migration.ts
@@ -141,6 +141,14 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
zrxAssetData,
);
+ // DutchAuction
+ const dutchAuction = await wrappers.DutchAuctionContract.deployFrom0xArtifactAsync(
+ artifacts.DutchAuction,
+ provider,
+ txDefaults,
+ exchange.address,
+ );
+
// Fund the Forwarder with ZRX
const zrxDecimals = await zrxToken.decimals.callAsync();
const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals);
@@ -157,6 +165,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
assetProxyOwner: assetProxyOwner.address,
forwarder: forwarder.address,
orderValidator: orderValidator.address,
+ dutchAuction: dutchAuction.address,
};
}