Veto contributions

This commit is contained in:
2019-04-28 14:41:16 +01:00
parent c6a37f7e94
commit 9821c8b2ea
6 changed files with 54 additions and 35 deletions
+13 -2
View File
@@ -52,9 +52,10 @@ export default Service.extend({
});
}
function instantiateWithAccount (web3Provider, context) {
async function instantiateWithAccount (web3Provider, context) {
console.debug('[kredits] Using user-provided instance, e.g. from Mist browser or Metamask');
ethProvider = new ethers.providers.Web3Provider(web3Provider);
// const network = await ethProvider.getNetwork();
ethProvider.listAccounts().then(accounts => {
context.set('currentUserAccounts', accounts);
const ethSigner = accounts.length === 0 ? null : ethProvider.getSigner();
@@ -183,12 +184,22 @@ export default Service.extend({
console.debug('[kredits] vote for', proposalId);
return this.kredits.Proposal.functions.vote(proposalId)
.then((data) => {
.then(data => {
console.debug('[kredits] vote response', data);
return data;
});
},
veto(contributionId) {
console.debug('[kredits] veto against', contributionId);
return this.kredits.Contribution.functions.veto(contributionId)
.then(data => {
console.debug('[kredits] veto response', data);
return data;
});
},
getCurrentUser: computed('kredits.provider', function() {
if (isEmpty(this.currentUserAccounts)) {
return RSVP.resolve();