diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-02 17:12:01 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-02 17:12:01 +0800 |
commit | de9f0732a09893f035ce8a7e8e01fa1141882a3a (patch) | |
tree | 63d1f0bbc6f9d65576e5d12b379378700eb88567 /packages/migrations/src/migrate.ts | |
parent | 20acdbf6c3ba6a62e87a9a496021cb6482c0c03a (diff) | |
parent | b9b00e10d39c3c84bc72892ef37f1313e904414d (diff) | |
download | dexon-sol-tools-de9f0732a09893f035ce8a7e8e01fa1141882a3a.tar dexon-sol-tools-de9f0732a09893f035ce8a7e8e01fa1141882a3a.tar.gz dexon-sol-tools-de9f0732a09893f035ce8a7e8e01fa1141882a3a.tar.bz2 dexon-sol-tools-de9f0732a09893f035ce8a7e8e01fa1141882a3a.tar.lz dexon-sol-tools-de9f0732a09893f035ce8a7e8e01fa1141882a3a.tar.xz dexon-sol-tools-de9f0732a09893f035ce8a7e8e01fa1141882a3a.tar.zst dexon-sol-tools-de9f0732a09893f035ce8a7e8e01fa1141882a3a.zip |
Merge branch 'v2-prototype' into fix/five_decimal_scenario
* v2-prototype: (75 commits)
Update relayer grid tiles to use Text
Fix build
Update file structure
Update 2.0.0 artifacts
Move ledgerhq module declarations to typescript-typings
Export LedgerEthereumClient type in subproviders
Update artifacts
Add logging and updated artifacts
Fix migrations
Run prettier
Add Kovan artifacts
Use ledger subprovider
Add Kovan migrations
Remove state variable from Link component in Portal
Make registerAssetProxy append only
Update staging api link
Change getTransactionReceipt to awaitTransactionMined
Move /docs route to the end
Remove extra call to scrollIntoView for wallet in onboarding
Update expectRevertReasonOrAlwaysFailingTransactionAsync to check status codes
...
Diffstat (limited to 'packages/migrations/src/migrate.ts')
-rw-r--r-- | packages/migrations/src/migrate.ts | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts index 5f320ec78..c46d3580a 100644 --- a/packages/migrations/src/migrate.ts +++ b/packages/migrations/src/migrate.ts @@ -1,30 +1,58 @@ #!/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 { 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; (async () => { - 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 { - await runV2MigrationsAsync(provider, artifactsDir, txDefaults); + 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}`); } process.exit(0); })().catch(err => { |