diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/migrations/src/migrate.ts | 7 | ||||
-rw-r--r-- | packages/migrations/src/utils/constants.ts | 2 | ||||
-rw-r--r-- | packages/migrations/src/utils/provider_factory.ts | 14 |
3 files changed, 19 insertions, 4 deletions
diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts index 6c8b38762..e3651f2dc 100644 --- a/packages/migrations/src/migrate.ts +++ b/packages/migrations/src/migrate.ts @@ -46,7 +46,7 @@ const args = yargs.argv; await runV2MigrationsAsync(provider, artifactsDir, txDefaults); break; case ContractVersions.V2Testnet: - provider = await providerFactory.getLedgerProviderAsync(); + provider = await providerFactory.getKovanLedgerProviderAsync(); web3Wrapper = new Web3Wrapper(provider); accounts = await web3Wrapper.getAvailableAddressesAsync(); txDefaults = { @@ -56,12 +56,13 @@ const args = yargs.argv; await runV2TestnetMigrationsAsync(provider, artifactsDir, txDefaults); break; case ContractVersions.V2Mainnet: - provider = await providerFactory.getLedgerProviderAsync(); + provider = await providerFactory.getMainnetLedgerProviderAsync(); web3Wrapper = new Web3Wrapper(provider); accounts = await web3Wrapper.getAvailableAddressesAsync(); txDefaults = { - from: accounts[0], + from: accounts[2], gas: devConstants.GAS_LIMIT, + gasPrice: 6000000000, }; await runV2MainnetMigrationsAsync(provider, artifactsDir, txDefaults); break; diff --git a/packages/migrations/src/utils/constants.ts b/packages/migrations/src/utils/constants.ts index 4ae2ff833..63898ac02 100644 --- a/packages/migrations/src/utils/constants.ts +++ b/packages/migrations/src/utils/constants.ts @@ -13,4 +13,6 @@ export const constants = { NULL_ADDRESS: '0x0000000000000000000000000000000000000000', KOVAN_RPC_URL: 'https://kovan.infura.io/', KOVAN_NETWORK_ID: 42, + MAINNET_RPC_URL: 'https://mainnet.infura.io/', + MAINNET_NETWORK_ID: 1, }; diff --git a/packages/migrations/src/utils/provider_factory.ts b/packages/migrations/src/utils/provider_factory.ts index a0d4e436e..e7e00a039 100644 --- a/packages/migrations/src/utils/provider_factory.ts +++ b/packages/migrations/src/utils/provider_factory.ts @@ -12,7 +12,7 @@ async function ledgerEthereumNodeJsClientFactoryAsync(): Promise<LedgerEthereumC return ledgerEthClient; } export const providerFactory = { - async getLedgerProviderAsync(): Promise<Provider> { + async getKovanLedgerProviderAsync(): Promise<Provider> { const provider = new Web3ProviderEngine(); const ledgerWalletConfigs = { networkId: constants.KOVAN_NETWORK_ID, @@ -24,4 +24,16 @@ export const providerFactory = { provider.start(); return provider; }, + async getMainnetLedgerProviderAsync(): Promise<Provider> { + const provider = new Web3ProviderEngine(); + const ledgerWalletConfigs = { + networkId: constants.MAINNET_NETWORK_ID, + ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync, + }; + const ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs); + provider.addProvider(ledgerSubprovider); + provider.addProvider(new RPCSubprovider(constants.MAINNET_RPC_URL)); + provider.start(); + return provider; + }, }; |