Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
add legacy voting fncs
Browse files Browse the repository at this point in the history
  • Loading branch information
jparklev committed Sep 11, 2020
1 parent f6ce92c commit a88369c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/dai-plugin-governance/src/GovPollingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export default class GovPollingService extends PrivateService {
}
}

voteLegacy(pollId, optionId) {
return this._pollingContract().vote(pollId, optionId);
}

voteRankedChoice(pollId, rankings) {
const byteArray = new Uint8Array(32);
rankings.forEach((optionIndex, i) => {
Expand All @@ -68,6 +72,15 @@ export default class GovPollingService extends PrivateService {
return this._batchPollingContract().vote(pollId, optionId);
}

voteRankedChoiceLegacy(pollId, rankings) {
const byteArray = new Uint8Array(32);
rankings.forEach((optionIndex, i) => {
byteArray[byteArray.length - i - 1] = optionIndex + 1;
});
const optionId = fromBuffer(byteArray).toString();
return this._pollingContract().vote(pollId, optionId);
}

_pollingContract() {
return this.get('smartContract').getContractByName(POLLING);
}
Expand Down

0 comments on commit a88369c

Please sign in to comment.