Now, let's develop a token-based voting application on the blockchain. What I mean by token-based voting is that in order to vote, you must have a token that is created in the smart contract. If you vote with this token, then the token is burnt, meaning that you cannot vote twice. In this smart contract, the number of tokens are also limited, unlike previous voting applications where unlimited accounts can vote. Let's write a smart contract in the contracts directory and name the file TokenBasedVoting.vy. Refer to the code file in the following GitLab link for the full code: https://gitlab.com/arjunaskykok/hands-on-blockchain-for-python-developers/blob/master/chapter_06/voting_project/contracts/TokenBasedVoting.vy:
struct Proposal:
name: bytes32
vote_count: int128
proposals: public(map(int128, Proposal))
...
...
@public
@constant...