YIΞLDBOX - @BoringCrypto at @ETHDubaiConf

ETHDubai 2022 · March 2022 · 17:50

BoringCrypto introduces YieldBox, a new version of BentoBox, and its open-source implementation.

Speakers

Topics

From ETHDubai 2022, hosted by DeFi Dubai.

Transcript

so yield books unfortunately um it's not a protocol um doesn't have a token there's no dial there's nothing to a pin to so if you're here for that then go somewhere else so it's just a piece of infrastructure to to make development uh better and get better yields so let's go through it we're going to have a look at what the user benefits are um what the benefits for developers are we'll have a look at the contract stack and we're going to end with some examples so the user benefits

so one of the main things of of yield books is a way to get yields so to get into strategies so it makes it much easier to get into strategies currently if you want to get into a strategy let's say urine you have to go to the urine website if you want to go to some other strategy you have to go to another website and you have to figure out how these websites work and they all have clunky uis and it's very unclear how to use it and you also have to approve your tokens to each of these websites so with yield books you just approve your tokens to the yield box and then you can assign it to any strategy you want and you can move between strategies um

so it's all about capital efficiency so what does that mean let's say i have some eath and you know one thing i want to do is maybe i want to put it in a landing platform like here and then borrow some usd seat against it um but also i kind of want to use that same if to put into a strategy and and you know make some yield from it um so what i actually want to do is i want to take my eighth put it in a strategy and then i get some sort of strategy token then i want to put that into the lending platform and then borrow some usdc from it or even crazier i might then want to take that ustc swap it back to eve

and loop it again and then i get a little more leverage that way unfortunately these days this is normally the situation you run into whatever token the strategy gives you is not really um uh cannot be used in in the in in the lending platform because that just wants you know straight eth so with yield books basically every yieldbox asset is is a token plus a strategy or no strategy and that creates an asset and while that's sort of like a token uh an asset it's it it behaves mostly

still like eth so you can then take that and then if a lending platform is actually built on top of yield books you can then just borrow usdc against it so now you kind of um you can have your cake and eat it right so you get the yield from the strategy but also the benefit of the protocol another benefit for users is simpler approvals i bet most of you spend a lot of time doing approvals every time you have a new protocol or a new token you have to approve approve or proof so with yield books you approve your tokens once to the yield books

and when you have a new protocol you want to use all your tokens in you just approve that protocol once and then it has access to all your tokens so now we're going to look at the benefits for developers so every con almost every protocol out there has to deal with tokens it has to deal with eve and rapid it has to deal with erc20 tokens and that's for most protocols where it stops it doesn't support also nfts erc 721 it doesn't normally support erc 1155 tokens so with yield books without having to do any work as a developer you get support

for all of these without having to do any work and we'll look at some examples about that later another thing that most protocols can't deal with is rebasing tokens you normally would have to wrap them and then you'd have to use a wrapped version of it in your protocol that whole problem goes away as well as discussed the capital efficiency so if you build a protocol um by itself it has a certain yield a certain benefit to users if you build it on yield books it's the same protocol but extra yield for any tokens that are sort of sitting still they can be assigned to strategies by the user it also has a built-in token factory um we'll look at that and

overall and we'll see that in the examples you just get smaller simpler and less exploitable contracts um so this is the uh uh these are all the sort of different tokens so the way it works is so you can take any token whether that's a native token an erc20 some rebating token an nft an 1155 you can combine that with either no strategy or any strategy and it's completely permissionless so anyone can write strategies and and that people can choose those and that sort of wraps up wrapped up into a yield boy yield box asset and those are kind of um

uniform so as a protocol you do not have to worry about like how that accept works or or what that actually is so this is the token factory i talked about often what you see is let's say uni swap v2 every time there's a new pair you have to deploy an entire contract that is a complete erc 20 token that has all the swapping functionality repeated repeated repeated there's no need for that with yield books you can simply have a simple single contract and whenever it's a new pair you just call create token and you'll just get an asset id that is

just a simple erc 1155 token and then you can mint you can transfer the ownership and you can renounce the ownership so this is just the basic functionality you'll need in in most contracts and let's have a quick look at the contract stack so the core of the yield box is a standard erc 1155 implementation so it's a little small but that's just your your basic functions that are in there and then it gets wrapped into an asset register so that's kind of where you register and say hey i have this nft this token number

uh i want to combine it with this strategy give me an asset id for that and then from then on it you can just use it as an asset or or whether it's like an erc20 token or whatever you want to put in there and then that gets wrapped into the native token factory so that's the part where you can issue new tokens that your protocol might need it also includes the boring factory that's a very simple clone creator so you can get a master contract you can create any number of clones from that and it also keeps track of of the clones and one of the cool things about that is

with the approvals if you approve a certain master contract you've automatically approved all the clones so in in certain contracts this will be very helpful in that sense [Music] and then around that is the yield box contract that includes boring batchable just a very simple function that you can now call any any function in in the yieldbox you can batch it so you can call 10 of them at the same time in a single transaction such as some gas optimization there and here's some of the functions that

that are in yield books it's a way to deposit assets to withdraw them there's a whole bunch of different transfer functions depending on how you're transferring their gas optimized so whether you're transferring a whole bunch of assets from the same user to the same user or from one user you transfer to like 20 users that can be gas optimizations in that code so that's that's what this does let's look at some examples so is a very simple escrow contract so basically i can make an offer and say i have this asset this quantity if you

give me this other asset of this other quantity let's swap it i'll just i figured it would be a bit small so this is a this is the core part of that so the make just pushes the offer into an array it doesn't actually swap anything it just kind of puts it out there and then as you know providing you still have the assets in bento box if someone else wants to take that offer they call it take with the offer id um then you just ask yieldbox okay give me what i wanted and then i will return uh

the thing that that was on offer and then it closes in and you can obviously cancel as well so if you are the owner of of that offer you can say actually i don't want that offer out there anymore um so one thing to note here is that the contract escrow it's not like is erc20 or is something this is the entire contract if you deploy this on uh on the ether scan this will literally be all code you'll see plus the interface for yieldbox which is a couple of lines so this to deploy this this whole thing maybe a couple of hundred k in gas will be very cheap

this contract here is not just like an escrow service for for just erc 20 tokens this is also basically a limit order system for native tokens for erc20 tokens for erc 1155 tokens it's also a marketplace [Music] for nfts because you can put up an nft for offer and then someone can can can buy that this is also a way to swap nfts so this little contract here can do a whole lot of things and as you can see you don't have to deal with native tokens wrapping eve um

so this takes a whole lot of complexity out of it and less complexity means less bugs means getting wrecked less i had another little example here which is a tokenizer so let's say you have an nft and you want to tokenize it so this is the entire contract again i'll just get to the core of it so you [Music] deposit your your nft um you say uh the source i said you know it can be something else but nfc makes more sense you put one in um then here you can see how the create token works so then it it creates a tokenized version

of that of that nft it gives it a name and a symbol 18 decimals then the transfer brings in the nft because that's what you've got to give and in return it means you the tokenized version with tokenized tokens and then you can turn around and say okay now i've got all these tokens i want to withdraw the nft and you can simply burn those tokens and it will trans automatically transfer this this nft back back to you when yield books i'm still in development um

basically the most of the code's written and this is the github for it so you can you can check it out i'm now in the process of doing a lot of examples to see you know if i'm missing certain helper functions of things to make sure it really provides for all the different ways people want to use it also very keen on any feedback anyone has if you look at it that'll be great i'll leave this up for oh actually it's on here too um yeah so if you want to reach out um that's my twitter my discord the github is on there i'm always keen on feedback so i have some time left so any questions there's something i didn't understand

you mentioned the yield bearing tokens cannot be deposited to get um to borrow money but we do have by maybe you mean like just to clarify maybe it's within the the whole system yeah this part okay yes so we can take kian tokens and deposit it into a spell platform and get mem sure it's not like it's never possible but you can't put them into off it's like it has to be specific you know it's um it's a little bit harder because each platform that will want to support it

they would have to then understand exactly what a yearn uh eve token is and also how to get the price of that right whereas in in your books if you know the price of uh eve then you can just accept uh urine eath and half eve and compound eth and then so it's it's much easier so if you build a lending platform on top of uh yieldbox it will be much easier to just accept a whole long list of different collateral strategies so standardizing the whole process across it's it's a little more standardized and it's a it's it behaves a lot more like the original eth in a sense than um

when it's really locked into a strategy um and it's also a lot like um the way the sample strategies work it's a lot cheaper to unless you pull in big amounts or push in big amounts if you do small amounts there's like a buffer so there's almost no cost to getting into a strategy but that's really up to the person who writes the strategy but like the samples that i'm making work like that yeah thank you so much no worries hey boring very cool stuff so my question is uh what about licensing are you thinking about you know releasing this through a different license from banterbox and second how do you think about the trade off of keeping all these assets within one

single smart contract which is basically this gigantic um you know vault holding everything from a security perspective instead of isolated uh you know pools or tokens okay the first one first one is simple um almost every part of it will be mit licensed um just the core yield books uh is unlicensed simply because there should be only one on each chain and and i will deploy them um because there's no point having more than one it's uh i said there's no toke or anything there's nothing to gain from having more than one of them but and if someone wants to work on it or make it even much cooler or whatever like just reach out like it's just to you know i just didn't license it

because i don't want like 10 different yield boxes out there that would just be silly yeah the second part um yeah my question was about it looks like there is a you know significant trade-offs in holding all these assets into a single place compared to have isolated pools and uh i know this is kind of becoming a little bit uh yeah more accepted within the community after maker after balancer after bento box like do you think there is something to be concerned in having this single smart contract holding all these different assets compared to many different isolated pools um i think for this one not so much and also like a lot of tokens will actually not be held inside the bento box because if you assign it to a strategy it's

actually the strategy that gets the tokens because they are going to be dealing with it so it will be bento box is true it's like most of it is sitting in there with yield box it will be more spread out so only if you don't design a strategy it will actually end up in the bento box gotcha thank you very much all right give a hand for boring crypto [Applause] you