# Mastering a Limit Order Protocol | Anton Bukov, co-founder of 1inch | ETHDam 2023

- Channel: [CryptoCanal](https://streameth.org/cryptocanal)
- Date: 2023-10-07
- Duration: 16:51
- Watch: https://streameth.org/watch/yt-hwQGWZTQ-3g
- YouTube: https://www.youtube.com/watch?v=hwQGWZTQ-3g

## Description

Anton Bukov is a co-founder of 1inch. 
https://twitter.com/k06a

ETHDam is a Hackathon & Conference that gathered over 500 DeFi and Privacy builders on the 20th and 21st of May 2023 in Amsterdam. 

Privacy is normal. Following the arrest of Alexey Pertsev, a Tornado Cash developer in the Netherlands, ETHDam 2023 is determined to counter the chilling effects of the lawsuit and bridge worlds to discuss the future of privacy, encouraging to build on the shoulders of cypherpunk giants.

ETHDam is powered by CryptoCanal, - a blockchain education and events platform growing in Amsterdam, spreading its roots to Rotterdam and Zurich. 

ETHDam 2024 is on the map already! Keep up with us to see updates: 

CryptoCanal https://www.cryptocanal.org/
CryptoCanal Twitter https://twitter.com/CryptoCanal
Join CryptoCanal Community https://t.me/CryptoCanalCommunity 

We would like to thank our partners and sponsors that made this event possible. 🌷

Our BFF 1inch https://1inch.io/

Our Frens: 
Sismo https://www.sismo.io/
Aleph Zero https://alephzero.org/
Scroll https://scroll.io/
RAILGUN https://railgun.org/#/

And our Sisters:
oasis.app https://oasis.app/#earn
Maven11 https://www.maven11.com/
bitvavo https://bitvavo.com/en
Lido https://lido.fi/
Spankchain https://spankchain.com/
API3 https://api3.org/
Gelato https://www.gelato.network/
VanEck https://www.vaneck.com/nl/en/crypto-etn
Marlin Protocol https://www.marlin.org/
Silent Protocol https://www.silentprotocol.org/
Cyber Capital https://cyber.capital/
… and Proto https://twitter.com/protolambda 🍍

## Transcript

foreign [Music] well I hope you're now a little bit more up to speed on regulation and how it's not all bad news and it does create some form of window of opportunity next up we have Anton from one inch who's going to be talking to us about mastering a limit order protocol thanks a lot and again I just want to remind you slido and do prepare I will ask you the audience questions after you're done with your presentation yeah hi can you hear me okay that's fine uh hi everyone I'm here to tell you about uh okay about one inch limit of the protocol one second thank you oh okay so I will describe you what exactly is this protocol and what it allows because it allows much more than is currently implemented on any depth so first of all our main priorities when we built it were MIT license which allows developers to do with it whatever they want which have no limitations uh we do not do not have any protocol fields and uh ultimate gas efficiency was our main priority we released already three versions and preparing to release next version and each time we're winning like tens of percentages of gas efficiency I don't know how we do this but it is already a much efficient much more efficient than any other protocol but with each new release we push it Forward somehow uh by the way I'm writing smart contracts at one inch okay so and yeah for sure this limit order protocol it incorporates unique features so I'll tell about the features on next slide so yeah we have prayer and post interactions so you can configure your order in that way that it will execute arbitrary arbitrary actions before it will be filled and after it will be filled also those one who is feeling uh the orders they can make kind of flash swap they can get maker assets can get a taker interaction call do whatever they want with these assets and then transfer from uh taker would happen and this is also this feature also allows reentrancy so if you want to feel five orders you could start filling them in oriented call so you would get all assets from all these five orders and then you can fill them somehow with any protocols or fill them mutually on each other and then when you finish your execution uh transfers to Makers would happen from your wallet uh that's uh how one inch Fusion is working uh uh it's uh mutually filling orders to each other and the rest of the amounts is swapped on the excess so there is also possibility to program custom Logic for transfers so it's not only transfers tokens from maker to Taker and then from uh taker to maker but instead of talking with transfer from you could deploy custom plugin we call them proxies but now we're switching to plugin name and yeah you can write some smart contract you can use its address as a token address in limit order protocol and limit order protocol would would call transfer from method with possibility to add extra data and you can write plugins for using nfts for using any other token standards for bash transfers so potentially you could make trans orders which swaps five tokens for three different tokens so arbitrary logic is possible here for sure some examples like your c71 your c1155 they are already implemented there in the repo and the next feature is dynamic prices so your order could not specify exact price you could write any arbitrary smart contract and provide static method view method and when order will be filled prices for this order they will be extracted from this method using this method you for example can make Dutch auction or maybe you can use prices from oracles you can make stop loss order or any other thing ah I have a separate slide for this so predicate its thing when someone is trying to fill your order there is a possibility for order to have predicate where limit order protocol would make a static call which and check if it's possible currently to feel disorder or not and for sure we support smart contract signatures uh that's uh pretty easy but some people don't know about this so you can have Smart contract and still be a maker in limit order protocol you will have not a real signature because digital signature is usually something involving your private key but this thing allows uh smart contracts to have digital signatures it works differently it works like limit order protocol would make a call is valid signature on your maker address and if it's returning special magic value this means that signature is valid so smart contracts are themselves responsible for checking if if their signature is correct or not and I have a number of potential applications which are currently not implemented so you could have Dutch auctions you could Implement uh this uh dynamic dynamic getter Dynamic price and you can have Dutch auction you can sell your nft or something with price uh following some curve which you could Define somehow in smart contract or you can make Constructor for anyone to make their own options uh you someone could Implement stop loss orders they could check I was predicate that price on Oracle is uh at some threshold and this means that they can be filled or can't be filled it's also possible to have a trillion stop loss orders arrange orders just imagine you can could place your order to be fully sold in some range for example you're gonna sell I don't know wrap it either from 2000 to 3000 you could build a some some piece of smart contract which with this limit order protocol would work as a range order so you would probably need here smart contract signatures and dynamic prices also arbitrary tragic strategies could be implemented so it's just matter of imagination and for example with a print post interactions it's possible to wrap and unwrap and your liquidity with uh kind of our compound wrappers on for example this could be stake it either or flight or something else and one more thing is that it's possible to create limit order which would behave as liquidator inside of it so it's possible to encapsulate liquidations of different money markets and this would make this liquidations more accessible I mean such orders would make liquidation much much easier for anyone else you don't if you would try to liquidate someone you would not need to uh write special software for compound or any other money market but you could just fill this custom made limited or I feel that there is like infinite number of possibilities here to implement so we as developers we implemented uh features like technical features but product features they are almost infinite so people who came up to any other crazy thing I discussed with one guys today uh tried to build a uh borrowing for nfts they are providing liquidity you could use your nft as collateral and you could borrow and they provided buyback and liquidation feature by limit order protocol it was much more convenient for them to use it because it just reduced their code base significantly and that's it it's pretty short presentation I have I had 15 minutes so now we have five minutes if you have any questions is there is one question you guys feel free to ask more the first question is can you elaborate a bit about how one can build a stop loss what are the main challenges to have a stop loss on decks slash aggregators yeah for example if we would try to implement stop loss on this limit order protocol I see that we can just use a predicate feature technical feature so it's kind of we need to build a piece of software you know front end up decentralized application which will create orders which will have special feature called predicate and whenever someone will try to feel disorder this predicate will be executed and a limit order protocol will understand if it's possible for now to fill it or not and for example inside this project we should you use oracles for example we could make a limit order which is for example we have price of either I don't know current prices probably two thousand okay and we afraid that it will fall below 180 and uh okay and we can uh make an order which will sell it one seven five zero but only when price on Oracle is below one eight zero zero and this would allow to have uh permissionless and debt centralized stop loss limit order because now if you are placing limit order on centralized exchange it could not work sometimes it depends if price moving too fast it couldn't work same thing happens here if price moving too fast it's probably no one will feel you but now here if you have this in D5 you are not depending from single entity like binance or coinbase or any other centralized exchange it's matter of Arbitrage so anyone is capable to feel you and you could probably have a better guarantee that nothing will be broken and it will work okay thank you the next question is can you tell us a bit about the entities who execute orders on one inch Fusion who are they and can they front run our trades uh yeah how Fusion Works uh basically it's limit orders where price is usually uh like minimal possible price for the order but uh they will call them private orders this means that there is only one address in the serum Network who can fill them and this address belongs to special smart contracts we can call them Fusion but technically it's called Uh settlement or one inch limit or a settlement or something like that and this smart contract also have checks who can use it and currently only few addresses can do this we call them resolvers these resolvers can fill those orders but these smart contracts also have Dash auction so each Fusion order is uh getting worse with each second for users but it's improving its price for counterpartis which these resolvers for any takers and what happens here that price is improving for these resolvers and they can potentially try to wait to get better price but they compete with each other you can wait but any other resolver could pick up disorders and feel it so competition among resolvers make them few orders with a smaller profits smaller Arbitrage profits and better rates for users and moreover they are also incentivized to be if they want to proceed with filling those orders they need to be in top list by delegations that's why they compete for user delegations and uh they can express their competition with uh farming Farms they had Farms they give away to users who delegate tokens to them and this competition allows users to play with apy so what I see that some users they do red delegation to rebalance to like get higher apy and yeah that's how it works this makes all those orders uh like Dutch auction for every user and for from what we saw but we're also preparing uh analysis for this that most of the users are getting much more better rates than they would have if they would just execute the transaction on their own because if you execute transaction on your own just basically use you pay for your gas but if someone like resolver fill in multiple orders you could share this transaction fees among other parties if you are a selling kid or someone is buying either this automatically makes you share your fees on each on each other yeah cool thank you and the last question I'll ask is do you know examples of projects that are already built or building this type of stop loss uh I'm not sure that there are big projects probably there are some not big ones uh and uh yeah I I'm like curious why no one build it and it's not popular yet because it's uh easy and there are protocols which allows you to do this for sure one inch can't have all these functionalities because that's a lot and that's why we built this protocol to be MIT licensed and anyone can use it or copy and use it or modify and use it yeah cool well thanks a lot and yeah please give a round of applause [Applause]
