From e68f96244267da0fc04389b8b2338212984ca46e Mon Sep 17 00:00:00 2001 From: Hyungsuk Kang Date: Mon, 23 Jul 2018 17:52:48 +0900 Subject: [PATCH] Add options for migrating to each network --- truffle.js | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/truffle.js b/truffle.js index a48b77f..f1d6249 100644 --- a/truffle.js +++ b/truffle.js @@ -1,21 +1,43 @@ +const HDWalletProvider = require("truffle-hdwallet-provider"); + +require('dotenv').config() // Store environment-specific variable from '.env' to process.env + module.exports = { networks: { development: { host: 'localhost', port: 8545, network_id: '*' // Match any network id - } - }, - solc: { - // Turns on the Solidity optimizer. For development the optimizer's - // quite helpful, just remember to be careful, and potentially turn it - // off, for live deployment and/or audit time. For more information, - // see the Truffle 4.0.0 release notes. - // - // https://github.com/trufflesuite/truffle/releases/tag/v4.0.0 - optimizer: { - enabled: true, - runs: 200 + }, + // testnets + // properties + // network_id: identifier for network based on ethereum blockchain. Find out more at https://github.com/ethereumbook/ethereumbook/issues/110 + // gas: gas limit + // gasPrice: gas price in gwei + ropsten: { + provider: () => new HDWalletProvider(process.env.MNENOMIC, "https://ropsten.infura.io/" + process.env.INFURA_API_KEY), + network_id: 3, + gas: 3000000, + gasPrice: 21 + }, + kovan: { + provider: () => new HDWalletProvider(process.env.MNENOMIC, "https://kovan.infura.io/" + process.env.INFURA_API_KEY), + network_id: 42, + gas: 3000000, + gasPrice: 21 + }, + rinkeby: { + provider: () => new HDWalletProvider(process.env.MNENOMIC, "https://rinkeby.infura.io/" + process.env.INFURA_API_KEY), + network_id: 4, + gas: 3000000, + gasPrice: 21 + }, + // main ethereum network(mainnet) + main: { + provider: () => new HDWalletProvider(process.env.MNENOMIC, "https://mainnet.infura.io/" + process.env.INFURA_API_KEY), + network_id: 1, + gas: 3000000, + gasPrice: 21 } } }