I'm new to solidity and I'm working through a course and I've set myself a project but I can't work out what I'm doing wrong as the data I'm logging is showing me the values are what's expected based on the enum positions.
I'm using compiler version ^0.6.6
I first set up my enum
enum VOTE_STATUS {CLOSED,OPEN}
VOTE_STATUS public voting_status = VOTE_STATUS.CLOSED;
I then have a voting function which I'm calling require in.
function addVote(uint _vote) public{
// Make sure voting is open
require(voting_status == VOTE_STATUS.CLOSED,"Voting hasn't opened yet");
}
In remix when I click the voting_status button on the left-hand side it returns the correct option, 0 = CLOSED, 1 = OPEN.
The issue is when I run the require statement above it seems to think the enum is always set to OPEN when the logging and solidity say differently.
I've confirmed this by setting the require statement to check for OPEN when the status is closed and this gives me the result I'm looking for
voting_status = VOTE_STATUS.CLOSED;
require(voting_status == VOTE_STATUS.OPEN,"Voting hasn't opened yet");
Any help with this would be massively appreciated Thanks