Developing a commercial voting application

Let's upgrade our smart contract to a commercial one. To vote, the voter needs to pay a small amount of money. This is similar to American Idol, in which people vote for who they want to win by text-messaging their choice.

Go back to the voting_project directory and open a new file in the contracts directory and name this CommercialVoting.vy. Refer to the code file in the following GitLab link for the full code of this code block: https://gitlab.com/arjunaskykok/hands-on-blockchain-for-python-developers/blob/master/chapter_06/voting_project/contracts/CommercialVoting.vy:

struct Proposal:    name: bytes32    vote_count: int128proposals: public(map(int128, Proposal))voters_voted: public(map(address, int128)) ...

Get Hands-On Blockchain for Python Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.