New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Token Governance - Rethinking the veToken Model with Joshua Fraser

Ethereum DenverMon, Oct 9, 2023, 12:00 AM

In this talk, we'll discuss the veToken model and how you can use an exponential instead of a linear decay curve to reduce code complexity, save on gas costs, and make it significantly easier to add new features like vote delegation. I already gave this talk at ETH Seoul earlier this year and would like to give an updated version of it now that we have more data on how people are using it. Today, 1inch announced that they are adopting the same concept in their governance contracts, so the idea is starting to pick up steam! Here's the video from that talk: https://www.youtube.com/watch?v=0ETwQ0La6gc Joshua Fraser Founder Origin Protocol Josh Fraser is the co-founder of Origin Protocol. Before working on Origin, Josh co-founded PriceSlash (acquired by BillShark), Din (formerly known as Forage), Torbit (acquired by Walmart Labs) and EventVue. Josh started coding at the age of 10 and has a BS in computer science from Clemson University. He has contributed to multiple open-source projects and has spoken at numerous conferences around the world about blockchain technology. Josh grew up in Scotland and plans to see the world from outer space one day. https://twitter.com/joshfraser

Transcript

foreign [Music] on hold with silvergate trying to get our money out so that they can play their employees and vendors and it's a good reminder of why we're all here trying to build protocols and better Financial system but doesn't have whole music that you have to listen to we are not asked to write uh or sign a form with a wet signature and fax it in to get your money out and you don't have to ask anyone or you don't have to trust anyone that the funds are safe and as we're building these new trustless protocols we have an important question which is how are we actually going to govern them because one of the things we know is even as we're writing immutable smart contracts things are going to change the ethereum ethereum itself has Fort hard Fort multiple times and it's going to hard Fork again and so you have to have some plan in place for how you're going to upgrade the protocol and that's where token governance comes into play and so today I'm going to be talking about token governance and our journey at origin and how we've handed over governance of our contracts to our community I've taken a bit of a a familiar path here starting from deployment with a single e of a wallet transferring it over to a multi-sake adding in the time lock in front so that people can feel uh comfortable knowing that hey if we do anything malicious we can see what's happening to moving to often snapshot boarding where the community involved and what they want and then the multi-seed can actually execute those changes and then finally and we're very proud of this moving to 100 full on-channed talking governance and we've gone through that entire life cycle and so today what I'm going to be talking about specifically is the de token model was pioneered by curve we're going to talk about what it is why it's awesome and then how we can make it better and for a quick introduction here so origin you may know as we've been around since 2017 and we have two big products that we're working on we have origin story which is our nft platform it's done multiple record-breaking nft sales and then we have origin dollar which is a yield bearing stable coin we're going to be talking mostly about origin dollar because uh that's a governance token that we we launched from the the on chain but let me give you a quick intro to origin story uh for those of you who are into nfts and interested in that space uh so we've done some a lot of record-breaking sales starting with blouse sale that did 11.7 million dollars and really ushered nfts into the mainstream Consciousness from there we worked with tons of other top NF nft creators in the just in the EDM space we work with people like base trackers Kashmir Don Diablo Ryan Tedder for one repo One Republic Paris Hilton work with us SpaceX work with us and we're really proud of all the work we did to bring mainstream users into crypto and using these working with these partners that have millions and millions of people in their audiences and helping bring them into the space we have an nft Marketplace that allows you to sell your own collection on your own domain under your own experience a good example here is pudgy penguins in the marketplace that they have where you can go to the party Penguin website they get to control the look and feel set their own terms on royalties and how they want to create this custom experience so that's all I'm going to say about origin story but if you're interested in learning more you can go to story.xyz to learn more about that product you can also come find me afterwards and we can we can chat about that the other product we have at origin is origin dollar which is the yield bearing stablecoin uh it was about 60 million dollars in circulation uh it's currently only about five and a half percent apy and how it works it's this first stable coin that earns a yield while it's in your wallet so it's fully backed 100 collateralized you can redeem it at any time those funds that you hand into the protocol are deployed into yield earning strategies so you can earn a yield without any of our Hazel that's typically associated with yield farming if you're a yield farmer you're probably pretty familiar with the experience where you take your funds put them in a farm then you have to come back Harvest those rewards take those rewards swap them on uni swap then you take those stable coins redeploy them back in the farm again and you have to keep doing that over and over again to get faster compounding of your money but you spend an absolute fortune in gas with origin dollar you just buy the token and watch for balance automatically go up right there in your wallet and all of the costs of all of that harvesting rewarding is done automatically you don't have to do any other work there's no staking there's no lockups you can come and go as you want and of course this has been audited by trailer beds and open Zeppelin and it's the easiest way to get access to to defy yields last year we went through this process of breaking out a new governance token for origin dollar so we have the 60 million dollars that's in ousd and we need another token to govern that and so we have ogn which is a governance token for our nft platform so last year we went for a process of breaking it out and launching this new token which was airdrop to our ogn holders and so people are able to stake their ogv for a portion of the fees that are generated by ousd and then these token holders of ones who are actually making really important decisions relating to the uh for protocol so I did questions like what is the appropriate amount of risk for his protocols to take do we want to be aping into high risk strategies do we want to be going and limiting ourselves to you know battle tested Blue Chip protocols um how much do we be putting into convex versus are they token holders of ones who make those kind of really important decisions so when we started building this out first thing we looked at was curve enter ve token model uh ve stands for vo escrow and so it takes your in Curve Model you take your tokens you lock them up for anywhere from one week to four years to get ve CRV and exchange and what's really great about their model is that it transfers the voting and economic power to the people who are most invested in the long-term success of a protocol four years in crypto is a really long time it scares away all the people that you don't want governing your protocol and so uh the way it works the longer you lock up the more rewards you get and the more governance power you have and this model is incredibly incredibly popular you can see it's been it's been copied by frax balancer dydx urine platypus Finance State dial and the list goes on there's this uh this website the market cap.com uh I couldn't get it to load this morning so I don't know if the site's down or whatever but there's a site that has all the different protocols that have actually copied this ve token model means billions and billions and billions of dollars that are being secured by this voting mechanism today but when we looked at all of those projects what I saw was pretty much everyone copy pasted the curve contracts which is actually a pretty good Instinct right if these are battle tested protocols we know it works it's not broken don't fix it there's a lot to be said for reusing code that we know works but there have been only a couple attempts to to improve these these contracts uh fracts made the alteration where you had to use a white list for a smart contract to be able to vote lock their tokens for anyone who's followed the curve Wars you know why right if they didn't want to be convexed where convex came aggregated all of the voting power and their in their contracts and so Frack said no we're not going to allow that to happen now of course last year they partnered up with with uh convex and so they've gone the complete opposite direction on that decision we've also seen yarn uh roll out the option to exit early for a penalty uh and we've seen our projects have copied that as well but I remember those few changes we haven't seen a lot of innovation on the ve token model so we started making a wish list of how like how we wanted to improve it or things that we wanted in our governance system uh first thing was we we really wanted to use solidity instead of Viper nothing against Viper it's just our Dev setup is is all solidity and it's easier to integrate the curve contracts are very verbose there's a lot of code not very gas efficient and I said hey there's probably some optimizations here that we could make one of the quirks about the way they're voting Decay works or your voting power decays over time it means that the the sum of your transfer events is not equal to your voting power and so that is a bit a mix a lot of Integrations a lot more complicated because you can't just check your wallet balance to see what your voting power is another thing is a bit just of an inconvenience a curve you can only have one lock per wallet um it's really inconvenient like you have to send your funds to multiple different wallets if you want to do something like vesting I want to lock a quarter of my tokens for one year quarter of them for two years Etc really painful to do that on curve one day if you're asking people to lock their tokens for four years you're going to have to give them some sort of incentive to do that and so one thing is very very common here is to add rewards on top of um this you know exchange for logging up for four years here's what you're getting in exchange and so occur if you have to do that in a separate completely separate contract a separate step we may we thought it made sense let's just bundle that right into the same contracts since this is going to be something that everyone is going to need in order to get people to lock up and then finally and this is the the most difficult thing to implement with the Curve contracts is voter delegation and there's two use cases really cared about the first is how do you actually get a delegate to someone you trust voter participation in government governance is very poor one of the ways we can help and prove that is just make it easier right representative government delegate your votes to other people you trust and let them vote on your behalf and then the second thing is what if you have millions and millions of dollars worth of a governance token but you want to be voting every week in these proposals is a bit of a pain to do that from a multi-seg or a cold storage wallet right so it's very useful to be able to separate that out where you keep all of your tokens in a safe place on a multi-sig and then delegate your voting power to a new way wallet and metamask where you can be voting every single week and all of these things were very hard to do on curves contracts like I said the hardest one was delegation and so to explain this let me explain how curve works so you lock up for anywhere from one week to four years and then you get the ecrv which is your your voting power in exchange but that voting power decays over the time of the duration of your lock and it really makes sense the idea is on the last day of your lock you shouldn't be able to vote in something terrible for the protocol and then run away and leave everyone else with a problem right so it makes a lot of sense for for why you have to do this if you want to vote again at the end of this you have to recommit you have to re-lock for more time and then you can increase your voting power again but we have two variables here we have how many tokens you're locking that's your this is your y-axis here and then you have how many days you're locking for which is your y-axis right and so you have a slope so if we want to calculate the combined voting power and in this case we're paying a delegation right so I want to take two people I want to we've got voter the blue voter and we have the orange voter and they both want to delegate their voting power to someone awesome like myself right so how do we actually sum this up this is not very simple math all right so if there's no simple formula to explain this combined voting power and how it's Decay as is decaying over time and one of the most common use cases is calculating the percent ownership right what what percentage voting power do you have out of all of the votes in existence this is what that looks like right so maybe I can dust off some high school geometry math to figure this out but this is not the easiest thing to do in solidity and that's just for two users let's try and do it with four so these are four users they're all wanting to delegate their voting power again the y-axis is how many tokens you're locking your x-axis is how long you're voting for and that's what you end up with that is your combined delegated voting power that is not the kind of math you want to be doing in solidity at all so one of the engineers on our team Daniel Von fans is very well known security researcher ask a very interesting question he's saying why don't we just use an exponential decay function instead so oh okay well why is that interesting well now we don't need to worry about different slopes for different people each of these things is going to be decaying at a constant rate so we can actually see what that looks like so taking the same thing except instead of using a linear Decay we're using an exponential decay and then when we add them up we actually things get a lot simpler because they're decaying at a constant rate we actually only have to update things on the blockchain whenever someone Stakes or unstakes we're not worrying about any other point in time so this means we're no longer writing for Loops we're no longer iterating through all of these different checkpoints where you have in curve it's only only when people stake or on stake does anything need to change wow look how much sunflower that is right so the blue voter has 100 of a voting power then orange voter comes in vote locks and then you can see Blues voting power drops and orange jumps up this is way way simpler for us to think about so let's try it again with four users and see how it scales again this is much much better we only have to worry about it when someone Stakes or unstakes this is a lot easier to code in solidity and so again your voting power only it goes down if someone else stakes and it goes up if someone else unstakes makes it really really simple so comparing the two models on the linear Decay we have checkpoints we have expensive for loops and we have to write all of these different things on chain on the exponential curve there's no take points no for Loops we'll have to write the time the block and how many points they have now the next Innovation that we realized we could add is using a concept from from equity and how USU shares as a company so if you're uh if you have a company and you have early stage investors you give them all stock and then Andreessen Horowitz comes along and wants to give you 20 million dollars you don't go to all of your old investors and say Hey can I have some of the shares back we want to give them some to Andreessen Horowitz what do you do you just print more shares right and everyone gets to keep the exact same number of shares that they had but now your percent ownership of a network is smaller because there's more shares in existence so this is the model that we used here so new Seekers get increasingly more tokens over time and so the shares that your the votes that you get you get to keep but your percentage share of a network gets smaller and smaller as you get deluded by new people coming in does that make sense all right so again just comparing the two different models number of votes decreases over time and then one of the problems with curve is that your balance you're voting the number of vecrv you have that's not what your voting power is you actually have to go figure out where you are in that decay curve and do a bunch of math to figure out what your voting power is on the exponential model the number of tokens in your wallet is the number of votes you have if you want to know what your percent voting power is you just take the number of total number of VEC ve ogv tokens in existence and then do a simple fraction and that's your share of voting power so it's way way easier and then of course this means that it's compatible with open Zeppelin's erc20 snapshot so it means you can very very cost effectively you can say what is the voting power at this particular block so this is really useful for governance right because you want to be able to say when this when this proposal was issued who who had how many votes at that point right you don't want someone to be able to buy a whole bunch of votes after the proposal is actually live so again we added multiple new features here we added in delegation which you really can't do in curve without having crazy crazy for loops with hundreds of iterations we also added in rewards for anyone who is stakes and even with those two major new features we still see massive gas reductions locks cost 20 percent less extending your Lock 34 less unlocking and claiming 51 gas savings from using these contracts and you get delegation for free and it's really really cheap it's only 102 000 way and that's because again all you have to do is add two numbers right is my voting power plus your voting power that is the amount of voting power that you have super super easy so there are a couple quirks to be aware of one is again it's the exponential curve so it doesn't go to zero it there's always a little bit of residual floating power at the end we decided that's that's okay like it Trends towards zero we're never quite gets there um we just have to live with that uh the other thing that should be obvious but you get exponentially more units longer you stake for right so on curve you lock you lock 100 tokens for four years you get a hundred VEC RV in our model you lock up 100 ogv and you'll get something like a thousand V eogv in return and so it really skews the power to the people who are locking up for the longest time but again that's in line with our goals anyway so we decided um that's okay and then the last thing here is because we're only changing your percent ownership of a voting power on when people stake or on stake um if no one is interacting with the contracts things are just going to stay the same and so this works best when you have a pretty active system with people staking on staking pretty regularly you all know of a magical formula between behind uni swap right the x times y equals k well the formula for for Veo GB is is just as simple and just as magical so you have a number of e e ogv that you get is equal to the number of RGB you have times as constant k raised to the power of Y where Y is the end of your staking time and so that number will always be getting bigger over time right so if you stick up stake 100 RGB this week and then I stake 100 GB next week I'm going to get more than you would this week right uh and so you can see different values here for K uh if you want to get to Curves model you're probably best going around like 1.4 which would give you about a four year uh or about 4X multiple on voting power but you can choose your own adventure here as far as how aggressive you want to be with that constant so if you want to check this out it's 100 open source uses standard open Zeppelin libraries it's only 175 lines of code it comes with MasterChef rewards distribution built in to that it's been audited by open Zeppelin and this is live in production there's uh real people using this and it's securing tens of millions of dollars right now this is the governance dashboard we have we've been almost 80 percent of all ogv has been staked and so we're getting very high participation most of our stakers are coming back and restaking on a regular basis and we're offer we're able to offer uh quite a high apy for the people and again it's coming from a REV share on the fees are generated by ousd so you can check that out at governance.

ousd.com you can buy some more gvas take it play around with it and see how it works in real life uh and so that's it I know I'm a little bit over time here uh shout out to curve and very great work uh we're only here if it's only possible because of those have gone before and we're truly standing on the shoulders of giants so anyway that's my talk great to see you all thanks so much [Music]

Automatic transcript — names and jargon may be misspelled.