Adding delegation to the voting smart contract
Most voting smart contracts that you encounter on the blockchain have the delegation feature. A lot of smart contracts have a treasury or money accumulated on the smart contract. How to spend this money is decided by the governance process in the smart contract. The governance process is basically the users of the smart contract voting on issues including where to spend this money.
Imagine there are a thousand users. Not everyone is keen on voting for every issue of the smart contract. What will happen is that most users will delegate their voting power to other people, who are small in number. These people will vote for most issues on the smart contract and are actively involved in the governance process.
To create a voting smart contract with the delegation feature, you need to add some functions that transfer the weight of a vote from one user to another.
Let us create a new file named DelegateVotingApp.vy
inside the contracts...