diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-06-25 08:36:24 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-06-30 08:25:56 +0800 |
commit | 5f0a2953c63c31daa975b587f5c5072b6f7e418c (patch) | |
tree | fa3a7888c9ef78770575e8612a40c323fd561448 /packages/migrations/src/migrate.ts | |
parent | 78b513c52addc16062419236c24f01bcfe191f3f (diff) | |
download | dexon-0x-contracts-5f0a2953c63c31daa975b587f5c5072b6f7e418c.tar.gz dexon-0x-contracts-5f0a2953c63c31daa975b587f5c5072b6f7e418c.tar.zst dexon-0x-contracts-5f0a2953c63c31daa975b587f5c5072b6f7e418c.zip |
Add Kovan migrations
Diffstat (limited to 'packages/migrations/src/migrate.ts')
-rw-r--r-- | packages/migrations/src/migrate.ts | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts index 5f320ec78..35e086382 100644 --- a/packages/migrations/src/migrate.ts +++ b/packages/migrations/src/migrate.ts @@ -1,30 +1,40 @@ #!/usr/bin/env node import { devConstants, web3Factory } from '@0xproject/dev-utils'; import { logUtils } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider } from 'ethereum-types'; import * as yargs from 'yargs'; -import { runV1MigrationsAsync } from './v1/migration'; -import { runV2MigrationsAsync } from './v2/migration'; +import { runV1MigrationsAsync } from './1.0.0/migration'; +import { runV2BetaKovanMigrationsAsync } from './2.0.0-beta-kovan/migration'; +import { runV2MigrationsAsync } from './2.0.0/migration'; enum ContractVersions { V1 = '1.0.0', V2 = '2.0.0', + V2BetaKovan = '2.0.0-beta-kovan', } const args = yargs.argv; (async () => { + const providerConfigs = { shouldUseInProcessGanache: false }; + const provider: Provider = web3Factory.getRpcProvider(providerConfigs); const txDefaults = { from: devConstants.TESTRPC_FIRST_ADDRESS, }; - const providerConfigs = { shouldUseInProcessGanache: false }; - const provider: Provider = web3Factory.getRpcProvider(providerConfigs); const contractsVersion = args.contractsVersion; const artifactsDir = `artifacts/${contractsVersion}`; if (contractsVersion === ContractVersions.V1) { await runV1MigrationsAsync(provider, artifactsDir, txDefaults); - } else { + } else if (contractsVersion === ContractVersions.V2) { await runV2MigrationsAsync(provider, artifactsDir, txDefaults); + } else { + const web3Wrapper = new Web3Wrapper(provider); + const accounts = await web3Wrapper.getAvailableAddressesAsync(); + const kovanTxDefaults = { + from: accounts[0], + }; + await runV2BetaKovanMigrationsAsync(provider, artifactsDir, kovanTxDefaults); } process.exit(0); })().catch(err => { |