From a88369c1a6b82631cce6c61c64f161dcca9a054f Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Thu, 10 Sep 2020 20:55:44 -0400 Subject: [PATCH] add legacy voting fncs --- .../dai-plugin-governance/src/GovPollingService.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/dai-plugin-governance/src/GovPollingService.js b/packages/dai-plugin-governance/src/GovPollingService.js index b9d8bcc8b..a5250ad2e 100644 --- a/packages/dai-plugin-governance/src/GovPollingService.js +++ b/packages/dai-plugin-governance/src/GovPollingService.js @@ -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) => { @@ -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); }