Guide: Creating a Voting Vault
Last updated
Last updated
Council's modularity allows developers to easily create new voting vaults for new Council deployments, add them to existing deployments through governance.Let's go over how to create your own Voting Vault to extend Council's capabilities to fit your DAO's needs.
This guide uses Solidity to write a Voting Vault smart contract. You'll need:
Some experience with Solidity
Council contracts
Clone the repository
Get started by cloning or forking the open source Council Kit GitHub repository:
The Voting Vault Interface
Voting vaults must retrieve a user's voting power and a specified timestamp (vote creation), and return it to CoreVoting when requested. It can also parse extra data for custom instructions:
For example, let's consider a vault that allows anyone who calls it to have any number of votes per request. In this case, the extraData parameter can be used to set the voting power
The previous example does not seem very useful for governance, so let's consider a vault that gives voting power to holders of an NFT. You'll need a few more things
Voting Vault functions
You'll have to implement the following, at minimum:
a function to track and update voting power (see History.sol included in the repo)
a deposit function
queryVotePower function as required by the interface
Customize
You can tweak this contract by e.g. adding functions to withdraw or delegate, changing the votes given per NFT to a different number, making a function that considers rarity, or any other functionality you can think of.
Add to your Council deployment
You can add the vault to your new Council deployment by simply adding the address in the included deployment script. Existing deployments would require a governance proposal.