Merge pull request #82 from 67P/dev/list_contributions

Improve list-contributions script
This commit is contained in:
bumi 2019-04-06 19:40:24 +00:00 committed by GitHub
commit b35dc2049b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,21 +15,31 @@ module.exports = async function(callback) {
console.log(`Using Contribution at: ${kredits.Contribution.contract.address}`);
const table = new Table({
head: ['ID', 'Contributor account', 'Amount', 'Claimed?', 'Vetoed?', 'Description']
head: ['ID', 'Contributor ID', 'Description', 'Amount', 'Confirmed?', 'Vetoed?', 'Claimed?']
})
let contributions = await kredits.Contribution.all()
try {
let blockNumber = await kredits.provider.getBlockNumber();
let contributions = await kredits.Contribution.all()
contributions.forEach((c) => {
table.push([
c.id.toString(),
c.contributorId,
c.amount.toString(),
c.claimed,
c.vetoed,
`${c.description}`
])
})
console.log(table.toString())
callback()
contributions.forEach((c) => {
const confirmed = !!(c.claimAtBlock < blockNumber)
table.push([
c.id.toString(),
c.contributorId,
`${c.description}`,
c.amount.toString(),
confirmed,
c.vetoed,
c.claimed,
])
})
console.log(table.toString())
} catch (err) {
console.log(err);
}
callback();
}