"The pirate sloop swayed gently in the breeze as the crew and their captain stood at the ready, anticipation coursing through their veins. With the sails unfurled and the anchor raised, they were ready to set sail. Yet, the question lingered in the air: where to? The captain proposed three options, each with its own epithet. Pattaya, the land of sin and pleasure; Phuket, the pearl of the Andaman; and Krabi, the emerald jewel of the sea. The crew huddled together, each with their own preference, eager to cast their vote and set course for their next adventure on the high seas."
Hi captain! As you can see, you are ready with your crew but you have not decided to where to go. Because of you are very demotratic leader, you want to create decentralized on-chain voting system on Solana. Your task is clear, write a program which has these features:
- Initialize Voting with three options
- Users can vote these options
- Count votes in an account
Now captain, our first need is an instruction which initialize voting. That means it will initialize Vote Account which holds vote counts. Also optionally it will hold a boolean about whether voting is open to vote or not. But first, please create an instruction which pass InitVoteAccount as a context like this and return Ok(()) as Result<()>:
init_vote_account(ctx: Context<InitVoteAccount>)