EatTheBlocks Forum

Dapp30 - Voting issue getting results of ballot

Hi EatTheBlocks community,

I am having issues on the retrieving the results of my contract in Remix. I have even used the code from the GitHub, but it tells me after my voters “vote”, that the admin can’t access the information.

This is the error I get when pressing “results” in the Remix IDE:

transact to Voting.vote errored: VM error: revert.

revert
	The transaction has been reverted to the initial state.
Reason provided by the contract: "voter can only vote once for a ballot".
Debug the transaction to get more information.
call to Voting.results errored: Error encoding arguments: Error: invalid BigNumber string (argument="value" value="" code=INVALID_ARGUMENT version=bignumber/5.5.0)

I am not sure why this happened because the decoded input is this:

{
	"uint256 ballotId": "0",
	"uint256 choiceId": "0"
}

Has anyone completed the Voting Dapp and wants to help me figure out why I Can get the voters to vote and the ballot to be created but I can’t get the results as the admin?

I’m using the same code as what is here on the repo: https://github.com/BrianHHough/eattheblocks/blob/master/dapp-30/day14-voting/smart-contract-solidity-0-8-update/Voting.sol

Thanks!