Cleanup scripts and use helper to get the networkid
This commit is contained in:
parent
b201642485
commit
258c6729b6
@ -6,6 +6,7 @@ const argv = require('yargs').argv
|
|||||||
const namehash = require('eth-ens-namehash').hash
|
const namehash = require('eth-ens-namehash').hash
|
||||||
|
|
||||||
const fileInject = require('./helpers/file_inject.js')
|
const fileInject = require('./helpers/file_inject.js')
|
||||||
|
const getNetworkId = require('./helpers/networkid.js')
|
||||||
|
|
||||||
const DAOFactory = artifacts.require('DAOFactory')
|
const DAOFactory = artifacts.require('DAOFactory')
|
||||||
const KreditsKit = artifacts.require('KreditsKit')
|
const KreditsKit = artifacts.require('KreditsKit')
|
||||||
@ -18,18 +19,7 @@ const daoFactoryAddress = arapp.environments[environment].daoFactory || process.
|
|||||||
|
|
||||||
|
|
||||||
module.exports = async function(callback) {
|
module.exports = async function(callback) {
|
||||||
|
const networkId = await getNetworkId(web3)
|
||||||
// load networkId; will change with updated truffle
|
|
||||||
const networkPromise = new Promise((resolve, reject) => {
|
|
||||||
web3.version.getNetwork((err, network) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
} else {
|
|
||||||
resolve(network);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
const networkId = await networkPromise;
|
|
||||||
console.log(`Deploying to networkId: ${networkId}`)
|
console.log(`Deploying to networkId: ${networkId}`)
|
||||||
|
|
||||||
if (!ensAddr) {
|
if (!ensAddr) {
|
||||||
|
@ -2,23 +2,14 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const fileInject = require('./helpers/file_inject.js');
|
const fileInject = require('./helpers/file_inject.js');
|
||||||
|
const getNetworkId = require('./helpers/networkid.js');
|
||||||
|
|
||||||
const addressesPath = path.join(__dirname, '..', 'lib/addresses');
|
const addressesPath = path.join(__dirname, '..', 'lib/addresses');
|
||||||
|
|
||||||
const KreditsKit = artifacts.require('KreditsKit')
|
const KreditsKit = artifacts.require('KreditsKit')
|
||||||
|
|
||||||
module.exports = async function(callback) {
|
module.exports = async function(callback) {
|
||||||
// load networkId; will change with updated truffle
|
const networkId = await getNetworkId(web3)
|
||||||
const networkPromise = new Promise((resolve, reject) => {
|
|
||||||
web3.version.getNetwork((err, network) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
} else {
|
|
||||||
resolve(network);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
const networkId = await networkPromise;
|
|
||||||
console.log(`Deploying to networkId: ${networkId}`)
|
console.log(`Deploying to networkId: ${networkId}`)
|
||||||
|
|
||||||
let kitAddresseFile = path.join(addressesPath, 'KreditsKit.json');
|
let kitAddresseFile = path.join(addressesPath, 'KreditsKit.json');
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const each = require('async-each-series');
|
||||||
|
const ethers = require('ethers');
|
||||||
|
|
||||||
|
const Kredits = require('../lib/kredits');
|
||||||
|
const getNetworkId = require('./helpers/networkid.js')
|
||||||
|
|
||||||
const seeds = require(path.join(__dirname, '..', '/config/seeds.js'));
|
const seeds = require(path.join(__dirname, '..', '/config/seeds.js'));
|
||||||
|
|
||||||
const ethers = require('ethers');
|
|
||||||
const Kredits = require('../lib/kredits');
|
|
||||||
|
|
||||||
const each = require('async-each-series');
|
|
||||||
|
|
||||||
module.exports = async function(callback) {
|
module.exports = async function(callback) {
|
||||||
const networkId = parseInt(web3.version.network);
|
const networkId = await getNetworkId(web3)
|
||||||
const provider = new ethers.providers.Web3Provider(
|
const provider = new ethers.providers.Web3Provider(
|
||||||
web3.currentProvider, { chainId: networkId }
|
web3.currentProvider, { chainId: parseInt(networkId) }
|
||||||
);
|
);
|
||||||
const kredits = await new Kredits(provider, provider.getSigner()).init();
|
const kredits = await new Kredits(provider, provider.getSigner()).init();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user