From 9049a35bfb3fd2e30c0e018a786ca66be49df312 Mon Sep 17 00:00:00 2001 From: sam bacha Date: Mon, 20 Jun 2022 12:09:47 -0700 Subject: [PATCH] fix(tex): lint document (#3) --- src/main.tex | 430 +++++++++++++++++++++++++-------------------------- 1 file changed, 215 insertions(+), 215 deletions(-) diff --git a/src/main.tex b/src/main.tex index 51de088..beb8c79 100644 --- a/src/main.tex +++ b/src/main.tex @@ -39,16 +39,16 @@ \title{Procedural approaches towards Maximal Extracted Value} % \author{Alexander Sandy Bradley\inst{1,2} \and -Sam Bacha\inst{1,2} \and -et al\inst{1}} + Sam Bacha\inst{1,2} \and + et al\inst{1}} % %\authorrunning{F. Author et al.} % First names are abbreviated in the running head. % If there are more than two authors, 'et al.' is used. % \institute{Manifold Finance, Inc\and CommodityStream, Ltd.\\ -\email{\{sandy,sam\}@manifoldfinance.com}\\ -\email{janitor@manifoldfinance.com}} + \email{\{sandy,sam\}@manifoldfinance.com}\\ + \email{janitor@manifoldfinance.com}} % @@ -58,12 +58,12 @@ \tableofcontents -\newpage +\newpage %-------------------------------------------------------------------------------------------------------------------------------------- -\chapter{Protocol Specificcation} +\chapter{Protocol Specification} \begin{abstract} - MEV is sucks. \newline -MEV suck, Sandwiches sucks, use OpenMEVs.~\cite{openmev}. + MEV is sucks. \newline + MEV suck, Sandwiches sucks, use OpenMEVs.~\cite{openmev}. \end{abstract} \subsection{Design} @@ -90,27 +90,27 @@ \subsection{Security properties} %---------------------------------------------------------------------------------------------------------------------------------------- -\subsection{Conformant Algorithms} +\subsection{Conformant Algorithms} Conformant Algorithms Our requirements are phrased in the imperative, as such, part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the meaning of the RFC/EIP defined key words ("must", "should", "may", etc) used in introducing algorithms \hfill \break -Conformance requirements phrased as algorithms or specific steps that can be implemented in any manner, so long as the end result are equivalent. In particular, the algorithms defined in this specification are intended to be easy to understand and are not necessarily intended to be performant. Implementers are encouraged to either: switch to an L2, optimize, or use Vyper\footnote{Vyperlang: https://vyper.readthedocs.io/en/stable/}. +Conformance requirements phrased as algorithms or specific steps that can be implemented in any manner, so long as the end result are equivalent. In particular, the algorithms defined in this specification are intended to be easy to understand and are not necessarily intended to be performant. Implementer's are encouraged to either: switch to an L2, optimize, or use Vyper\footnote{Vyperlang: https://vyper.readthedocs.io/en/stable/}. %------------------------------------------------------------------------------------------------------------------------------------------------ \section{Swap Execution} - -Presented herein, a derivation of optimal arbitrage between 2 Constant Product Automated Market Maker (CPAAM), Decentralised Exchanges (DEXs) for usage in procedural processes that enable value extraction (i.e. MEV). -This math is applied in the new Sushiswap router for at the source of Miner Extractable Value (MEV). These trades post user swaps atomically. + +Presented herein, a derivation of optimal arbitrage between 2 Constant Product Automated Market Maker (CPAAM), Decentralized Exchanges (DEXs) for usage in procedural processes that enable value extraction (i.e. MEV). +This math is applied in the new Sushiswap router for at the source of Miner Extractable Value (MEV). These trades post user swaps atomically. Profits are distributed to liquidity providers, in turn giving users better rates. Extracting MEV at source protects user trades from front-run attacks inherently and helps prevent fee spikes from attackers. Slippage: The amount of price impact that a liquidator engenders when trying to sell collateral. -Slippage is denoted \text{$\Delta p(q)$} and is formally defined as the difference between the midpoint price at time $t, p_{\text {mid }}(t)$ and the execution price, \text{$p_{\text {exec }}(q, t)$} for a traded quantity $q$ at time $$t, \Delta p(q, t)=p_{\text {mid }}(t)-p_{\text {exec }}(q, t)$$. This quantity is usually a function of other variables, such as implied and realized volatility. +Slippage is denoted \text{$\Delta p(q)$} and is formally defined as the difference between the midpoint price at time $t, p_{\text {mid }}(t)$ and the execution price, \text{$p_{\text {exec }}(q, t)$} for a traded quantity $q$ at time $$t, \Delta p(q, t)=p_{\text {mid }}(t)-p_{\text {exec }}(q, t)$$. This quantity is usually a function of other variables, such as implied and realized volatility. \footnote{Slippage is also known as market impact within academic literature.} @@ -147,161 +147,161 @@ \subsection{Router Implementation} \end{minted} \newpage - + \chapter{Mathematical Model} - - - The following sections describe the derivation of the optimal sizes for post user swap arbitrage between UniswapV2 style exchanges. - - \footnote{Benchmarking contracts for establishing a baseline can be found here: https://github.com/manifoldfinance/v2-periphery/tree/master/contracts } - - - - %------------------------------------------------ - - \section{Constant Product Automated Market Maker} - Constant Product Automated Market Makers (CPAMMs) are smart contracts for token liquidity pairs. UniswapV2 and SushiswapV1 are all governed by the constant product formula given in equation \ref{eqn:constProduct}. - - \begin{eqnarray} - k &=& R_{\alpha} R_{\beta} \label{eqn:constProduct} - \end{eqnarray} - - Where \(R_{\alpha}\) corresponds to the Reserves of token \(\alpha\), \(R_{\beta}\) to the Reserves of token \(\beta\) within the pair contract and \( k \) the constant invariant. - - A swap trading \( \Delta\beta\) tokens for \( \Delta\alpha \) must satisfy equation \ref{eqn:swap}. - - \begin{eqnarray} - k &=& (R_{\alpha} - \Delta\alpha) (R_{\beta} + \gamma\Delta\beta ) \label{eqn:swap}\\ - \gamma &=& 1 - fee \label{eqn:gamma} - \end{eqnarray} - - Where the fee on UniswapV02 and SushiswapV01 is 0.3\% and 0.25\% respectively. For big integer math, equation \ref{eqn:gamma} can be written in the form of equation \ref{eqn:gammaBig}. - - \begin{eqnarray} - \gamma &=& \frac{997}{1000} \label{eqn:gammaBig} - \end{eqnarray} - - From equations \ref{eqn:constProduct} and \ref{eqn:swap} we can derive an equations for the expected amounts out and in, given in equations \ref{eqn:amountOut} and \ref{eqn:amountIn}. - - \begin{eqnarray} - amountOut: \Delta\alpha &=& \frac{997 R_{\alpha} \Delta\beta }{1000 R_{\beta} + 997 \Delta\beta} \label{eqn:amountOut}\\ - amountIn: \Delta\beta &=& \frac{1000 R_{\beta} \Delta\alpha }{997 (R_{\alpha} - \Delta\alpha)} \label{eqn:amountIn} - \end{eqnarray} - - Post swap, the new liquidity reserves are modified as shown in equations \ref{eqn:reserveA} and \ref{eqn:reserveB}. - - \begin{eqnarray} - R_{\alpha}{new} &=& R_{\alpha}{old} - \Delta\alpha \label{eqn:reserveA}\\ - R_{\beta}{new} &=& R_{\beta}{old} + \Delta\beta \label{eqn:reserveB} - \end{eqnarray} - - Therefore sequential swaps can be simulated off-chain in a deterministic way, given the current liquidity state. - - \section{Minimal Procedural DEX Arbitrage} - Establishing a minimal swap for DEX arbitrage consists of a single swap on one DEX followed by the reverse swap on another. - - Token amount swap path: - \begin{eqnarray} - DEX0: \: \: \Delta\beta_{0} \Rightarrow \Delta\alpha_{0}\\ - DEX1: \: \: \Delta\alpha_{0} \Rightarrow \Delta\beta_{1} - \end{eqnarray} - - \section{Optimal simple DEX arbitrage size} - From equation \ref{eqn:amountOut}, the definition of a simple DEX arbitrage for CPAMMs can be written in the form of equations \ref{eqn:dex1} and \ref{eqn:dex2}. - - \begin{eqnarray} - \Delta\alpha_{0} &=& \frac{997 R_{\alpha 0} \Delta\beta_{0} }{1000 R_{\beta 0} + 997 \Delta\beta_{0}} \label{eqn:dex1}\\ - \Delta\beta_{1} &=& \frac{997 R_{\beta 1} \Delta\alpha_{0} }{1000 R_{\alpha 1} + 997 \Delta\alpha_{0}} \label{eqn:dex2} - \end{eqnarray} - - Profit of the arbitrage is simply the amount out of the second trade minus the amount in of the first, shown by equation \ref{eqn:profit}. - - \begin{eqnarray} - profit: y &=& \Delta\beta_{1} - \Delta\beta_{0} \label{eqn:profit} - \end{eqnarray} - - - Substituting equation \ref{eqn:dex1} into equation \ref{eqn:dex2}, we get equation \ref{eqn:suby}. - - \begin{eqnarray} - \Delta\beta_{1} &=& \frac{997 R_{\beta 1} \frac{997 R_{\alpha 0} \Delta\beta_{0} }{1000 R_{\beta 0} + 997 \Delta\beta_{0}} }{1000 R_{\alpha 1} + 997 \frac{997 R_{\alpha 0} \Delta\beta_{0} }{1000 R_{\beta 0} + 997 \Delta\beta_{0}}} \label{eqn:suby}\\ - &=& \frac{997^2 R_{\beta 1} R_{\alpha 0} \Delta\beta_{0} }{(1000 R_{\beta 0} + 997 \Delta\beta_{0}) 1000 R_{\alpha 1} + 997^2 R_{\alpha 0} \Delta\beta_{0} } \label{eqn:subyMore} - \end{eqnarray} - - Since we are looking for the optimal amount In ( \(\Delta\beta_{0}\) ), we can make the following simplifications. - - \begin{eqnarray} - let \: x &=& \Delta\beta_{0}\\ - let \: C_{A} &=& 997^2 R_{\beta 1} R_{\alpha 0}\\ - let \: C_{B} &=& 1000^2 R_{\beta 0} R_{\alpha 1}\\ - let \: C_{C} &=& 997000 R_{\alpha 1}\\ - let \: C_{D} &=& 997^2 R_{\alpha 0} - \end{eqnarray} - - Thus equation \ref{eqn:subyMore} can be reduced to equation \ref{eqn:reduceOut}. - - \begin{eqnarray} - \Delta\beta_{1} &=& \frac{C_{A} x}{C_{B} + x(C_{C} + C_{D})} \label{eqn:reduceOut} - \end{eqnarray} - - Therefore the profit (y), from equation \ref{eqn:profit} can be expressed in terms of the amount In (x), shown in equation \ref{eqn:profit2}. - - \begin{eqnarray} - y &=& \frac{C_{A} x}{C_{B} + x(C_{C} + C_{D})} - x \label{eqn:profit2}\\ - &=& \frac{C_{A} x - x(C_{B} + x(C_{C} + C_{D}))}{C_{B} + x(C_{C} + C_{D})} \label{eqn:profit3}\\ - &=& \frac{x(C_{A} - C_{B}) - x^2(C_{C} + C_{D})}{C_{B} + x(C_{C} + C_{D})} \label{eqn:profit4}\\ - &=& \frac{x C_{F} - x^2 C_{G} }{C_{B} + x C_{G}} \label{eqn:profit5} - \end{eqnarray} - - Where: - \begin{eqnarray} - C_{F} &=& C_{A} - C_{B}\\ - C_{G} &=& C_{C} + C_{D} - \end{eqnarray} - - Maximum profit occurs at a turning point i.e. where the gradient or differential is zero, shown in equation \ref{eqn:turn}. - - \begin{eqnarray} - \frac{dy}{dx} = 0 \label{eqn:turn} - \end{eqnarray} - - Since we have a complex equation for differentiating, we can use the quotient rule from equation \ref{eqn:quotient}. Numerator and denominator differentials are shown in equations \ref{eqn:fdash} and \ref{eqn:gdash}. - - \begin{eqnarray} - \frac{dy}{dx} &=& \frac{d \frac{ f(x)}{g(x)}}{dx} \label{eqn:turn2}\\ - f(x) &=& x C_{F} - x^2 C_{G} \label{eqn:f}\\ - g(x) &=& C_{B} + x C_{G} \label{eqn:g}\\ - \frac{f(x)}{dx} &=& C_{F} - 2 x C_{G} \label{eqn:fdash}\\ - \frac{g(x)}{dx} &=& C_{G} \label{eqn:gdash} - \end{eqnarray} - - Combining the quotient rule with equation \ref{eqn:turn}, we get equation \ref{eqn:quoSolDex}, which expands to equation \ref{eqn:quoSol2}. - - \begin{eqnarray} - f'g &=& g'f \label{eqn:quoSolDex}\\ - (C_{F} - 2 x C_{G})(C_{B} + x C_{G}) &=& C_{G} ( x C_{F} - x^2 C_{G}) \label{eqn:quoSol2} - \end{eqnarray} - - Equation \ref{eqn:quoSol2} can be re-arranged to form a generic quadratic equation \ref{eqn:quadRefDex} and so the parameters can be defined for the quadratic solution in equation \ref{eqn:sol}. - - \begin{eqnarray} - x^2 C_{G}^2 + x(2 C_{B} C_{G}) - C_{B} C_{F} &=& 0 \label{eqn:quadRefDex} - \end{eqnarray} - - Solution to the optimal simple DEX arbitrage size for a given swap is shown in equation \ref{eqn:sol}. - - \begin{eqnarray} - x^* &=& \frac{-(2 C_{B} C_{G}) \pm \sqrt{(2 C_{B} C_{G})^2 - 4(C_{G}^2)(- C_{B} C_{F})}}{2 C_{G}^2} \label{eqn:sol} - \end{eqnarray} - - For positive roots only, this can be reduced to: - - \begin{eqnarray} - x^* &=& \frac{- C_{B} + \sqrt{C_{B} ^2 + C_{B} C_{F}}}{C_{G}} \label{eqn:sol2} - \end{eqnarray} - + + +The following sections describe the derivation of the optimal sizes for post user swap arbitrage between UniswapV2 style exchanges. + +\footnote{Benchmarking contracts for establishing a baseline can be found here: https://github.com/manifoldfinance/v2-periphery/tree/master/contracts } + + + +%------------------------------------------------ + +\section{Constant Product Automated Market Maker} +Constant Product Automated Market Makers (CPAMMs) are smart contracts for token liquidity pairs. UniswapV2 and SushiswapV1 are all governed by the constant product formula given in equation \ref{eqn:constProduct}. + +\begin{eqnarray} + k &=& R_{\alpha} R_{\beta} \label{eqn:constProduct} +\end{eqnarray} + +Where \(R_{\alpha}\) corresponds to the Reserves of token \(\alpha\), \(R_{\beta}\) to the Reserves of token \(\beta\) within the pair contract and \( k \) the constant invariant. + +A swap trading \( \Delta\beta\) tokens for \( \Delta\alpha \) must satisfy equation \ref{eqn:swap}. + +\begin{eqnarray} + k &=& (R_{\alpha} - \Delta\alpha) (R_{\beta} + \gamma\Delta\beta ) \label{eqn:swap}\\ + \gamma &=& 1 - fee \label{eqn:gamma} +\end{eqnarray} + +Where the fee on UniswapV02 and SushiswapV01 is 0.3\% and 0.25\% respectively. For big integer math, equation \ref{eqn:gamma} can be written in the form of equation \ref{eqn:gammaBig}. + +\begin{eqnarray} + \gamma &=& \frac{997}{1000} \label{eqn:gammaBig} +\end{eqnarray} + +From equations \ref{eqn:constProduct} and \ref{eqn:swap} we can derive an equations for the expected amounts out and in, given in equations \ref{eqn:amountOut} and \ref{eqn:amountIn}. + +\begin{eqnarray} + amountOut: \Delta\alpha &=& \frac{997 R_{\alpha} \Delta\beta }{1000 R_{\beta} + 997 \Delta\beta} \label{eqn:amountOut}\\ + amountIn: \Delta\beta &=& \frac{1000 R_{\beta} \Delta\alpha }{997 (R_{\alpha} - \Delta\alpha)} \label{eqn:amountIn} +\end{eqnarray} + +Post swap, the new liquidity reserves are modified as shown in equations \ref{eqn:reserveA} and \ref{eqn:reserveB}. + +\begin{eqnarray} + R_{\alpha}{new} &=& R_{\alpha}{old} - \Delta\alpha \label{eqn:reserveA}\\ + R_{\beta}{new} &=& R_{\beta}{old} + \Delta\beta \label{eqn:reserveB} +\end{eqnarray} + +Therefore sequential swaps can be simulated off-chain in a deterministic way, given the current liquidity state. + +\section{Minimal Procedural DEX Arbitrage} +Establishing a minimal swap for DEX arbitrage consists of a single swap on one DEX followed by the reverse swap on another. + +Token amount swap path: +\begin{eqnarray} + DEX0: \: \: \Delta\beta_{0} \Rightarrow \Delta\alpha_{0}\\ + DEX1: \: \: \Delta\alpha_{0} \Rightarrow \Delta\beta_{1} +\end{eqnarray} + +\section{Optimal simple DEX arbitrage size} +From equation \ref{eqn:amountOut}, the definition of a simple DEX arbitrage for CPAMMs can be written in the form of equations \ref{eqn:dex1} and \ref{eqn:dex2}. + +\begin{eqnarray} + \Delta\alpha_{0} &=& \frac{997 R_{\alpha 0} \Delta\beta_{0} }{1000 R_{\beta 0} + 997 \Delta\beta_{0}} \label{eqn:dex1}\\ + \Delta\beta_{1} &=& \frac{997 R_{\beta 1} \Delta\alpha_{0} }{1000 R_{\alpha 1} + 997 \Delta\alpha_{0}} \label{eqn:dex2} +\end{eqnarray} + +Profit of the arbitrage is simply the amount out of the second trade minus the amount in of the first, shown by equation \ref{eqn:profit}. + +\begin{eqnarray} + profit: y &=& \Delta\beta_{1} - \Delta\beta_{0} \label{eqn:profit} +\end{eqnarray} + + +Substituting equation \ref{eqn:dex1} into equation \ref{eqn:dex2}, we get equation \ref{eqn:suby}. + +\begin{eqnarray} + \Delta\beta_{1} &=& \frac{997 R_{\beta 1} \frac{997 R_{\alpha 0} \Delta\beta_{0} }{1000 R_{\beta 0} + 997 \Delta\beta_{0}} }{1000 R_{\alpha 1} + 997 \frac{997 R_{\alpha 0} \Delta\beta_{0} }{1000 R_{\beta 0} + 997 \Delta\beta_{0}}} \label{eqn:suby}\\ + &=& \frac{997^2 R_{\beta 1} R_{\alpha 0} \Delta\beta_{0} }{(1000 R_{\beta 0} + 997 \Delta\beta_{0}) 1000 R_{\alpha 1} + 997^2 R_{\alpha 0} \Delta\beta_{0} } \label{eqn:subyMore} +\end{eqnarray} + +Since we are looking for the optimal amount In ( \(\Delta\beta_{0}\) ), we can make the following simplifications. + +\begin{eqnarray} + let \: x &=& \Delta\beta_{0}\\ + let \: C_{A} &=& 997^2 R_{\beta 1} R_{\alpha 0}\\ + let \: C_{B} &=& 1000^2 R_{\beta 0} R_{\alpha 1}\\ + let \: C_{C} &=& 997000 R_{\alpha 1}\\ + let \: C_{D} &=& 997^2 R_{\alpha 0} +\end{eqnarray} + +Thus equation \ref{eqn:subyMore} can be reduced to equation \ref{eqn:reduceOut}. + +\begin{eqnarray} + \Delta\beta_{1} &=& \frac{C_{A} x}{C_{B} + x(C_{C} + C_{D})} \label{eqn:reduceOut} +\end{eqnarray} + +Therefore the profit (y), from equation \ref{eqn:profit} can be expressed in terms of the amount In (x), shown in equation \ref{eqn:profit2}. + +\begin{eqnarray} + y &=& \frac{C_{A} x}{C_{B} + x(C_{C} + C_{D})} - x \label{eqn:profit2}\\ + &=& \frac{C_{A} x - x(C_{B} + x(C_{C} + C_{D}))}{C_{B} + x(C_{C} + C_{D})} \label{eqn:profit3}\\ + &=& \frac{x(C_{A} - C_{B}) - x^2(C_{C} + C_{D})}{C_{B} + x(C_{C} + C_{D})} \label{eqn:profit4}\\ + &=& \frac{x C_{F} - x^2 C_{G} }{C_{B} + x C_{G}} \label{eqn:profit5} +\end{eqnarray} + +Where: +\begin{eqnarray} + C_{F} &=& C_{A} - C_{B}\\ + C_{G} &=& C_{C} + C_{D} +\end{eqnarray} + +Maximum profit occurs at a turning point i.e. where the gradient or differential is zero, shown in equation \ref{eqn:turn}. + +\begin{eqnarray} + \frac{dy}{dx} = 0 \label{eqn:turn} +\end{eqnarray} + +Since we have a complex equation for differentiating, we can use the quotient rule from equation \ref{eqn:quotient}. Numerator and denominator differentials are shown in equations \ref{eqn:fdash} and \ref{eqn:gdash}. + +\begin{eqnarray} + \frac{dy}{dx} &=& \frac{d \frac{ f(x)}{g(x)}}{dx} \label{eqn:turn2}\\ + f(x) &=& x C_{F} - x^2 C_{G} \label{eqn:f}\\ + g(x) &=& C_{B} + x C_{G} \label{eqn:g}\\ + \frac{f(x)}{dx} &=& C_{F} - 2 x C_{G} \label{eqn:fdash}\\ + \frac{g(x)}{dx} &=& C_{G} \label{eqn:gdash} +\end{eqnarray} + +Combining the quotient rule with equation \ref{eqn:turn}, we get equation \ref{eqn:quoSolDex}, which expands to equation \ref{eqn:quoSol2}. + +\begin{eqnarray} + f'g &=& g'f \label{eqn:quoSolDex}\\ + (C_{F} - 2 x C_{G})(C_{B} + x C_{G}) &=& C_{G} ( x C_{F} - x^2 C_{G}) \label{eqn:quoSol2} +\end{eqnarray} + +Equation \ref{eqn:quoSol2} can be re-arranged to form a generic quadratic equation \ref{eqn:quadRefDex} and so the parameters can be defined for the quadratic solution in equation \ref{eqn:sol}. + +\begin{eqnarray} + x^2 C_{G}^2 + x(2 C_{B} C_{G}) - C_{B} C_{F} &=& 0 \label{eqn:quadRefDex} +\end{eqnarray} + +Solution to the optimal simple DEX arbitrage size for a given swap is shown in equation \ref{eqn:sol}. + +\begin{eqnarray} + x^* &=& \frac{-(2 C_{B} C_{G}) \pm \sqrt{(2 C_{B} C_{G})^2 - 4(C_{G}^2)(- C_{B} C_{F})}}{2 C_{G}^2} \label{eqn:sol} +\end{eqnarray} + +For positive roots only, this can be reduced to: + +\begin{eqnarray} + x^* &=& \frac{- C_{B} + \sqrt{C_{B} ^2 + C_{B} C_{F}}}{C_{G}} \label{eqn:sol2} +\end{eqnarray} + \chapter{Equivalence Checking} @@ -377,7 +377,7 @@ \subsection{Backrun placement} } \end{minted} -Changes to +Changes to \begin{minted}{lexer.py:SolidityLexer -x} function pairFor(address factory, address tokenA, address tokenB) @@ -483,7 +483,7 @@ \subsection{Uint256 overflow} \end{lstlisting} -We also tried PRBMath\footnote{https://github.com/paulrberg/prb-math/} library. These faired better in echidna tests but still suffered overflow issues. +We also tried PRBMath\footnote{https://github.com/paulrberg/prb-math/} library. These faired better in echidna tests but still suffered overflow issues. \begin{lstlisting} echidna_mulUint: failed! @@ -525,55 +525,55 @@ \chapter{Conclusions and Future Work} % \chapter{Bibliography} \begin{thebibliography}{1} -\bibitem{openmev} -OpenMEV source code, \url{github.com/manifoldfinance/OpenMevRouter}. -Last accessed 20 April 2022 + \bibitem{openmev} + OpenMEV source code, \url{github.com/manifoldfinance/OpenMevRouter}. + Last accessed 20 April 2022 \bibliographystyle{unsrtnat} \bibliography{references} %%% Uncomment this line and comment out the ``thebibliography'' section below to use the external .bib file (using bibtex) . -\newline -\bibitem{Angeris2020} -Guillermo Angeris, Tarun Chitra, Alex Evans, Stephen Boyd -\newblock Guillermo Angeris et al. Optimal Routing for Constant Function Market Makers. arXiv:2204.05238 -\newblock In {\em arXiv 1911.03380}, 26 Jul 2021 - Optimization and Control (math.OC); Trading and Market Microstructure (q-fin.TR) - -\hfill \break -\bibitem{Angeris2019} -Guillermo Angeris et al. An analysis of Uniswap markets. 2019. arXiv: 1911.03380 -\newblock An analysis of Uniswap markets. -Mathematical Finance (q-fin.MF); Optimization and Control; Trading and Market Microstructure (q-fin.TR) -\newblock {\em arXiv: 1911.03380}, - -\hfill \break -\bibitem{Angeris2019} -Guillermo Angeris, Alex Evans, Tarun Chitra -\newblock Replicating Market Makers -Mathematical Finance (q-fin.MF); Optimization and Control; Trading and Market Microstructure (q-fin.TR) -\newblock {\em arXiv:2103.14769}, 26 Mar 2021. - -\hfill \break -\bibitem{Tarun2021} -Guillermo Angeris, Alex Evans, Tarun Chitra -\newblock Constant Function Market Makers: Multi-Asset Trades via Convex Optimization -Mathematical Finance (q-fin.MF); Optimization and Control; Trading and Market Microstructure (q-fin.TR) -\newblock {\em arXiv:2107.12484 }, 26 Jul 2021] -\url{https://doi.org/10.48550/arXiv.2107.12484} - -\hfill \break -\bibitem{Tarun2022} -Guillermo Angeris, Tarun Chitra, Alex Evans, Stephen Boyd -\newblock Optimal Routing for Constant Function Market Makers -Optimization and Control (math.OC); Trading and Market Microstructure (q-fin.TR) -\newblock {\em arXiv:2204.05238}, 11 Apr 2022] -\url{https://arxiv.org/abs/2204.05238v1} -\hfill \break - -\hfill \break -\bibitem{Suckut, 2022} -Suckut, Simon -\newblock Uint512 Solidity Library -\newblock {\em GitHub}, 11 Apr 2022] -\url{$https://github.com/SimonSuckut/Solidity_Uint512/blob/main/contracts/Uint512.sol$} + \newline + \bibitem{Angeris2020} + Guillermo Angeris, Tarun Chitra, Alex Evans, Stephen Boyd + \newblock Guillermo Angeris et al. Optimal Routing for Constant Function Market Makers. arXiv:2204.05238 + \newblock In {\em arXiv 1911.03380}, 26 Jul 2021 + Optimization and Control (math.OC); Trading and Market Microstructure (q-fin.TR) + + \hfill \break + \bibitem{Angeris2019} + Guillermo Angeris et al. An analysis of Uniswap markets. 2019. arXiv: 1911.03380 + \newblock An analysis of Uniswap markets. + Mathematical Finance (q-fin.MF); Optimization and Control; Trading and Market Microstructure (q-fin.TR) + \newblock {\em arXiv: 1911.03380}, + + \hfill \break + \bibitem{Angeris2019} + Guillermo Angeris, Alex Evans, Tarun Chitra + \newblock Replicating Market Makers + Mathematical Finance (q-fin.MF); Optimization and Control; Trading and Market Microstructure (q-fin.TR) + \newblock {\em arXiv:2103.14769}, 26 Mar 2021. + + \hfill \break + \bibitem{Tarun2021} + Guillermo Angeris, Alex Evans, Tarun Chitra + \newblock Constant Function Market Makers: Multi-Asset Trades via Convex Optimization + Mathematical Finance (q-fin.MF); Optimization and Control; Trading and Market Microstructure (q-fin.TR) + \newblock {\em arXiv:2107.12484 }, 26 Jul 2021] + \url{https://doi.org/10.48550/arXiv.2107.12484} + + \hfill \break + \bibitem{Tarun2022} + Guillermo Angeris, Tarun Chitra, Alex Evans, Stephen Boyd + \newblock Optimal Routing for Constant Function Market Makers + Optimization and Control (math.OC); Trading and Market Microstructure (q-fin.TR) + \newblock {\em arXiv:2204.05238}, 11 Apr 2022] + \url{https://arxiv.org/abs/2204.05238v1} + \hfill \break + + \hfill \break + \bibitem{Suckut, 2022} + Suckut, Simon + \newblock Uint512 Solidity Library + \newblock {\em GitHub}, 11 Apr 2022] + \url{$https://github.com/SimonSuckut/Solidity_Uint512/blob/main/contracts/Uint512.sol$}