Description

Voter Splitter lets owners of on-chain governance tokens temporarily transfer their voting power to someone else. How it works: 1. 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. 2. 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. 3. 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. 3. 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)` - locks `amount` of underlying governance tokens in a vote vault. Caller receives `amount` of 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 given `proposalId` on 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 as `transferFrom(address from, address to, uint256 tokenId)` WRAPPED TOKEN: implements ERC20 functions such as `transfer(address recipient, uint256 amount)` The vault owner can call `closeOwnVault()` 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 call `closeExpiredVault()` on an expired vault if they have enough wrapped governance tokens. Closing the vault redeems the wrapped tokens for the underlying tokens.

How it's made

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 contracts - Typechain! We're glad that we can use typescript for writing our unit tests instead of javascript. - Waffle for writing smart contract tests WEB3 FRONTEND - We built a React frontend with chakra UI components for users to communicate with the on-chain contracts - We use ethers to send transactions to the blockchain - The app also uses eth-hooks for some helper methods for reading data from the contracts.

Technologies used

EthereumSolidity