DappCon 2023: Whats Next For Cow? Composable Cow - Alex Vinas
DappCon 2023 · September 2023 · 22:47
Explores whats Next For Cow? Composable Cow.
Speakers
Topics
From DappCon 2023, hosted by Dappcon Berlin.
Transcript
hello everyone thank you for joining me and us so today I'm here to talk to you about what's next for cow and entering the era of composable cow and I'm Alex vas the product marketing manager at cow shop and I've broken down the talk into three into three topics a brief history of How cow shop came to me what has the cow's Journey been up to today and then finishing up with the era of composable C so first let's start with a bit of a brief history H it all started with the famous formula X time y equals K which actually not a lot of people know but it was coined by a nosis x employee back in 2017 and the reason for this was that nosis back then
was working on prediction markets and it needed a way to actually trade the outcomes of the prediction markets so you needed to find a mechanism to trade these outcomes in which also uh you're not going to have a lot of market makers provide liquidity right because if it's a major kind of event then maybe market makers will provide the liquidity but if it's the prediction of Market of will Alex screw his tcom presentation yes or no then you know you're not going to have a lot of market makers interested but the issue is that back then nosis already saw that this uh type of mechanism had a had a big problem right and even after some discussion also vitalic realized that the the mechanism had a big flow and the flow was that it
was vulnerable to Meb or more precisely to front running and this this was extremely bad because in the case of a prediction Market if you're are at the will of someone who can order the transactions at their own will it means that also the system is extremely manipal right like no matter what you call of chain if someone can alter the order at their own will the outcomes can com completely be different so back then already noses decided to stay away from this sort of mechanism and try a new mechanism and even though it's taking uh bit of a long time to play out well I think it was the the right decision and now time has demonstrated that indeed it was and what was this new mechanism that nosis decided to to focus on and you
guessed it it was auctions and it was auctions because auctions are important in the in the case of blockchains because there are several points to take into consideration the first one is that blockchains are in continuous SO trading on a continuous system doesn't make sense where all the transactions are happening automically and this notion of first come first serve can really be fair as it's ultimately leads to Simply like in trfy an arms race to kind of be the first one to trade and then H screw retail along the way and giving them a bad price the idea the idea of focusing on auctions was that auctions were also great of handling like the multiple tokens that they were going to appear throughout time in ethereum because
ethereum has lowered the barrier of creating tokens right with the ERC 20 standard it's super cheap and super easy to for anyone to create a single token so this is why also auctions are great for handling multiple multiple tokens at the same time and lastly because auctions can add guarantees that play well for the for the Trader right instead of saying I want to sell this for $100 you go to say like hey I'm willing to sell this what is the best price that that you can that you can actually give me but throughout the time NOS is tried different versions and along the way W it also learned different lessons back then in 2017 to 2019 nosis launched this exchange protocol which is called dut X which was
a trading mechanism focus on Dutch auctions and the idea for this exchange was to help uh projects that were launching icos to actually not suffer from from running and offer their users kind of like a fair price of entering in a way of like a normal Dutch auctions you start at a high price and then decrease the price until until the end but even back then nosis already saw that kind of DOD auctions weren't the solutions because they single kind of side tokens and you can't deal with the liquidity fragmentation that ethereum suffers or you can't deal with multiple amount of tokens at the same time then in 2019 they also work on a project called diffusion which was a zero
knowledge project focus on plasma but I guess the the Friendly Ghost kind of faded very quickly and the project never never saw saw the light into production and then in 2019 through 2020 no defi summer arrived and nosis protocol version one was launched and nosis protocol was a batch auction exchange mechanism with a batch settling time of 5 minutes it had its own solvers that uh competed to kind of give the best price for the users and it also had its own set of liquidity pools additionally also it had concentrated liquidity before bankless Shield boy said it was cool but the problem is that back then there was
a lot of kind of liquidity mercenary competition there was a lot of opportunities for yield chasing so kind of it was hard to boost strap the network effect of nosis protocol as the liquidity pools weren't big enough to kind of showcase the price improvements of of auctions then on 2021 nosis also launched nosis auction which was a batch auction mechanism for uh similar to icos but now they were called idos which were initial decentralized offerings and the idea was to give a uniform clearing prices and M protections for those projects that wanted to launch a new token but weren't really conscious of what what was the fair price for their token to launch and then on 2021 we
launched C protocol which was actually launched as nosis protocol B2 which was a similar concept that nosis protocol but instead of relying on its own set of liquidity pools it kind of was a layer on top of all the amm and aggregates so that instead of being self- dependent it could actually tap on these liquidity pools on top of giving these additional benefits of batching such as Coincidence of ons or even more just efficient batching of transactions overall but most importantly it also had a big uh move sound when you trade which I think is what a lot of people like and uh what has there been the the cow Journey up until today right so uh we built cow up for thinking mainly for all the type of
users but if you kind of like have to group them into three right the first one was retail or the normal user because the idea of CA was to use this delegate model execution so that instead of having the user navigate the the Dark Forest it would be these solvers that kind of do all the execution on their behalf so this would help users H not suffer from Meb but also kind of not have to worry if they're up to date on what is the best liquidity pool where I can trade the second one is uh smart contract accounts or in general smart contracts because the problem back then was that when you traded with a multi-c all the aggregators or decks forc you to commit to an execution path and this was
a cumbersome Because by the time that you actually had all the signatures probably the price was already outdated and the transaction would fail often which means that like you know you executed a transaction that led you to nothing but not only that if you were somewhat fast and could sign the transaction with enough time that the actual trade would hit the chain the problem that we saw is that most of the time the path that you you kind of like already committed was outdated that when your transaction hit the chain there was already like another better path for your trade and lastly for Dow there wasn't like a really trustless way for Dow to actually trade so this is why in the end we've had all these D just stack
up their Treasury and not have like not not use it how they should use them and and this is because there hasn't been a way since the Inception of smart ordance for them to trustly trade they would actually always have to go through like an intermed intermediary that HS the funds on on their behalf but even though it was originally built for these three users in mind it hasn't been the same path for all the users since the beginning at the beginning H kop which is the inventor of the intents as we know it by the way h only work for for EAS because they were the only ones that were able to trade gasless and this is because an EA has a private key and therefore because you
have a private key you're allowed to sign a message saying like hey I authorized to do this on my behalf as long as my conditions that I sign here are met but in the beginning this was only possible Right for Eos if you were a smart contract so if you were a save you had to actually go the onchain r route and execute a transaction which okay it was a is still better than nothing but it was still quite annoying because if you go the onchain route you actually had to pay for the transaction which is a bit more more annoying so it wasn't really until H the introduction of ERC 1271 smart order that the thing changed and as we said before because you an Nea uses e recover because it has a private key but a smart
contract doesn't have one we needed a new way using interactive signature verifications to allow the smart contracts to trade gasless and this new interactive way is called is BIC signature which allows the smart contract to kind of delegate the placement of the order on their behalf and basically just sit back and relax with the guarantee that they someone else will place the trade on chain and they only have to say I'm okay with this trade or I'm not okay and if they're okay the trade will will execute but what's cool is that then you can marry these kind of conditions with onchain guarantees so for example you can say like you know you know only execute if the price is within 1% of this Oracle price or else just simply don't execute
which is a big step forward for for smart contract trading and H now we're going to look at the first implementation of smart orders in cop the first one was the eow or the native sell token which was originary because in cop a lot of people were kind of annoyed and complain that you actually had to wrap your E when trading so basically we develop this new inter medary contract that would hold the funds on your behalf and would do all the wrapping on the back end without you knowing it and basically this contract just receives the fonts does the wrapping for you and places the order on chain like to sorry to theal API and then if the order is successful basically just sends you the the output
tokens or if not it will refund the original eth that was placed in then then the second one was a collaboration from the C grants program and Y which was a system for for advanced Dow traes which allows doubt to kind of swap autonomously through governance so instead of having to just make a CIP where you create a new save and kind of delegate the powers of trading you can now create a governance proposal that says hey we're going to swap this amount of tokens and we're going to do it through this mechanism that allows us to guarantee that you know we're not going to get wrecked by Meb even though we're kind of setting up this trade seven days or whatever days in advance and then this Milkman which is the intermediary
contract receives the funds and creates the order on your behalf based on the guarantees that you have instructed it and already today DS like a ens or Nexus mtil have traded more than 50 million dollars with this with this system but ERC 1271 single smart orders have some draws the first one is that in order to have the swap autonomous execution they're quite gas heavy right it takes a lot of gas to kind of encode these orders on chain and have them execute the second one is that they require some thrust because this intermediary contract actually to be able to place orders on your behalf need to have the funds on it so in this case this can be worrisome for for certain
people and understandably because you lose the custody of the funds and you're at the mercy that then you can actually withdraw them or that this intermediary contract is going to work and allow you to withdraw but lastly is that they're single order meaning that if you want to deploy multiple orders at the same time or multiple orders for whatever strategy that you're doing you have to make a signature per order that you are creating you can't just sign all at once so because of these drawbox of ERC 1271 orders uh Dow contributor decided to step up and create a framework around this orders and this is why we're now entering the era of composable car so so where is composable C well it all
started as I said because a dow contributor wanted to do time weighted average orders to buy eth but the problem he had is that he was a little bit lazy so he didn't want to sign each Order each time so then he started to develop conditional orders so that this use case could actually work for him but then he had this liable moment right where he realized that hey it's much better if we just create a framework around this so that anyone that thinks are like like me or is a bit lazy can actually encode all these orders on chain and have them execute autonomously so composable cow is this conditional smart order framework that allows a smart contract to express his int to trade in in cow protocol and what's cool
about this is that everything is unchanged so that there is no trust assumption because your assets are held on your own safe you don't need to send the assets anywhere until the trade is actually happen and lastly it's also super cool that everything is specify on chain so in case you're kind of like you know uh how do you say this in case you're not very trusty of the protocols that you're using you can add these guarantees on chain knowing that what your coding or what your program is going to execute as is so what is the composable cow architecture when you deploy a save there are two signing methods by default allow right the first one is approve hash transaction which was the the one
we use for pre-sign and this is just basically executing a transaction on chain that signals the that your save is allowed to do whatever operation that you're doing then the other one is a threshold which is basically the Assembly of the signatures and this one is the one that's G gasless but if you actually create a custom fallback Handler then you can allow your sa to H assign and validate much more complex orders that you know by default there the safe is not able to to understand so basically you're allowing your safe to H operate in much more complex scenarios and this is where I signature verifier in combination with ERC 1271 was created
and basically I save signature verifier is an AI encoded function call that triggers a a custom call for a assigner which in this case is composable cow and what does composable cow enable right right so another cool thing is that instead of being single order which was the normal c271 composable cow allows you to execute Smart Unlimited smart orders in parallel right you're not bound by the orders you're signing but rather by what whatever you want to do and what's cool about these type of orders is that they have a lot like extreme gas efficiency because all your orders can be summarized into a single Merk route and what's cool about this is
that you actually achieve a lot of of efficiency in creating deleting or replacing orders because instead of having to replace one by one you can simply just change the meral route and you will by the facto change whatever orders that you want to do and what's even cooler is that you have have achieve a lot of gas efficiency in here because creating one to end like one to a thousand orders is going to cost you the same gas cost and lastly it also allows you to have your own assets in the safe which is quite important as you no you have full custody of it but composable cow actually has four main properties when you're creating an order the first one is the the Handler which is the contract that verifies the
conditional order parameters so in this case for example in C of if you're doing a tww it would be like the tww contract then you have the salt which is like a cryptographic guarantee to kind of hide what you're doing so that no one that is trying to Brute Force you know and and can front run you for whatever trade you want to do can actually see it then you have the St aesthetic data which is all the sell token buy token you know slipage can of this H parameter information and then you can add additional offchain data that can be verified at the time of settlement that only you no in this case but you know in terms of actual example what does it actually enable so for example if if
you're a d or if you're a protocol that has to do fee collection every weekly for example it allows you to automatically set several orders to swap token ABC for xyc once your save hits a certain threshold right so in this case for example cow protocol has a cow settlement contract that it weekly drains the fees and and change them to pay and swaps them to pay the solvers so basically all this process could be automatic automated saying hey as soon as the balance of the settlement contract is more than I know $1,000 just directly swap them into it and deposited them in the solers payout safe it also allows you to do dow payrolls so say Hey you know we know that we have I don't
know 10 20 contributors and we have to pay them at the end of the month so instead of having to do the this recurring swap each month you can actually just set up the order saying hey on this month Swap this amount for for I don't know if for usdc and send the tokens to all these contributors and here is the cool part of the merket route that say one contributor throughout the month kind of disappears and you don't want to pay them well instead of having to redeploy like one by one the orders what you do is just just just simply update the the merel route it also allows for good aftertime orders which is I know trade on September 30th and not only until then you're allowed to trade as I mentioned it allows to create the tww orders which
is time weighted average price by just breaking the order into end times the good after times so when you're uh breaking the order into I don't know five parts of one hour you're basically creating five good aftertime orders it allows you to create private conditional orders and in this example the cool part is a stop loss so basically only you know when your trade is going to execute H sorry when your trade is going to hit the onchain so you can keep it quite confidential your your trading strategy it also allows for wait for cows basically just signaling to the protocol that hey I don't want you to root this to a liquidity pool or whatever I only want to trade when I'm doing this peer-to-peer with another user and it
also allows to place all these orders that we mentioned above simult simultaneously at the same time but most importantly it really allows you to do whatever you can imagine and you can you can code and so concluding what does composable cow enable right composable cow allows your safe to turn into your autonomous botler for placing orders but most importantly this botler ER can actually Place simultaneously conditional orders and trustless because you own the assets and you can add your own chain guarantees and if you're interested in integrating reach out to BD at CI and you're interested in building and want to H get a grant reach out to Grants at
cafi and thank [Applause] you thank you very much Alex for this presentation the floor is now open for questions easy questions there please yeah so there's the trigger and there's the action right in the trigger you need to Define what's the condition to do the action yes so can you really do anything for example I would like to withdraw my funds from cve if this something on chain happens yeah so that
on top if you when we actually launch cow hooks you can actually combine it so that then this act because composable cow is specific to the swapping aspect of things but then H enabled with cow hooks you can actually combine it with what you're saying like kind of withdraw from this LP position and then actually send the withdrawal result to H swap I know on this day you know if for these uh for these tokens and the logic is um based on Smart contract or a message that you need to sign no on the smart contract you on the call data if not mistaken thanks any other questions yeah you spoke about
Integrations do you expect a a user interface to be available for this as well or is this more protocol to protocol I mean I guess ideally we'll have a user interface but as as is right now it's more developer focus and developer friendly right it's not an EAS there's no easy way yet to kind of do this through an interface I mean you have t that you're that's the first interface of composable C but that's so far the scope of the user interfaces but if anyone has an idea and wants to build the UI please reach out we have a little bit of time for one or two questions
maybe or we call it a day yeah we can call it a day you can always find Alex in the break thank you thank you thank you thank you very much