clean contracts.js and error handling
This commit is contained in:
parent
9ac98f6909
commit
16ab77ef1a
|
@ -103,22 +103,12 @@ module.exports = {
|
|||
LiquidPledging: {
|
||||
instanceOf: 'LiquidPledgingMock'
|
||||
},
|
||||
RecoveryVault: {},
|
||||
LPFactory: {
|
||||
args: ['$LPVault', '$LiquidPledging'],
|
||||
},
|
||||
// contracts for testing
|
||||
StandardToken: {},
|
||||
Kernel: {
|
||||
file: "@aragon/os/contracts/kernel/Kernel.sol"
|
||||
},
|
||||
ACL: {
|
||||
file: "@aragon/os/contracts/acl/ACL.sol"
|
||||
}
|
||||
StandardToken: {}
|
||||
},
|
||||
afterDeploy: async (deps) => {
|
||||
await deps.contracts.LiquidPledging.methods.initialize(deps.contracts.LPVault.options.address).send({gas: 1000000});
|
||||
await deps.contracts.LPVault.methods.initialize(deps.contracts.LiquidPledging.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, from: deps.web3.eth.defaultAccount});
|
||||
}
|
||||
|
||||
// afterDeploy: [
|
||||
|
|
|
@ -68,22 +68,26 @@ class Actions {
|
|||
}
|
||||
|
||||
async listProjects() {
|
||||
let numProjects = await LiquidPledging.methods.numberOfPledgeAdmins().call();
|
||||
|
||||
const table = new Table({
|
||||
head: ['Id', 'Name', 'URL', 'ParentProject', 'Status', 'Commit Time', 'Owner', 'Plugin']
|
||||
});
|
||||
try {
|
||||
let numProjects = await this.contracts.LiquidPledging.methods.numberOfPledgeAdmins().call();
|
||||
|
||||
const table = new Table({
|
||||
head: ['Id', 'Name', 'URL', 'ParentProject', 'Status', 'Commit Time', 'Owner', 'Plugin']
|
||||
});
|
||||
|
||||
for(let i = 1; i <= numProjects; i++){
|
||||
const pledge = await LiquidPledging.methods.getPledgeAdmin(i).call();
|
||||
if(pledge.adminType !== '2') continue;
|
||||
for(let i = 1; i <= numProjects; i++){
|
||||
const pledge = await this.contracts.LiquidPledging.methods.getPledgeAdmin(i).call();
|
||||
if(pledge.adminType !== '2') continue;
|
||||
|
||||
table.push(
|
||||
[i, pledge.name, pledge.url, pledge.parentProject, pledge.canceled ? 'Canceled' : 'Active', pledge.commitTime, pledge.addr, pledge.plugin]
|
||||
);
|
||||
table.push(
|
||||
[i, pledge.name, pledge.url, pledge.parentProject, pledge.canceled ? 'Canceled' : 'Active', pledge.commitTime, pledge.addr, pledge.plugin]
|
||||
);
|
||||
}
|
||||
|
||||
console.log(table.toString());
|
||||
} catch(error){
|
||||
console.log("Couldn't obtain the list of projects: ", error.message);
|
||||
}
|
||||
|
||||
console.log(table.toString());
|
||||
}
|
||||
|
||||
addGiver(params) {
|
||||
|
|
Loading…
Reference in New Issue