How to Become a Mighty Strategist - Facu Ameal
Ethereum Denver·Sun, Oct 9, 2022, 12:00 AM
Transcript
hello everyone i'm faku from yarn finance i'm pop to be here and to be doing this workshop this is going to be a high level overview on how to create a new investment strategy for yearn and then afterwards i will share a code so you can show in office hours let's start from the beginning what's a strategist a strategy is just a big brain guy or girl or whatever we don't care we encourage the anonymous community actually you don't need to be a hardcore developer or or anything you need to understand how things work how things connect that's that's the the most important thing programming languages you can learn them that's that's not a problem at all so let's see what's about a vault it's just a container of tokens like a piggy bank where you drop your tokens and then those tokens are taken by the strategies those are the ones that are going to be doing the all the heavy lifting of the of the strategy those vaults are going to to send their funds to strategy who's going to invest those funds it's going to collect the rewards and recycle them into the same token compounding your your investment so the vault the votes are written in viper they are on year c20 you can do whatever you do with a normal erc20 token like transfer it swap it uses as collateral as different protocols and everything else that drc20 is keeping track of the price per share and it's immutable that's super important for us to keep our our smart contracts immutable uh all the vaults run multiple statistics strategies per volt that's um that's an important thing to take into account because with 500 million dollars you cannot deploy them all at the same on the same place and we have also keepers integrated well what about the strategies we decided to do the the strategies in solidity because uh you are able to inherit from other from other contracts and that that's important because you're going to see that the although all the interactions between the strategy and the vault are already coded so it's super simple to create a new strategy they manage the accounting and invest and invest and recycle the rewards into the one token also um they take care of harvest they check the slippage and they keep the clutter ratio healthy that's that's to say you can manage a cdp position a collateralized position using a strategy and it's perfectly safe so it's safer uh to do it this way than a user doing it manually let's take a look at how it looks uh about today this is the yv yv usdc and it has as you can see a lot of strategies important things to take take care into account all of them have different percentages the strategist is the one who runs simulations and those simulations are the ones who decide how much uh percentage of capital all those strategies are going to get it's always it's always different because it changes depending on the status of the underlying protocol and the and the other important thing to take into account is that we have strategies with zero percent capital allocation they are ready to run but right now they might not be profitable it's not the right moment to enable them well here's the here's for me the most important part to call the strategy it's understanding how the whole system works it has five parts uh the keepers which are the the decentralized bot network that are going to run the harvest the harvest is a function that collects and recycles the rewards the vault the strategy identify protocol it can be any d5 protocol ave compound whatever and a dex to exchange the tokens that you receive as a reward for the want token this token that the user deposited so the the keeper is going to be monitoring um a view function that is called the harvest trigger when it becomes true it's going to execute the harvest function that harvest trigger is important because we want to collect the rewards and recycle them when it's profitable to do so because in ethereum gas costs are high so we got to take them into account when it happens what uh what the strategy has to do is to claim the rewards and swap them that's it it's going to receive the one token it's going to send that report to the vault because the strategy has to inform the vote what's going on with the underlying protocol to change the price per share it's going to adjust the credit available and this is an important concept the the strategies are taken like a loan so we call it that the strategy has a debt to with the vault that it has to return at some point okay that's just conceptual then it's going to adjust position we're going to see what what that does afterwards and send a success to the keeper and that's it well this is just like high level overview let's let's see how how the process looks like i'm going to do a like a fast run through the non-technical parts and we're going to see more in that uh some technical parts of the process okay first what do you need basic stuff git uh if brownie ganache is what we use the brownie mix repository this is uh this is actually a template that you can use and has a lot of work already done and i use vs code when i wrote my strategy i had some programming experience i only did a crypto zombies level 4 that was my solidity knowledge pretty basic so anyone can do it and i understood how things interacted at the at the vault and strategy level and i put a ton of willpower because you need to spend some time coding and then reviewing especially well let's go for it this is our process we're super security oriented so for us it's super important to to actually test in test and then test in both both things are important so we have a due diligence um part where the strategies has to have to do an investigation of the underlying protocol and present a report so the the security analyst can check it out and validate that everything is perfectly safe it's like a mini mini mini audit uh then you're going to code your strategy then it's going to go through the through a peer review because we all know that audits take time and a lot of money and then you go to an experimental website we have that's the part with testybroad and then the core devs are going to review it safe farming committee is going to review again the due diligence and it's going to give the green light to go to production let's go step by step this is the the deletion process you can check i i will just say some highlights about it like the rug ability section that it's not about the code but about who is governing those contracts that's super important because um when you check it you see multi-sex like uh one of them multisay that's not a good thing it's like now 10 people can rack the users so we ask the protocols hey we need this to be changed and they usually accept it and they're very very glad to do it so that these are the things that we check before starting to code a strategy it's it's it's nonsense to start coding a strategy using an unsafe protocol basic stuff to start start coding first the tools needed you're going to need if brownie and ganache you got to use the brownie strategy mix template and clone your repo that's basic stuff that super super simple well where do you have to take a look the strategy.sol is where all the work is going to be done or a big part of it because tests are also important so most of the stuff and the interactions we already have packaged them and it's in the base strategy.sol so you don't have to take care of it you only have to you have only just to code the custom interactions with the protocol that you're going to farm let's take a look at the three functions that you have to code this is this if you code these three three functions the strategy is going to work you might need more to implement your custom protocol but these are the three functions that you need adjust position it's just going to invest the funds so if it's a staking protocol it's going to stake those funds that's it the data standing the that ascending um parameter it's uh how much it has to invest liquid position is going to do the reverse it's going to withdraw from the from the underlying protocol or to liquidate the position if it's an lp or whatever and prepare return that's where the heavy lifting happens that's where you you have to pay more attention and where you have to calculate profits losses and also free up assets when you when the vaults need to withdraw because the the principle is that that every user has to be able to withdraw at any time at any point in time test test test test that's super important for us because we cannot test in test net we need the protocol to be live so you need to write tests this is the repository with the brownie mix we already have some basics tests coded for you so you can use them but this is a production strategy looks pretty different so you got to spend a lot of time testing because it was what's going to be useful uh to not have any issues when you have real money in the vault well this is almost last the last step two years two strategies uh have to review your strategy then you have to choose a name this is the fun part choose a name two emojis and it goes to experimental this is a real ball that was an experimental uh some time ago this is the part that we test in broad but we have a deposit limit just in case part of the procedure i'm going to go fast over this um is the safe farming committee it's a committee of people that is assessing if the strategy is ready to go to production or not or not is going to take uh into account the due diligence and also if the reviews and everything has been done and the core team review it's reviewed by our security specialists they do an in-depth review of the strategy or what we do to do the process faster if we already already reviewed the the protocol in the past and it's a fork we check the the differences we do a diff check okay you made it you did the strategy and it's in production but it's not done uh strategies need maintenance monitoring we monitor the harvest we monitor that ratio the apr and especially the state of the underlying protocol because if something changes the strategy needs to adapt or we need to adapt it so it's super important to stay and monitor that's been on guys and uh since the workshop is short we're going to hold office hours in half an hour this is our [Music] this is our telegram group for new strategies so if you scan it you are going to join what we call the boarding school the strategies are always there answering questions so if you are building something and you have questions that's the best place uh to do it during like 24 7. if you have any questions you can ask now also and then we can continue online okay one more thing i love pops so if you came here you can claim that po up it's a really nice one it's the first event that journey is sponsoring so for us it's a special one so claim it have a nice one thank you
Automatic transcript — names and jargon may be misspelled.