← Back to home

Governor Alpha Vote Splitter

ReactTypeScriptJavaScript

Vote Splitter lets users 'rent out' their votes for Governor Alpha (Compound-style) governances.

Problem Statement

Voter Splitter lets owners of on-chain governance tokens temporarily transfer their voting power to someone else.How it works:Users can lock governance tokens in a vault and receive that many ERC20 vote tokens. After creation, the user controls the vault and the wrapped tokens.The user can sell the vault, which is an ERC721 NFT. The vault controls the underlying votes on e.g. Compound for a few months.At any time, the owner of the vault can close their position by redeeming enough wrapped tokens to cover the underlying tokens in the vault. They will receive the original governance tokens.Every 50000 blocks – about every 3 months – all outstanding vaults expire. Anyone can close an expired vault by redeeming enough wrapped tokens to cover the underlying tokens in the vault.CONTRACT:createVault(uint256 amount)- locksamountof underlying governance tokens in a vote vault. Caller receivesamountof wrapped governance tokens and an NFT that represents the vault.closeOwnVault(uint vaultId)- the owner of the given vault can close their vault by redeeming enough wrapped tokens to cover the balance of the tokens locked in the vault.closeExpiredVault(uint vaultId)- anyone can close an expired vault by redeeming enough wrapped tokens to cover the balance of the tokens locked in the vault.VAULT:vote(uint proposalId, bool support)- votes yea/nay on the givenproposalIdon the underlying governance.delegate(address delegatee)- delegate to someone on the underlying governance, with vote weight equal to the locked tokens.also implements ERC721 functions such astransferFrom(address from, address to, uint256 tokenId)WRAPPED TOKEN: implements ERC20 functions such astransfer(address recipient, uint256 amount)The vault owner can callcloseOwnVault()if they have enough wrapped governance tokens to cover the underlying tokens in the vault. Closing the vault redeems the wrapped tokens for the underlying tokens.Every 50000 blocks, all vaults expire. Anyone can callcloseExpiredVault()on an expired vault if they have enough wrapped governance tokens. Closing the vault redeems the wrapped tokens for the underlying tokens.

Solution

VoteSplitter is built with some fantastic tools! We've been doing hackathons for years now, and we're always impressed how quickly the development tools improve.SMART CONTRACT LAYER:We built the smart contracts in Soldity.We used @openzeppelin/contracts library for things like ERC20 and ERC721 contracts.We use hardhat for building and compiling the contractsTypechain! We're glad that we can use typescript for writing our unit tests instead of javascript.Waffle for writing smart contract testsWEB3 FRONTENDWe built a React frontend with chakra UI components for users to communicate with the on-chain contractsWe use ethers to send transactions to the blockchainThe app also uses eth-hooks for some helper methods for reading data from the contracts.

Hackathon

MarketMake

2024

Contributors