From 84f20efff0427f367dea4b4d7f5610fd4d48d76c Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Tue, 27 Aug 2019 12:19:01 +0200 Subject: [PATCH 1/2] Add ENV var for custom DAO address This makes it much easier to test hubot-kredits with local development chains. --- index.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index cf410c4..dc8527f 100644 --- a/index.js +++ b/index.js @@ -7,6 +7,7 @@ const Kredits = require('kredits-contracts'); const walletPath = process.env.KREDITS_WALLET_PATH || './wallet.json'; const walletJson = fs.readFileSync(walletPath); const providerUrl = process.env.KREDITS_PROVIDER_URL; +const daoAddress = process.env.KREDITS_DAO_ADDRESS; const ipfsConfig = { host: process.env.IPFS_API_HOST || 'localhost', @@ -48,14 +49,18 @@ module.exports = async function(robot) { // Kredits contracts setup // + const opts = { ipfsConfig }; + + if (daoAddress) { + opts.addresses = { Kernel: daoAddress }; + } else { + opts.apm = 'open.aragonpm.eth'; + } + let kredits; + try { - kredits = await new Kredits(signer.provider, signer, { - // TODO support local devchain custom address - apm: 'open.aragonpm.eth', - // addresses: { Kernel: '0x93aa4531329e4bf3efcd1ec0b74adb6f66d9d10e' } - ipfsConfig - }).init(); + kredits = await new Kredits(signer.provider, signer, opts).init(); } catch(error) { robot.logger.warning('[hubot-kredits] Could not set up kredits:', error); process.exit(1); From 1f1053e28977daa9bf37ab785db3dd21a75c54d7 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Tue, 27 Aug 2019 12:37:50 +0200 Subject: [PATCH 2/2] Remove apm address from options It's already the default in the contracts module. --- index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/index.js b/index.js index dc8527f..e8f7d6b 100644 --- a/index.js +++ b/index.js @@ -50,13 +50,9 @@ module.exports = async function(robot) { // const opts = { ipfsConfig }; - if (daoAddress) { opts.addresses = { Kernel: daoAddress }; - } else { - opts.apm = 'open.aragonpm.eth'; } - let kredits; try {