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); }