aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations/src/migrate.ts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-06-28 06:13:57 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-06-30 08:25:56 +0800
commit6e1a549fcb5cc9257ee984a906db78dd2568042b (patch)
tree08432dbc8a2e12c352030ed40f62f3bd44227f97 /packages/migrations/src/migrate.ts
parent5f0a2953c63c31daa975b587f5c5072b6f7e418c (diff)
downloaddexon-sol-tools-6e1a549fcb5cc9257ee984a906db78dd2568042b.tar
dexon-sol-tools-6e1a549fcb5cc9257ee984a906db78dd2568042b.tar.gz
dexon-sol-tools-6e1a549fcb5cc9257ee984a906db78dd2568042b.tar.bz2
dexon-sol-tools-6e1a549fcb5cc9257ee984a906db78dd2568042b.tar.lz
dexon-sol-tools-6e1a549fcb5cc9257ee984a906db78dd2568042b.tar.xz
dexon-sol-tools-6e1a549fcb5cc9257ee984a906db78dd2568042b.tar.zst
dexon-sol-tools-6e1a549fcb5cc9257ee984a906db78dd2568042b.zip
Use ledger subprovider
Diffstat (limited to 'packages/migrations/src/migrate.ts')
-rw-r--r--packages/migrations/src/migrate.ts35
1 files changed, 22 insertions, 13 deletions
diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts
index 35e086382..d9cc1ae01 100644
--- a/packages/migrations/src/migrate.ts
+++ b/packages/migrations/src/migrate.ts
@@ -6,13 +6,15 @@ import { Provider } from 'ethereum-types';
import * as yargs from 'yargs';
import { runV1MigrationsAsync } from './1.0.0/migration';
-import { runV2BetaKovanMigrationsAsync } from './2.0.0-beta-kovan/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',
- V2BetaKovan = '2.0.0-beta-kovan',
+ V2Testnet = '2.0.0-beta-testnet',
}
const args = yargs.argv;
@@ -24,17 +26,24 @@ const args = yargs.argv;
};
const contractsVersion = args.contractsVersion;
const artifactsDir = `artifacts/${contractsVersion}`;
- if (contractsVersion === ContractVersions.V1) {
- await runV1MigrationsAsync(provider, artifactsDir, txDefaults);
- } 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);
+ switch (contractsVersion) {
+ case ContractVersions.V1:
+ await runV1MigrationsAsync(provider, artifactsDir, txDefaults);
+ break;
+ case ContractVersions.V2:
+ await runV2MigrationsAsync(provider, artifactsDir, txDefaults);
+ break;
+ case ContractVersions.V2Testnet:
+ const ledgerProvider = await providerFactory.getLedgerProviderAsync();
+ const web3Wrapper = new Web3Wrapper(ledgerProvider);
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const testnetTxDefaults = {
+ from: accounts[0],
+ };
+ await runV2TestnetMigrationsAsync(ledgerProvider, artifactsDir, testnetTxDefaults);
+ break;
+ default:
+ throw new Error(`Unsupported contract version: ${contractsVersion}`);
}
process.exit(0);
})().catch(err => {