Dynamically set AppIds
AppIds are used to lookup the actual contract addresses of each app. Because of different registry names (open.aragonpm.eth vs. aragonpm.eth) we have to use different ids in the local dev chain and in the testnet/mainnet. To allow this we need to set the appids dynamically. There is an open aragon issue to solve this and also allow to use open.aragonpm.eth in the devchain by default. https://github.com/aragon/aragen/issues/10
This commit is contained in:
@@ -5,8 +5,7 @@ const path = require('path');
|
||||
const argv = require('yargs').argv
|
||||
const namehash = require('eth-ens-namehash').hash
|
||||
|
||||
const libPath = path.join(__dirname, '..', 'lib');
|
||||
const addressesPath = path.join(libPath, 'addresses');
|
||||
const fileInject = require('./helpers/file_inject.js')
|
||||
|
||||
const DAOFactory = artifacts.require('DAOFactory')
|
||||
const KreditsKit = artifacts.require('KreditsKit')
|
||||
@@ -48,16 +47,18 @@ module.exports = async function(callback) {
|
||||
|
||||
const apps = fs.readdirSync('./apps')
|
||||
console.log(`Found apps: [${apps}].${apm}`)
|
||||
const appIds = apps.map(app => namehash(`kredits-${app}.${apm}`))
|
||||
let appIds = {}
|
||||
apps.sort().forEach((app) => {
|
||||
let [first, ...rest] = app;
|
||||
let contractName = `${first.toUpperCase()}${rest.join('')}`
|
||||
appIds[contractName] = namehash(`kredits-${app}.${apm}`)
|
||||
})
|
||||
|
||||
KreditsKit.new(daoFactory.address, ensAddr, appIds).then((kreditsKit) => {
|
||||
KreditsKit.new(daoFactory.address, ensAddr, Object.values(appIds)).then((kreditsKit) => {
|
||||
console.log(`Deployed KreditsKit at: ${kreditsKit.address}`);
|
||||
|
||||
let addresseFile = path.join(addressesPath, `KreditsKit.json`);
|
||||
let addresses = JSON.parse(fs.readFileSync(addresseFile));
|
||||
|
||||
addresses[networkId] = kreditsKit.address;
|
||||
fs.writeFileSync(addresseFile, JSON.stringify(addresses));
|
||||
fileInject(path.join(__dirname, '..', 'lib/addresses/KreditsKit.json'), networkId, kreditsKit.address);
|
||||
fileInject(path.join(__dirname, '..', 'lib/app_ids.json'), networkId, appIds);
|
||||
|
||||
callback();
|
||||
}).catch((e) => {
|
||||
|
||||
Reference in New Issue
Block a user