{"size": 1586, "ext": "js", "max_stars_repo_path": "truffle.js", "max_stars_repo_name": "duiliohelf/ethnotary", "max_stars_repo_stars_event_min_datetime": "2017-11-11T08:02:04.000Z", "max_stars_repo_stars_event_max_datetime": "2018-08-04T09:51:56.000Z", "max_issues_repo_path": "truffle.js", "max_issues_repo_name": "duiliohelf/ethnotary", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "truffle.js", "max_forks_repo_name": "duiliohelf/ethnotary", "max_forks_repo_forks_event_min_datetime": "2018-12-10T13:10:27.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-12T22:10:32.000Z"}
{"max_stars_count": 17, "max_issues_count": null, "max_forks_count": 8, "avg_line_length": 22.6571428571, "max_line_length": 65, "alphanum_fraction": 0.6002522068}
require('dotenv').config()

const Web3WsProvider = require('web3-providers-ws');
const HDWalletProvider = require('truffle-hdwallet-provider')
const PrivateKeyProvider = require('truffle-privatekey-provider')


function createProvider(url) {
  var key = null
  var provider = null

  if (url.indexOf('localhost') === -1) {
    if (process.env.MNEMONIC) {
      key = process.env.MNEMONIC
      provider = new HDWalletProvider(key, url)
    } else if (process.env.PRIVATE_KEY) {
      key = process.env.PRIVATE_KEY
      provider = new PrivateKeyProvider(key, url)
    }
  } else {
    provider = new Web3WsProvider(url)
  }

  return provider
}

module.exports = {
  networks: {
    development: {
      provider: createProvider('ws://localhost:8545'),
      network_id: '*' // Match any network id
    },
    kovan: {
      provider: createProvider('https://kovan.infura.io'),
      network_id: 42,
      gas: 4712383,
      gasPrice: 20000000000
    },
    rinkeby: {
      provider: createProvider('https://rinkeby.infura.io'),
      network_id: 4,
      gas: 4712383,
      gasPrice: 20000000000
    },
    ropsten: {
      provider: createProvider('https://ropsten.infura.io'),
      network_id: 3,
      gas: 4712383,
      gasPrice: 20000000000
    },
    mainnet: {
      provider: createProvider('https://mainnet.infura.io'),
      network_id: 1,
      gas: 4500000,
      gasPrice: 10000000000
    }
  },
  compilers: {
    solc: {
      version: '0.4.23',
      settings: {
        optimizer: {
          enabled: true,
          runs: 200
        },
      },
    },
  },
};
