clean contracts.js and error handling

This commit is contained in:
Richard Ramos 2019-05-22 16:16:19 -04:00
parent 9ac98f6909
commit 16ab77ef1a
2 changed files with 20 additions and 26 deletions

View File

@ -103,22 +103,12 @@ module.exports = {
LiquidPledging: { LiquidPledging: {
instanceOf: 'LiquidPledgingMock' instanceOf: 'LiquidPledgingMock'
}, },
RecoveryVault: {},
LPFactory: {
args: ['$LPVault', '$LiquidPledging'],
},
// contracts for testing // contracts for testing
StandardToken: {}, StandardToken: {}
Kernel: {
file: "@aragon/os/contracts/kernel/Kernel.sol"
},
ACL: {
file: "@aragon/os/contracts/acl/ACL.sol"
}
}, },
afterDeploy: async (deps) => { afterDeploy: async (deps) => {
await deps.contracts.LiquidPledging.methods.initialize(deps.contracts.LPVault.options.address).send({gas: 1000000}); await deps.contracts.LiquidPledging.methods.initialize(deps.contracts.LPVault.options.address).send({gas: 1000000, from: deps.web3.eth.defaultAccount});
await deps.contracts.LPVault.methods.initialize(deps.contracts.LiquidPledging.options.address).send({gas: 1000000}); await deps.contracts.LPVault.methods.initialize(deps.contracts.LiquidPledging.options.address).send({gas: 1000000, from: deps.web3.eth.defaultAccount});
} }
// afterDeploy: [ // afterDeploy: [

View File

@ -68,14 +68,15 @@ class Actions {
} }
async listProjects() { async listProjects() {
let numProjects = await LiquidPledging.methods.numberOfPledgeAdmins().call(); try {
let numProjects = await this.contracts.LiquidPledging.methods.numberOfPledgeAdmins().call();
const table = new Table({ const table = new Table({
head: ['Id', 'Name', 'URL', 'ParentProject', 'Status', 'Commit Time', 'Owner', 'Plugin'] head: ['Id', 'Name', 'URL', 'ParentProject', 'Status', 'Commit Time', 'Owner', 'Plugin']
}); });
for(let i = 1; i <= numProjects; i++){ for(let i = 1; i <= numProjects; i++){
const pledge = await LiquidPledging.methods.getPledgeAdmin(i).call(); const pledge = await this.contracts.LiquidPledging.methods.getPledgeAdmin(i).call();
if(pledge.adminType !== '2') continue; if(pledge.adminType !== '2') continue;
table.push( table.push(
@ -84,6 +85,9 @@ class Actions {
} }
console.log(table.toString()); console.log(table.toString());
} catch(error){
console.log("Couldn't obtain the list of projects: ", error.message);
}
} }
addGiver(params) { addGiver(params) {