From fc6a82e9f7c48882dfc4f9b31777568fc025d09b Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Thu, 10 Sep 2020 21:11:46 -0400 Subject: [PATCH] correct polling contract abi --- .../contracts/abis/PollingEmitter.json | 81 ++++++++++++++++++- .../src/GovPollingService.js | 8 +- 2 files changed, 84 insertions(+), 5 deletions(-) diff --git a/packages/dai-plugin-governance/contracts/abis/PollingEmitter.json b/packages/dai-plugin-governance/contracts/abis/PollingEmitter.json index 5572b1d17..0b6e0c7f9 100644 --- a/packages/dai-plugin-governance/contracts/abis/PollingEmitter.json +++ b/packages/dai-plugin-governance/contracts/abis/PollingEmitter.json @@ -1 +1,80 @@ -[{"constant":false,"inputs":[{"name":"pollId","type":"uint256"}],"name":"withdrawPoll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pollIds","type":"uint256[]"}],"name":"withdrawPoll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pollIds","type":"uint256[]"},{"name":"optionIds","type":"uint256[]"}],"name":"vote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pollId","type":"uint256"},{"name":"optionId","type":"uint256"}],"name":"vote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"npoll","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"startDate","type":"uint256"},{"name":"endDate","type":"uint256"},{"name":"multiHash","type":"string"},{"name":"url","type":"string"}],"name":"createPoll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"creator","type":"address"},{"indexed":false,"name":"blockCreated","type":"uint256"},{"indexed":true,"name":"pollId","type":"uint256"},{"indexed":false,"name":"startDate","type":"uint256"},{"indexed":false,"name":"endDate","type":"uint256"},{"indexed":false,"name":"multiHash","type":"string"},{"indexed":false,"name":"url","type":"string"}],"name":"PollCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"creator","type":"address"},{"indexed":false,"name":"blockWithdrawn","type":"uint256"},{"indexed":false,"name":"pollId","type":"uint256"}],"name":"PollWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"voter","type":"address"},{"indexed":true,"name":"pollId","type":"uint256"},{"indexed":true,"name":"optionId","type":"uint256"}],"name":"Voted","type":"event"}] +[ + { + "constant": false, + "inputs": [{ "name": "pollId", "type": "uint256" }], + "name": "withdrawPoll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "pollId", "type": "uint256" }, + { "name": "optionId", "type": "uint256" } + ], + "name": "vote", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "npoll", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "startDate", "type": "uint256" }, + { "name": "endDate", "type": "uint256" }, + { "name": "multiHash", "type": "string" }, + { "name": "url", "type": "string" } + ], + "name": "createPoll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "creator", "type": "address" }, + { "indexed": false, "name": "blockCreated", "type": "uint256" }, + { "indexed": true, "name": "pollId", "type": "uint256" }, + { "indexed": false, "name": "startDate", "type": "uint256" }, + { "indexed": false, "name": "endDate", "type": "uint256" }, + { "indexed": false, "name": "multiHash", "type": "string" }, + { "indexed": false, "name": "url", "type": "string" } + ], + "name": "PollCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "creator", "type": "address" }, + { "indexed": false, "name": "blockWithdrawn", "type": "uint256" }, + { "indexed": false, "name": "pollId", "type": "uint256" } + ], + "name": "PollWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "voter", "type": "address" }, + { "indexed": true, "name": "pollId", "type": "uint256" }, + { "indexed": true, "name": "optionId", "type": "uint256" } + ], + "name": "Voted", + "type": "event" + } +] diff --git a/packages/dai-plugin-governance/src/GovPollingService.js b/packages/dai-plugin-governance/src/GovPollingService.js index a5250ad2e..491c3a2ec 100644 --- a/packages/dai-plugin-governance/src/GovPollingService.js +++ b/packages/dai-plugin-governance/src/GovPollingService.js @@ -59,10 +59,6 @@ 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) => { @@ -72,6 +68,10 @@ export default class GovPollingService extends PrivateService { return this._batchPollingContract().vote(pollId, optionId); } + voteLegacy(pollId, optionId) { + return this._pollingContract().vote(pollId, optionId); + } + voteRankedChoiceLegacy(pollId, rankings) { const byteArray = new Uint8Array(32); rankings.forEach((optionIndex, i) => {