# Title: bveCVX Auto Voter
## Rules about how bveCVX gets distributed
```
Total amount of bveCVX == user owned bveCVX + treasury owned bveCVX
```
- The treasury is voting 100% for WBTC/BADGER
- the remainder votes 95/5: 95% for bribes, 5% for WBTC/BADGER
#### Example:
```
treasury address owns 100k bvecvx
total amount of bveCVX 1m
900k bveCVX non treasury (95% bribes, 5% badger/wbtc)
100k bveCVX treasury (100% badger/wbtc)
Overall would be:
855k votes for bribe pools
145k votes for badger/wbtc
855k = 95% of 900k
145k = 5% of 900k + treasury bveCVX
```
## Architecture
### Breakdown
- Data collection (use snapshot / votium subgraph to get current votes and bribes for pools)
- Vote weight logic (how we should vote for each pool based on current bribe and vote amounts)
- Vote submission (how often we should run and actually submitting the vote via snapshot)
### Data Collection
- https://llama.airforce/#/votium/rounds/8 example data llama can pull
- Pull votes for each pool from snapshot subgraph
Example of pulling all votes for the proposal: [link go graphiQL](https://hub.snapshot.org/graphql?operationName=Votes&query=query%20Votes%20%7B%0A%20%20votes%20(%0A%20%20%20%20first%3A%201000%0A%20%20%20%20skip%3A%200%0A%20%20%20%20where%3A%20%7B%0A%20%20%20%20%20%20proposal%3A%20%22QmetYVgwr8MXEBVg4gHNNK2D5Jre18vtJgC14VhDirh4VJ%22%0A%20%20%20%20%7D%0A%20%20%20%20orderBy%3A%20%22created%22%2C%0A%20%20%20%20orderDirection%3A%20desc%0A%20%20)%20%7B%0A%20%20%20%20id%0A%20%20%20%20voter%0A%20%20%20%20created%0A%20%20%20%20proposal%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%7D%0A%20%20%20%20choice%0A%09%09vp%0A%20%20%20%20space%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A)
- Pull bribes for each pool from votium (subgraph?)
- Calculate $ value of bribes per vote for pool
- Find number of free votes (votes for pool that are not votium)
### Vote Weight Logic
- Example manual spreadsheet Trit uses https://docs.google.com/spreadsheets/d/1R3dBig3f13jNgjTuNhLXcGVle1gxERNNKJD-2TAWgbE/edit#gid=612678328
- Calculate badger voting power at time of snapshot (and splits between treasury, bribe maximization, delegation, etc)
- Target pools with smaller percentage of free votes (mostly votium pools)
- Blacklist bribe tokens we don’t want (e.g. luna, cvx) and ignore those pools
- Explore historic performance of bribe (maybe last 4 rounds higher than average, might be alpha)
- Don’t get less than $5k USD of bribe token
- Handle scenario where we’ve already voted and we need to ignore our votes in calc
### Vote Submission
- How often should we run? (every hour?)
- Submit vote via snapshot
- https://github.com/Badger-Finance/snapshot-voting
### Relevant links
- https://votium.app/
- https://llama.airforce/#/votium/rounds/14
- https://vote.convexfinance.com/#/proposal/QmP3RDzMSL57J3669dXaWtPuqBhpTe1Hu3hLdojbVUcF8k
- https://docs.google.com/spreadsheets/d/1R3dBig3f13jNgjTuNhLXcGVle1gxERNNKJD-2TAWgbE/edit#gid=612678328
- https://forum.badger.finance/t/bip-87-bvecvx-restructure-voting-strategy-and-emissions-revised-with-community-feedback/5521
### Integration Libs or Whatever
- Pricing API (coingecko, our api, something)
- Subgraphs for snapshot and votium (gql)