diff --git a/lib/contracts/contribution.js b/lib/contracts/contribution.js index ae7e450..68e0975 100644 --- a/lib/contracts/contribution.js +++ b/lib/contracts/contribution.js @@ -7,8 +7,7 @@ const Base = require('./base'); class Contribution extends Base { all() { return this.functions.contributionsCount() - .then((count) => { - count = count.toNumber(); + .then(count => { let contributions = []; for (let id = 1; id <= count; id++) { @@ -20,31 +19,29 @@ class Contribution extends Base { } getById(id) { - id = ethers.utils.bigNumberify(id); - return this.functions.getContribution(id) - .then((data) => { + .then(data => { return this.ipfs.catAndMerge(data, ContributionSerializer.deserialize); }); } getByContributorId(contributorId) { - return this.functions.balanceOf(address) - then((balance) => { - count = balance.toNumber(); - - let contributions = []; - - for (let index = 0; index <= count; index++) { - this.functions.tokenOfOwnerByIndex(address, index) - .then((id) => { - contributions.push(this.getById(id)); - }); - } - - return RSVP.all(contributions); - }); + // return this.functions.balanceOf(address) + // then(balance => { + // count = balance.toNumber(); + // + // let contributions = []; + // + // for (let index = 0; index <= count; index++) { + // this.functions.tokenOfOwnerByIndex(address, index) + // .then((id) => { + // contributions.push(this.getById(id)); + // }); + // } + // + // return RSVP.all(contributions); + // }); } getByContributorAddress(address) { diff --git a/lib/contracts/contributor.js b/lib/contracts/contributor.js index b122c20..029f7ef 100644 --- a/lib/contracts/contributor.js +++ b/lib/contracts/contributor.js @@ -7,8 +7,7 @@ const Base = require('./base'); class Contributor extends Base { all() { return this.functions.contributorsCount() - .then((count) => { - count = count.toNumber(); + .then(count => { let contributors = []; for (let id = 1; id <= count; id++) { @@ -20,8 +19,6 @@ class Contributor extends Base { } getById(id) { - id = ethers.utils.bigNumberify(id); - return this.functions.getContributorById(id) .then((data) => { // TODO: remove when naming updated on the contract diff --git a/scripts/add-contribution.js b/scripts/add-contribution.js index 8a6d84b..7b1e448 100644 --- a/scripts/add-contribution.js +++ b/scripts/add-contribution.js @@ -27,7 +27,7 @@ module.exports = async function(callback) { console.log(`Creating a contribution for contributor account ${contributorAccount} ID: ${contributorId}`); let contributionAttributes = { - contributorAccount, + contributorId, amount: await promptly.prompt('Amount: '), description: await promptly.prompt('Description: '), kind: await promptly.prompt('Kind: ', { default: 'dev' }), diff --git a/scripts/list-contributions.js b/scripts/list-contributions.js index 28e1734..cc2652a 100644 --- a/scripts/list-contributions.js +++ b/scripts/list-contributions.js @@ -14,7 +14,6 @@ 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'] }) @@ -24,7 +23,7 @@ module.exports = async function(callback) { contributions.forEach((c) => { table.push([ c.id.toString(), - c.contributor, + c.contributorId, c.amount.toString(), c.claimed, c.vetoed,