I'm writing a function that is supposed to receive an array of uint's and I want to make a requirement that none of the elements in the array be the same and that all of the elements in the array be part of the pre-selected elements to belong in an array. So far I have:
function vote(uint[] memory proposals) external
{
Voter storage sender = voters[msg.sender];
require(sender.weight != 0, "Has no right to vote.");
require(!sender.voted, "Already voted.");
mapping(uint => bool) duplicateVotes;
require(!duplicateVotes, "Cannot vote for a proposal more than once.");
sender.voted = true;
sender.vote = proposals;
proposals[proposals].voteCount += sender.weight;
}
But I get an error:
The data location must be "storage", "memory" or "calldata" for variable, but none was given.
But I think this error is just a symptom of a larger problem. Can anyone help me figure out a solution to this problem?