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: int128
proposals: public(map(int128, Proposal))
voters_voted: public(map(address, int128))
manager: public(address)
...
...
@public
def withdraw_money():
assert msg.sender == self.manager
send(self.manager, self.balance...