 Hello, everyone. Welcome to my talk. Today I'm going to talk about a different way to design automated market makers in a way that hopefully is going to capture the MEV that currently is being lost to miners and other parties. So I'm Therico Giaccon, and I'm a smartphone developer at CalSwap. CalSwap, by the way, is an online exchange that protects you against MEV. So what is MEV, or maximum executable value? Currently, block builders have the responsibility of updating the state of the blockchain. So how is this done? By including, excluding, ordering transactions in a block. And for this, they get paid transaction fees and rewards. However, there are other ways that you can use to get money out of the block building process. So one very common attack is called the sandwich attack, in which a user transaction is exploited to extract MEV. So let's say that a user is creating a transaction once included in a block to sell on an automated market maker 100 E for 100,000 USDC. So as is usually customary, there is an extra slippage added in case the price moves between when the transaction is created and executed. And normally, it shouldn't really matter. The user should take the expected price. However, the point of sandwiching is actually using the slippage against the user. So how does it work? The block builder creates two transactions, one before and one after. This first transaction buys USDC and moves the price of the AMM to the minimum that would be accepted by the user. The user trades anyway because this is, according to the slippage, still valid. And then finally, the block builder can sell back the USDC at the new price. Basically, this is a safe bet for the block builder because a state update is controlled by them. But that's not everything there is to it. So now we have talked about an issue for a user transaction, but we don't need to have a transaction to have MEV. One new mechanism of structing value is called loss versus rebalancing. And it works more or less as follows. So let's say that we have an AMM on-chain, and its state is currently, well, we have a market price. What we need is more or less equivalent to 1,400 die. This could be any market price, not necessarily on-chain. So it could be, for example, a centralized exchange anywhere. And let's say that at the same time, an AMM is willing to give 1,400 die for one eat the same price. Sometime passes, no transactions occur on-chain. However, the market price change. Unclear Y could be some centralized marketplace that change the price. So suddenly, there is an arbitrage opportunity that can be exploited. So the AMM doesn't know anything about the market price, but if you can execute the transaction and you're guaranteed that it's going to be finalized, you can take this arbitrage opportunity. And this is more or less the essence of loss versus rebalancing, the different information that the AMM and the market has. So if the AMM had perfect information, the AMM would be very happy to use the current market price. However, this is not the case. And this money loss is basically the cost of providing liquidity on an AMM currently. So important to note, this is also that this is not impermanent loss. So it doesn't really depend on the relative change in value of the two assets in the AMM. This was, by the way, part of recent research by Tim Raffgarden. So there are related papers. Eventually, I'm going to give you more information. But that said, how can we avoid this? So let's actually try to build an AMM that captures MEV. So we start from any AMM, let's say a constant product AMM, like Uniswap. And on top of it, we create a mechanism where we can auction the right of executing the first trade on the exchange. So there is going to be a so-called lead searcher, which is the highest bidder that is going to take the right to execute the first transaction. As we see, this is a good way to capture this LVR. And the important thing here is that the proceeds don't go to, well, go to the liquidity providers. And this is the MEV that otherwise would be extracted by miners. So how can this actually work? So to do this, we simply say that no user can trade until their lead searcher has actually traded first. So you can see if the lead searcher actually trades, then all the transactions go through. Otherwise, if the block is reorganized differently, then the trade reverts. Naturally, this requires cooperation with the block builder. So the idea is that the block builder is aware of the concept of the AMM and orders everything accordingly. However, there is an incentive that is needed. And the incentive would be the gas used by the transaction. If the transaction reverts immediately, it's going to use less gas. And in particular, this would help the miner having an advantage. The block builder having an advantage on the MEV auction. So let's analyze some costs. So first, profits. The profits are estimated to be $9 per block. How are they estimated? So the Eden network is a network that works in a fairly similar way. So it also auctions off the right to the first slot in a block. And this is more or less the profit that comes from the Eden network, which is comparable to our structure. The costs are estimated to be $3 per block, which is basically the extra gas cost to enforce the rules that we just decided. And this is based on 40 G way gas price. However, it would be much lower in L2. So already, with this simple scheme, we would have a theoretically captured MEV of $6 per block. So I also want to point out that even if the extracted profit now for the AMM is $6, in principle, it could be much higher. So in this graph, I wanted to show the average block reward comparing flashboots, which extracts MEV, and other parties which don't. So you can see in the last two months, it's actually fairly consistently 0.1 ETH reward more, which is actually about more than $100 per block. So this is actually a fairly large amount. And it could also be extracted with different mechanisms of AMMs. OK, so in conclusion, we have that AMMs have hidden fees because of MEV, both for users and for liquidity providers. In current designs, well, these fees go to arbitrage and block builders. However, we can do better. And we can try to design our AMMs in a way that distributes fees differently. And this is what I hope to transmit with this stock. So all of this is working progress is being worked on. I would invite you, if you are interested, to join the discussion. And please, any opinion is welcome. If you are building an AMM, please extract all the MEV. And after this, thank you. And thank you again. Thank you.