Closed derekchiang closed 5 years ago
@derekchiang , you're correct -- the config.json
at the moment isn't very useful. prior to our recent factory/proxy refactoring, we were using the config file during migrations. lately i've been using a custom external script to deploy proxies, but have yet to merge it into this repo. here's the snippet:
command: truffle exec --network [network] ./scripts/deploy_proxies.js
/scripts/deploy_proxies.js
/* global artifacts */
const fs = require('fs');
const RegistryFactory = artifacts.require('./RegistryFactory.sol');
const config = JSON.parse(fs.readFileSync('../conf/config.json'));
const paramConfig = config.paramDefaults;
module.exports = (callback) => {
async function deployRegistry() {
const registryFactory = await RegistryFactory.at('0xcc0df91b86795f21c3d43dbeb3ede0dfcf8dccaf'); // address of registry factory for current network
const registryReceipt = await registryFactory.newRegistryWithToken(
config.token.supply,
config.token.name,
config.token.decimals,
config.token.symbol,
[
paramConfig.minDeposit,
paramConfig.pMinDeposit,
paramConfig.applyStageLength,
paramConfig.pApplyStageLength,
paramConfig.commitStageLength,
paramConfig.pCommitStageLength,
paramConfig.revealStageLength,
paramConfig.pRevealStageLength,
paramConfig.dispensationPct,
paramConfig.pDispensationPct,
paramConfig.voteQuorum,
paramConfig.pVoteQuorum,
],
config.name,
);
const {
token,
plcr,
parameterizer,
registry,
} = registryReceipt.logs[0].args;
console.log('\n');
console.log('token:', token);
console.log('voting:', plcr);
console.log('parameterizer', parameterizer);
console.log('registry:', registry);
console.log('\n');
return true;
}
deployRegistry().then(() => callback());
}
more info here: https://truffleframework.com/docs/getting_started/scripts
Not sure if I'm missing something obvious, but
config.json
doesn't seem to be actually used anywhere other than in tests. However, the README seems to imply thatconfig.json
actually does something:On that note: there isn't actually a way to automatically deploy a TCR, is there? When I run
truffle migrate
, only the factories are deployed. Wouldn't I have to manually call the factory functions to create TCRs?This is all good; it's just that the README makes it sound like there's a way to just edit
config.json
and have a TCR automatically deployed, but that doesn't seem to be the case.