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

Loading player…

Hackathon Workshop:Dyson Finance_ETHTaipei 2024

ETHTaipeiWed, Oct 9, 2024, 12:00 AM

Transcript

okay hello everyone we're starting our second Workshop from Dyson Finance defi dual investment as a source of yield of for deps welcome give a round of applause to Champ hi uh it is said that I have like some leisure time to like introduce more regarding dys and finance but I I think I'll still finish the whole sharing with in half an hour but probably we can like have some time left if any of you would like to ask more questions yeah so um let me get started from like giving a technical introduction of how dys Finance is built and like to give you some understanding of like the internal mechanism of the smart contract so I I I believe it would help you to like finish your integration yeah oh yeah and I'll share the link uh in the Discord Channel afterward okay so uh regarding D Finance uh there are some thesis like uh instead of uh maximizing trading volume we we want to maximize fee income instead and it is said that um most most of the dexes are competing with each other uh on the spectrum of uh like having more tvl or having more trading volume they want to maximize their market cap but uh that isn't necessarily beneficial for liquidity providers like for example we can see some dexs like triggering their LPS to lower Fe tier for example Unis swap or say Cur and also we can even see some tax lower their fee to zero just to win some trading value but that just don't make sense for liquidity providers yeah and we want to do exactly the opposite so we might not be the Decks that have the most uh volume but the percentage of uh our should be higher than the others yeah and the the the second concept here is uh Dynamic fee yeah and if you are familiar with uh Dex especially Dex within this one or two years you might notice that most of them claim to have a dynamic fee mechanism which is more say adaptive to market dynamics like they they they they try to charge higher fee when the market is more volatile and Versa yeah and usually they would rely on a v vality Oracle or maybe some centralized set of say admins but instead we have a different mechanism that directly use volume um the the ratio of volume and TV as an indicator of how uh how's the demand of liquidity in this market yeah and we believe this is more uh robust and could be harder to attack and the third one is like the fundamental of D Finance like we there's no LP those who deposit two tokens to me LP position but instead all of the liquidity provider in Dyson Finance are in fact selling options yeah and it makes sense because the measurement of liquidity is usually time based like when it comes to liquidity we care about uh slipage but also efficiency like how fast can you liquidate your position yeah so time is always a constraint yeah and that that's why we want to make that the the liquidity provision from our users in D Finance more like an option like liquidity yeah cuz you know how exactly amount and duration you would like to to provide liquidity and you get a fixed uh profit up front so that's start from the fundamentals so that's fet itself still have a say xyk mechanism and also it has its own say underlying liquidity pool so at this moment there's no external liquidity providers so all of the asset in the pool is owned by the protocol like for example let's say if the price of e is $200 then with $1 million worth of liquidity there's like 500k of usdc and two 250 e and the first thing you can do with this kind of pool is to perform swaps yeah quite quite straightforward yeah so that let's say if you uh sell one e to the protocol then likely you will get 1992 usdc yeah just the basic Sy YK formula yeah but when it comes to Du investment uh we will uh perceive it as a swap so when you do dual investment in D Finance it is in fact uh doing a swap but with some different conditions so first instead of directly giving back you uh the usdc that belongs to you it will be kept in the protocol yeah and you will get a note and I owe you that said oh the protocol ow you uh 1992 usdc but there's one extra condition which is the protocol retain the right to undo the whole swap so like let's say if the the note will take place for 3 days then supposingly 3 days later you should get your 1992 usdc but the protocol can decide to not pay you those usdc but instead uh return those e uh get deposit into a PO initially yeah so this is how data Finance try to uh construct the concept of uh option on top of uh xyk liquidity pool and if it's the user that solely selling uh option to the protocol then uh there won't be incentives and it does not make sense cuz when the price of it goes up then you'll get usdc but when the price of it goes down then the protocol will simply uh cancel the swap so what makes what uh let this make sense is uh the protocol will provide an extra Yol on top of that uh um note so for the previous example we said you will either get one e or uh 19992 usdc but with a 5% premium for a week 7 Days Later you are likely to get a 1.05 e or 2091 usdc so both sides seems to be more profitable than the initial investment which is uh $2,000 worth yeah so regardless getting e or usdc at the end you should think it is a profitable trade for you unless the price of e moves by a lot yeah so let's say you invest one e and eventually you get uh 1.05 e then it will be uh profitable for you uh if it's denoted in e but say if your e get converted into 2091 usdc and unfortunately the price of is uh spikes up to say um uh $3,000 then in theory you should be supposed to get 3K net worth but now you only have 2091 so you are in fact getting some kind of loss not an actual loss but like a potential loss yeah so that that's how this start to make sense for the user like there are in fact sell uh shorten volatility to get the premium from the protocol and then comes the next part which is dynamic fee so the the very first um feature of D dyam me Fe is that uh it is double-sided which means uh at a specific time frame the fee of buy side and sell side could be different yeah and it should start from zero and it will get uh the fee will get applied or say will increase whenever a swap happens but the fee will be applied on the opposite side of the swap so let's say if I uh sell e to the protocal so the reserve of e will increase and the reserve of usdc will decrease then the fee is applied on on uh the usdc side which means whomever want to make an opposite swap will get charged but not the one that make a same side swap yeah and this makes sense because uh we have a hypothesis here that um we are not ultimately we are not able to prevent fun running but we can uh mitigate the loss from backrounds which means we ourselves already noticed that there's a swap that uh affect the balance of the pool and we we knew that which direction should be profitable for back Runners so we can like make the fee directional and we can charge those backgrounders and try to cap some say Arbitrage profit or say me value inside the protocol rather than like uh uh getting exposed to the outside world yeah so we believe that when there's a swap and an opposite swap occurs in a very short time then it is more likely to be an arit Char so we want to charge them a higher fee so that uh the protocol can like effectively do Revenue sharing with those arv Chargers yeah so give an example say there's the same pool as before like total 1 million worth of liquidity and both sides of fee start from zero and say there's a user that perform a swap that's selling it to a protocol then we notice that the reserve of usdc get decreased by 4% so at the same time we apply a fee to those who want to swap usdc to E a 0.4% fee so once uh uh there's another traders that try to um use 1,000 usdc to buy cheap East he'll get charge a 4% fee which makes the overall outcome uh 0.501 yeah and by doing so we we can uh see the uh product of the pool growing so this is how dys and finance capture uh profit from this kind of background arbitres yeah so that's pretty much it regarding the technical side of Dyson finance and um we still have some time so I would like to like give a quick introduction of how D the other part of D and finance is designed and excuse me okay so the the first part as mentioned is your investment so whenever you try to do like an invest or say to provide liquidity in D Finance you always face a situation that you are you you have fail yourself like performing a swap but um you won't get the outcome immediately but instead you get a note that could be redeemed a certain time later and you you will see both sides gets a markup premium and that premium is also uh that premium also varies yeah so you need to make sure both um the exchange rate and also the premium is in your favor yeah and that is a point that when you try to implement stuff I mean in the hexon you need to be be aware of uh both both the price slipage and also uh the yeld is acceptable for the users yeah and overall I'll say uh there usually the the slipage should be covered by premium but it does not make like huge difference that you are in fact uh making selling ad option that link on an unfavorable price yeah so that is one thing that you need to exercise xra ction yeah and also I would like to share how we implement the dynamic fee mechanism so as I mentioned uh whenever there's a swap uh fee is applied on the opposite side yeah and by doing so we can see a very interesting uh Phenom which like in this given example let's say if the price of say e get pumped 2x in Unis swof then uh it won't be surprised that it will attract a lot of say me B and arbitragers try to make some decent profit but in this given scenario the liquidity provider of unisoft still make a fixed uh 0.

3% fee times volume but in da Finance the situation could be very different which is when there there's also a sudden swap that pump the price of e 2x but outside the the price of e uh in the outside world does not change then we probably will also attract Arbiters but as I mentioned if the price of it get pumped to X which means uh the reserve of is uh decrease by a lot so there will be a very high percentage of fee for those who want to sell e to the protocol and make the effective sell price remain low yeah and when a dynamic fee is applied it will be it will get decreased over time like there there will be a mechanism that decay the fee exponentially over time yeah so the the whole process could be considered as uh a Dutch auction that try to distribute the potential I charge opportunity between uh arit Chargers and also the protocol or maybe to be more specific to split the pro profit among the protocol the I Chargers and also the block Builders yeah so by by doing so we can see some interesting trade such as uh we no longer need to be worried about say um sandwich attack because sandwich Tech makes sense only if uh Bots can easily manipulate the spot price in the protocol and that's still true because we we do not have a mechanism that prevent people from like from running a swap but a successful sandwich attack contains a f round transaction and also a background transaction so front ring will remain success so the the user will probably still get wrecked if that happens but when the the uh arbitragers try to sell back to make profit he will find it difficult because at that moment the fee is very high and very likely to absorb all of the potential profit that could made by performing a seage attack yeah so that's like an interesting Dynamic that we we do not directly protect our users or say uninformed Traders but instead we uh try to uh punish Abit Chargers punish those sandwich ATT detectors by uh preventing from making profit from backgrounding yeah so that's not sufficient but it's also like uh an effective way to mitigate the potential loss of our uh of the Traders on our platform yeah and one last part I would like to mention is um sorry is this like how how we perceive dys Finance ourselves um if you have ever used uh C5 platform such as bance you probably will know there's a structural product called du investment exactly the same as us and that is a product that uh invite users to like say stake some assets and choose a specific strike price and they will get uh premium uh and the premium will be higher if the strike selected is closer to the spot price yeah and that is exactly the same concept as doing option trading like what when you're trading and when you are selling option that is like at the money you will get the The Highest Potential premium yeah but it's easily to find out that um if you directly goes to if you directly go to derit uh a crypto option C5 platform you can see uh the the exact quote of users buying or selling specific option position and you can easily compare like doing du investment on binance and selling an option on terabit with exactly the same strike and the same expir and you'll find out binance usually give you like a 40% ha cut like they they make profit by inviting their user to do the investment and then directly goes to Derby to hge and capture the difference of uh premium yeah and in D Finance the situation is not that different but since we do not rely on say um uh liquidity providers or Brokers so if there's like a hair cut on the premium it will all flows to the protocol either to the liquidity pool or to like the treasury of Dyson finance and that could be considered as a source of re Revenue stream and it could then use to P the governance tokens value yeah and by doing the advancement user will get D token farmed yeah so uh by doing so it is more like a redistribution of potential uh value that created by selling and underpriced sorry buying and underpriced option from our users because when user do do investment they are in fact selling option to the product go yeah and we use a lower price to to buy so likely in the long run we will make money yeah and uh regarding option selling we usually use a a a classic Model CLE shs to determine the potential premium and since we always do add the money option selling so we have a simp simplified uh formula look like this so we also need to r on implied validity and but the formula is quite simpler like you need to have the IV times 0.4 and then the square root of time yeah so by comparing with uh binance we can see that D most of the time D already won and considering the uh governance token formed from doing du investment it will be even more profitable yeah so that that's how we form our product and and uh it will become like a closed cycle that when user do your investment it will uh grow the liquidity pool and that will help us to perform swaps with external Traders and since we have a dynamic fee amm mechanism that could create uh profit that is somewhat proportional to the volatility of the token pairs so that should be able to generate sufficient profit to cover the premium we paid to do investment users and uh the leftover will be used to uh stream Revenue to token holders and finish the close cycle yeah and uh some product Concepts that shared in the previous uh um introduction I I can recall again like um so first I I think they can be like categorized in two different sectors the first one is like uh projects or say tools that can improve user experience of D Finance like uh every dual investment has an expiry then user probably will need to manually redeem and then reinvest and if you can help to create an auto reinvest stuffff probably connecting with say gelato or TR link then that could like improve the experience of users and also there's some uh potential way to further increase the capital efficiency by maybe uh tokenizing and using the DU investment position as a collector to borrow more assets like what people do in um gearbox and Alpha yeah and the second part could be quite different which is we consider dys Finance as a source of Revenue and we can build whatever product that makes sense whenever there's like some say price so like you probably can make some gamei or social five stuff that user need to deposit to play and the winner either it is like elected randomly or by scales will'll get a price and that that Source could be from either the premium or from uh the Dyson token farmed by all of the users that have ever performed do Investments yeah and regardless the first or the second sector you probably need to um have an membership nft and on test net you can get it directly from the foret and if you are uh looking for Manet uh invite code you can go to D Finance uh Discord cuz it is like very easy for our users to generate invite Cod yeah so it shouldn't be an issue to get a membership to make you or your smart contract eligible to farm D token yeah okay and one last thing is a quick go through of the code base and if you don't want to like uh di too deep into the whole Dyson Finance smart contract code base then I will recommend you to look at this contract called dys to go and it is pretty much like uh year on top of Dyson which help you to simplify the uh the process performing du investment for like atis Finance so by go through this single smart contract you'll have a like a whole understanding of how this like smart contract set work yeah so a l to go is quite simple it basically do a pool invest so we assume there's like a guild that uh the owner of the gu will provide uh the membership nft and also to St some token to get some y boost just like what curves toonomic do and uh for each user that want to perform a du investment VR dys to go they will have a position recorded like that directly point to their position on the main Dyson smart contract and also we will uh record the point that used to form uh governance token like how much contribution they have made by performing such a du investment yeah so like um sorry we can like directly go to the deposit function and as you can see there's some logic that deal with uh like selecting the pair to deposit and to perform the actual du investment but there's some extra logic that try to record how much we call it SP you can consider as point just like uh what a lot of projects are doing uh like like s to farm point that can be then convert to their governance token so in Di and point is also an indicator of the amount of du investment yeah so whenever a user perform a swap oh sorry whenever a user perform a du investment we will record how many points they generate and consider as like uh a measurement of their uh contribution to the guild and then when whenever they want to uh withdraw we will pay them th token proportionally yeah and this is quite simple just like yearn like you get whatever you farm but uh I think there will be a a huge space for people to create something that is more creative for example like you probably can make a say du um dual investment style of pull together that uh you perform du investment and you get whatever you get by withdrawing but uh in terms of the dce and farm by the whole Guild we will like randomly select a user that get everything yeah to try to increase the variance yeah so like that there's much more spaces for you to design and maybe you can try to integrate with other protocols to like win prices from different pool yeah to make things even like more interesting yeah so I think that's it for my sharing and uh if you have any question please feel free to reach out to me thank you

Automatic transcript — names and jargon may be misspelled.