This removes the isCore flag and allows us to dynamically calculate the core flag for contributors. For now this is just us (the first 6 contirbutors) Also we do not need the default contributor anymore because the deploy user has the role to manage contributors and can create the first real contributors.
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
const promptly = require('promptly');
|
|
|
|
const initKredits = require('./helpers/init_kredits.js');
|
|
|
|
async function prompt(message, options) {
|
|
if (!options) {
|
|
options = {default: ''}
|
|
}
|
|
return await promptly.prompt(message, options);
|
|
}
|
|
|
|
module.exports = async function(callback) {
|
|
let kredits;
|
|
try {
|
|
kredits = await initKredits(web3);
|
|
} catch(e) {
|
|
callback(e);
|
|
return;
|
|
}
|
|
|
|
console.log(`Using contributors at: ${kredits.Contributor.contract.address}`);
|
|
|
|
let contributorAttributes = {
|
|
account: await prompt('Contributor address: ', {}),
|
|
name: await prompt('Name: '),
|
|
kind: await prompt('Kind (default person): ', {default: 'person'}),
|
|
url: await prompt('URL: '),
|
|
github_username: await prompt('GitHub username: '),
|
|
github_uid: await prompt('GitHub UID: '),
|
|
wiki_username: await prompt('Wiki username: '),
|
|
};
|
|
|
|
console.log("\nAdding contributor:");
|
|
console.log(contributorAttributes);
|
|
|
|
kredits.Contributor.add(contributorAttributes, { gasLimit: 350000 }).then((result) => {
|
|
console.log("\n\nResult:");
|
|
console.log(result);
|
|
callback();
|
|
}).catch((error) => {
|
|
console.log('Failed to create contributor');
|
|
callback(error);
|
|
});
|
|
}
|