<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">A Netting Protocol for Liquidity-saving Automated Market Makers</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>
							<persName><forename type="first">Margherita</forename><surname>Renieri</surname></persName>
							<email>margherita.renieri@imtlucca.it</email>
							<affiliation key="aff0">
								<orgName type="institution">IMT School for Advanced Studies Lucca</orgName>
								<address>
									<country key="IT">Italy</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Letterio</forename><surname>Galletta</surname></persName>
							<affiliation key="aff0">
								<orgName type="institution">IMT School for Advanced Studies Lucca</orgName>
								<address>
									<country key="IT">Italy</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Alberto</forename><forename type="middle">Lluch</forename><surname>Lafuente</surname></persName>
							<affiliation key="aff1">
								<orgName type="institution">Technical University of Denmark</orgName>
								<address>
									<country key="DK">Denmark</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">James Hsin-Yu</forename><surname>Chiang</surname></persName>
							<email>jachiang@cs.au.dk</email>
							<affiliation key="aff2">
								<orgName type="institution">Aarhus University</orgName>
								<address>
									<country key="DK">Denmark</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">A Netting Protocol for Liquidity-saving Automated Market Makers</title>
					</analytic>
					<monogr>
						<idno type="ISSN">1613-0073</idno>
					</monogr>
					<idno type="MD5">186F912C97626CF7AE2172F3F4733837</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2025-04-23T19:15+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<textClass>
				<keywords>
					<term>Formal methods</term>
					<term>Operational semantics</term>
					<term>Liquidity-Saving Mechanism</term>
					<term>Netting</term>
					<term>AMMs</term>
				</keywords>
			</textClass>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Automated Market Makers are one of the most used Decentralized Finance services. They allow users to exchange crypto-assets without a third party. Current protocols have strong constraints related to the liquidity level that users' balances must satisfy for each transaction. In this paper, we propose a liquidity-saving mechanism that aims at reducing the required amount of liquidity in an AMM service. We provide an operational semantics of such a mechanism that precisely characterizes the interactions between users and AMMs and the conditions when the liquidity-saving mechanism is triggered. Our mechanism collects the proposed transactions in a finite queue, providing a global perspective of all users' actions. Starting from the queue, it finds a feasible transaction sequence that satisfies the users' balances. Finally, it performs these transactions on the blockchain atomically, reaching a state where all liquidity constraints are met. By doing so, the mechanism allows for novel liquidity saving behavior for multi-party exchange and multi-AMM arbitrage with less upfront liquidity as usually required.</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.">Introduction</head><p>In Decentralized Finance (DeFi) systems, Automated Market Makers (AMMs) are decentralized exchanges (DEXs) that provide users with liquidity using different reserves, enabling them to trade different crypto-assets, i.e., tokens. Users participating in these token exchanges pay fixed trading and gas fees charged by the Ethereum network. Similarly to traditional financial systems, users need to provide an upfront amount of crypto-assets as collateral to operate with such decentralized financial services. Liquidity is essential for AMMs to work properly, otherwise, it is possible to incur scenarios that hinder their economic performance and limit user involvement.</p><p>AMMs rely on users who act as liquidity providers by depositing a certain amount of tokens into AMM smart contracts that can be used for trades. AMM protocols implement liquidity-saving mechanisms (LSM) that aim at reducing liquidity costs by minimizing the required liquidity for transaction settlement. DeFi protocols have introduced various approaches to achieve this goal, e.g., flash loans <ref type="bibr" target="#b0">[1,</ref><ref type="bibr" target="#b1">2]</ref> and flash swaps <ref type="bibr" target="#b2">[3]</ref>. These mechanisms allow users to temporarily loan tokens with no collateral but require them to pay back their debt within a single transaction. One of their limitations is that they do not easily permit scenarios with more users involved or trades requiring more than one transaction to be completed.</p><p>In this paper, we propose the design of an LSM for AMMs that offers the advantages of flash loans and flash swaps but overcomes their limitations. In particular, our mechanism permits users to operate on the AMM without upfront balance by aggregating multiple actions over a specific time frame. Our aggregation mechanism is inspired by netting <ref type="bibr" target="#b3">[4,</ref><ref type="bibr" target="#b4">5,</ref><ref type="bibr" target="#b5">6]</ref>, an LSM used in traditional finance: netting creates payment instruction queues among banks, offsets the value of multiple payments, and finds the most convenient payment combination to eliminate stunting periods. We provide here a formalization of our mechanism in terms of a labelled transition system (LTS) that precisely characterizes the interactions between users and AMMs and the conditions when the netting mechanism is triggered.</p><p>Intuitively, our mechanism works as follows. First, we equip AMMs with a finite queue to store trading transactions (swaps) proposed by users. When a user performs a transaction that would result in a balance overdraft, the transaction is stored in the queue. Otherwise, if the transaction has the effect of setting all balances of users having pending transactions in the queue to positive, the transaction queue is executed atomically, resulting in a liquidity-saving sequence of swaps. If the queue reaches its maximum capacity where some users' balances are still negative, a netting algorithm selects a subset of the stored transactions that meet the liquidity constraints for each user, if any, and atomically performs them. In such a way, users capitalize on market inefficiencies, facilitating the trading of assets more efficiently and cost-effectively. We discuss the scenarios where our proposed netting-based AMM and traditional AMM differ in the performed swap transactions. In particular, we show examples of multi-party trading operations that are not executed in standard AMMs due to lack of liquidity but are settled by ours.</p><p>In summary, our main contributions are:</p><p>• We provide an LSM that settles AMM trades through a netting algorithm and allows us to implement liquidity-optimized AMM. We illustrate examples that allow users to perform multiparty exchanges and multi-AMM arbitrage without the upfront liquidity that would be required in traditional AMMs. • We formalize our mechanism by adopting the operational semantics of the interactions between users and AMMs proposed by Bartoletti et al. <ref type="bibr" target="#b6">[7]</ref>. We adapt their semantics by removing the liquidity constraints on users' balances when performing swap actions and by appending swap transactions in a queue until a liquidity-balanced state is reached. • We provide a lightweight netting algorithm that can run on the blockchain as part of a smart contract to select a subset of swaps that can actually be performed without violating any liquidity constraints.</p><p>In the rest of the paper we proceed as follows. We provide a high-level overview of our approach in Section 2. Section 3 presents the operational semantics of our LSM mechanism, together with relevant scenarios comparing it with standard AMMs. Section 4 discusses related literature, and Section 5 concludes and discusses some future work.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.">Overview of the approach</head><p>In current DeFi protocols, such as Uniswap <ref type="bibr" target="#b2">[3]</ref>, a user interacts with the AMM reserve through single actions. She can deposit, redeem, or swap crypto-assets in change of others in the AMM. However, she can perform the transaction only if she has the needed capital upfront to cover it. For instance, consider the example of Figure <ref type="figure" target="#fig_0">1</ref> where there are two users A and B that interact with two AMMs performing a sequence of swap actions 𝑠 1 𝑠 2 𝑠 3 𝑠 4 . Initially, user A owns 4 tokens of type 𝜏 2 , no tokens of types 𝜏 0 and 𝜏 1 (denoted with the notation A[0 : 𝜏 0 , 0 : 𝜏 1 , 4 : 𝜏 2 ] in the figure); whereas user B has 4 tokens of type 𝜏 0 , no tokens of types 𝜏 1 and 𝜏 2 . The AMMs have 12 tokens type of 𝜏 0 , 𝜏 1 and 𝜏 1 , 𝜏 2 , respectively (denoted with {12 : 𝜏 0 , 12 : 𝜏 1 } and {12 : 𝜏 1 , 12 : 𝜏 2 } in the figure). The main idea is that the sequence of transactions would allow A and B to exchange their tokens at 1-to-1 rate, via the two AMMs. In standard protocols, some transactions are rejected because users' balances cannot cover their fulfillment: A cannot perform 𝑠 1 , namely swapping 6 tokens for at least 4 tokens of type 𝜏 0 , in symbols 𝑠 1 = A : swap(6 : 𝜏 1 , 4 : 𝜏 0 ), and B cannot perform 𝑠 2 , in symbols 𝑠 2 = B : swap(6 : 𝜏 1 , 4 : 𝜏 2 ). Our LSM overcomes the previous scenario. It allows users to instantaneously perform transactions whenever they lead to a state where the overall balance is positive. Otherwise, these transactions are delayed and stored in a queue. Once the queue is full, the protocol executes a netting procedure to discard the transactions that make balances negative. Thus, the protocol reaches a state where no liquidity constraints are violated, and transactions can be safely performed. The underlying idea of our mechanism is to accept a momentary deficit in users' balances as long as they may be covered by subsequent transactions, for instance, a swap in a different direction made by the same user or an update to the token reserve. Back to the example of Figure <ref type="figure" target="#fig_0">1</ref>, our approach allows the sequence of the actions 𝑠 1 𝑠 2 𝑠 3 𝑠 4 (for each action in the figure, we report how it affects the user balances and AMM reserves) to be executed since the 𝑠 4 yields a state where all balances are positive. It is not relevant if there are intermediate states where user balances are temporarily negative (colored in the figure). In this way, our LSM permits a multi-party trade between A and B, even when they do not have sufficient funds. In contrast, traditional AMMs reject all four swap actions due to lack of liquidity.</p><formula xml:id="formula_0">User A [0 : 𝜏 0 , 0 : 𝜏 1 , 4 : 𝜏 2 ] AMM 1 {12 : 𝜏 0 , 12 : 𝜏 1 } AMM 2 {12 : 𝜏 1 , 12 : 𝜏 2 } User B [4 : 𝜏 0 , 0 : 𝜏 1 , 0 : 𝜏 2 ] 𝑠 1 = A : swap(6 : 𝜏 1 , 4 : 𝜏 0 ) A[4 : 𝜏 0 , −6 : 𝜏 1 , 4 : 𝜏 2 ]|𝐴𝑀 𝑀 1 {8 : 𝜏 0 , 18 : 𝜏 1 } 𝑠 2 = B : swap(6 : 𝜏 1 , 4 : 𝜏 2 ) B[4 : 𝜏 0 , −6 : 𝜏 1 , 4 : 𝜏 2 ]|𝐴𝑀 𝑀 2 {18 : 𝜏 1 , 8 : 𝜏 2 } 𝑠 3 = A : swap(4 : 𝜏 2 , 6 : 𝜏 1 ) A[4 : 𝜏 0 , 0 : 𝜏 1 , 0 : 𝜏 2 ]|𝐴𝑀 𝑀 2 {12 : 𝜏 1 , 12 : 𝜏 2 } 𝑠 4 = B : swap(4 : 𝜏 0 , 6 : 𝜏 1 ) B[0 : 𝜏 0 , 0 : 𝜏 1 , 4 : 𝜏 2 ]|𝐴𝑀 𝑀 1 {12 : 𝜏 0 , 12 : 𝜏 1 }</formula></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">Liquidity-saving mechanism</head><p>This section formalizes our LSM, illustrates our netting algorithm, and shows how our approach differs from the standard one through some examples.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1.">Formal model of Automated Market Makers</head><p>We formalize the interaction between users and AMMs as a labelled transition system (LTS). Our semantics is based on those of Bartoletti et al. <ref type="bibr" target="#b6">[7]</ref>. Intuitively, LTS states represent the system configurations that store each user's token supplies and the AMMs. Transitions represent transactions performed by users, which may result in an update of token supplies. For the time being, we focus only on swap actions and neglect redeem and deposit. We also assume that swap actions require no fees and that there are no transaction fees.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1.1.">AMM basic definitions</head><p>We assume a set T of atomic token types (ranged over by 𝜏, 𝜏 ′ ) representing native cryptocurrencies and application-specific tokens. In general, we denote with 𝑟, 𝑟 ′ real numbers (R), and we write 𝑟 : 𝜏 to denote 𝑟 atomic tokens of type 𝜏 (𝜏 ∈ T).</p><p>We also assume a set of users A (ranged over by A, A ′ ). The wallet of a user A is denoted by A[𝜎 A ], where the partial map 𝜎 A ∈ T ⇀ R represents A token balances, i.e., 𝜎 A (𝜏 ) denotes the amount of 𝜏 owned by A.</p><p>We model the AMM as a reserve of 𝑟 0 : 𝜏 0 and 𝑟 1 : 𝜏 1 where 𝜏 0 ̸ = 𝜏 1 , written as an unordered pair {𝑟 0 : 𝜏 0 , 𝑟 1 : 𝜏 1 }.</p><p>The states Γ, Γ ′ of the protocol are finite non-empty compositions of wallets and AMM. Formally, they are defined as follows:</p><formula xml:id="formula_1">Γ = [A 1 [𝜎 A 1 ]| • • • | A 𝑛 [𝜎 A𝑛 ] | {𝑟 0 : 𝜏 0 , 𝑟 1 : 𝜏 1 } | • • • | {𝑟 𝑤 : 𝜏 𝑤 , 𝑟 𝑘 : 𝜏 𝑘 }]<label>(1)</label></formula><p>and for the sake of simplicity of our formalization, we assume the following conditions: for all 𝑖 ̸ = 𝑗 (𝑖) each user has a single wallet (A 𝑖 ̸ = A 𝑗 ); (𝑖𝑖) distinct AMMs cannot hold exactly the same token types ({𝜏 𝑖 , 𝜏 ′ 𝑖 } ̸ = {𝜏 𝑗 , 𝜏 ′ 𝑗 }). The labels of LTS are swap transactions that are terms of the form</p><formula xml:id="formula_2">A : swap(𝑥 : 𝜏 0 , 𝑦 * : 𝜏 1 )<label>(2)</label></formula><p>meaning that user A transfers 𝑥 : 𝜏 0 to the AMM {𝑟 0 : 𝜏 0 , 𝑟 1 : 𝜏 1 } specifying that she wants to receive back at least 𝑦 * units of token 𝜏 1 in return. The amount of token 𝑦 * must meet the constraint 0 &lt; 𝑦 * ≤ 𝑦 where 𝑦 = 𝑥 • 𝑆𝑋(𝑥, 𝑟 0 , 𝑟 1 ) (see below for 𝑆𝑋) to preserve the constant-product swap rate of the reserve. In our mechanism, 𝑦 * represents a minimum acceptable threshold for the amount of token a user expects to receive from an exchange with an AMM reserve. A transaction will be rejected if the swap rate does not ensure the user receives at least this amount. Users submit their actions without knowing whether they will be executed at the resulting swap rate. In our formalization, we adopt the Constant Product Market Maker (CPMM) which is one of the most popular forms of DEX that considers a trade valid if the value of the reserve before and after (with an additional amount for fees) is constant or simply the same. More precisely, we consider the constant product swap rate that is the most commonly implemented in Uniswap <ref type="bibr" target="#b7">[8]</ref>, SushiSwap <ref type="bibr" target="#b8">[9]</ref>, and Curve <ref type="bibr" target="#b9">[10]</ref> protocols. We use the swap rate function in all instances throughout this paper. In particular, when a user swaps a token 𝜏 0 with an AMM {𝑟 0 : 𝜏 0 , 𝑟 1 : 𝜏 1 }, the actual amount 𝑦 of 𝜏 1 is calculated using the following formula:</p><formula xml:id="formula_3">𝑆𝑋(𝑥, 𝑟 0 , 𝑟 1 ) = 𝑟 1 (𝑟 0 + 𝑥)<label>(3)</label></formula><p>This rate ensures that the evolution and the update of an AMM from {𝑟 0 : 𝜏 0 , 𝑟 1 : 𝜏 1 } to {𝑟 0 + 𝑥 : 𝜏 0 , 𝑟 1 − 𝑦 : 𝜏 1 } preserve the ratio between the reserve maintaining a constant level of tokens:</p><formula xml:id="formula_4">𝑟 0 • 𝑟 1 = (𝑟 0 + 𝑥) • (𝑟 1 − 𝑥 • 𝑟 1 𝑟 0 + 𝑥 ) = 𝑟 0 • 𝑟 1<label>(4)</label></formula><p>The formula above is derived by substituting the definition of 𝑆𝑋(𝑥, 𝑟 0 , 𝑟 1 ) from the equation (3) in place of 𝑦, then, by performing some algebraic simplification to obtain again 𝑟 0 • 𝑟 1 . The actions that result in overdrafts on users' balances are not immediately executed but are stored in a queue Λ.</p><p>Formally, a queue is a term obtained by the following grammar:</p><formula xml:id="formula_5">Λ := ∅ | Λ ∘ 𝑠<label>(5)</label></formula><p>where ∅ denotes an empty queue with no pending actions, and Λ ∘ 𝑠 a queue Λ where its head is the action 𝑠. In the semantic rules below, we use Λ ∘ 𝑠 to represent when an action 𝑠 is added to the queue Λ. Moreover, we write |Λ| to indicate the size of the queue Λ. For instance, ∅ is an empty queue with no pending action; while the term ∅ ∘ 𝑠1 denotes a queue with a single action 𝑠 1 that is equal to A : swap(6 : 𝜏 1 , 4 : 𝜏 0 ); and the term ∅ ∘ 𝑠1 ∘ 𝑠2 denotes a queue with two actions: the tail is 𝑠 1 = A : swap(6 : 𝜏 1 , 4 : 𝜏 0 ) and the head is 𝑠 2 that corresponds to B : swap(4 : 𝜏 2 , 6 : 𝜏 1 ). The LTS states are configurations defined as a 3-tuple ⟨Γ, Γ ′ , Λ⟩ where the first component is a state Γ of the form (1), the second one Γ ′ is the last simulated state (see the next subsection), and the third one is a swap action queue Λ of the form (5) of size ℓ. Given a state Γ we define ⟨Γ, Γ, ∅⟩ as an initial configuration.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1.2.">AMM semantics</head><p>Transitions ⟨Γ, Γ ′ , Λ⟩ 𝑠 − → ⟨Γ ′′ , Γ ′′′ , Λ ′ ⟩ from a configuration to another one are triggered when a user submits a transaction 𝑠, and are defined by the inference rules below.</p><p>It is convenient to introduce some notation for the semantics. We say that a state Γ is green when the token supply of each user is non-negative, formally:</p><formula xml:id="formula_6">∀ A ∈ A ∩ Γ, 𝜏 ∈ T, s.t. 𝜎 A (𝜏 ) ≥ 0</formula><p>where we denote with A ∩ Γ the set of users occurring in the configuration Γ. While we say it is red otherwise, namely if</p><formula xml:id="formula_7">∃ A ∈ A ∩ Γ, 𝜏 ∈ T, s.t. 𝜎 A (𝜏 ) &lt; 0</formula><p>Moreover, we denote with Γ 𝑠 = ⇒ Γ ′ a simulation of the transaction 𝑠 in the state Γ using the semantic rules of <ref type="bibr" target="#b6">[7]</ref> without constraints on users' balances. This is why we want to maximize the number of settled actions performed by users. Differently, we maintain checks to impose non-negativity constraints on the AMM reserve. This means that some user balances could be negative in the resulting state Γ ′ but not AMM reserves. Given a sequence of transactions Λ, we denote with Γ Λ = ⇒ Γ ′ the simulation of the actions in Λ. Also, we assume that when Λ is the empty sequence 𝜖, the simulation results in an unchanged state, i.e., Γ 𝜖 = ⇒ Γ. When a transition is triggered by an action 𝑠 in a configuration ⟨Γ, Γ ′ , Λ⟩,</p><p>we have three possible scenarios.</p><p>The first scenario arises when the simulation of 𝑠 in Γ ′ reaches a green state Γ ′′ . In this case, we apply the following rule:</p><formula xml:id="formula_8">Γ ′ 𝑠 = ⇒ Γ ′′ Γ ′′ green ⟨Γ, Γ ′ , Λ⟩ 𝑠 − → ⟨Γ ′′ , Γ ′′ , ∅⟩</formula></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Cover</head><p>The rule Cover performs all the pending actions in Λ (if any), and the resulting configuration consists of the green state, Γ ′′ (in the first two components), and the emptied queue.</p><p>The second scenario happens when the simulation of 𝑠 in Γ ′ reaches a red state Γ ′′ , and the length of Λ is less than ℓ (max queue size, a parameter of our mechanism). In this case, we apply the following rule:</p><formula xml:id="formula_9">Γ ′ 𝑠 = ⇒ Γ ′′ Γ ′′ red |Λ| &lt; ℓ Λ ′ = Λ ∘ 𝑠 ⟨Γ, Γ ′ , Λ⟩ 𝑠 − → ⟨Γ, Γ ′′ , Λ ′ ⟩ Overdraft</formula><p>The rule Overdraft enqueues 𝑠 in Λ, thus, the resulting configuration consists of the current state Γ, the red state Γ ′ , and Λ ′ that is Λ extended with the incoming action 𝑠.</p><p>The last scenario occurs when the simulation of 𝑠 leads to a red state Γ ′′ , and the length of Λ equals ℓ. In this case, we use the netting procedure (denoted by the function 𝑛𝑒𝑡 in the following rule) to perform the settlement from the state Γ and the actions of Λ plus 𝑠.</p><p>The netting procedure identifies and returns a (possibly empty) sequence of feasible actions Λ ′ . Such sequence is a subset of the input sequence Λ. The obtained subsequence Λ ′ is executed to obtain the resulting state Γ * . All the other actions of Λ that are not selected by the procedure are discarded.</p><p>The resulting configuration is a 3-tuple with the state Γ * (for the first two components) and the empty queue for the last one (the queued actions were carried out or discarded). Formally, we apply the following rule:</p><formula xml:id="formula_10">Γ ′ 𝑠 = ⇒ Γ ′′ Γ ′′ red |Λ| = ℓ Λ ′ = net(Γ, Λ ∘ 𝑠) Γ Λ ′ = ⇒ Γ * ⟨Γ, Γ ′ , Λ⟩ 𝑠 − → ⟨Γ * , Γ * , ∅⟩</formula></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Netting</head><p>It is worth remarking that the mechanism provided in this section is agnostic with respect to the netting procedure that we invoke in a black-box manner. For example, a simple procedure could be to discard all enqueued transactions. The next section introduces a more meaningful procedure. Also, we remark that when we apply the above rule, the queue Λ contains a prefix of actions leading to a red state that is not balanced by other actions in the queue. Otherwise, the rule Cover would be applicable. The rule invokes the netting procedure to execute a subset of actions that allows the AMM to progress. Finally, note that our configurations and semantic rules could be written without Γ ′ (the 2nd component of the configuration recording the simulated/speculative final state) and replacing the premise</p><formula xml:id="formula_11">Γ ′ 𝑠 = ⇒ Γ ′′ with Γ Λ∘𝑠 ==⇒ Γ ′′ .</formula><p>This approach requires re-computing the final state every time a new action is performed. These re-computations are not efficient in an implementation where it is more convenient to store the intermediate state. We decided to follow this approach to make our formalization coherent with the implementation.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2.">Netting problem</head><p>Here, we provide an algorithm for the netting procedure 𝑛𝑒𝑡 invoked in Netting rule above. The netting problem is defined as follows: Given as inputs a state Γ, a queue Λ, find a subset Λ ′ of Λ, whose actions lead to a green state Γ * from Γ. Recall that the liquidity constraints required to each user are satisfied in a green state. Ideally, netting aims at finding an optimal solution, maximizing a specific parameter. For example, one may want to maximize the size of Λ ′ , the number of users affected, or the amount of tokens involved. We formalize the netting as an optimization problem that, given as inputs a state Γ of the LTS and a queue Λ, maximizes the size of Λ ′ , a queue, whose actions bring to a valid state Γ * that meet the liquidity constraints:</p><formula xml:id="formula_12">max |Λ ′ |<label>(6)</label></formula><p>subject to</p><formula xml:id="formula_13">Γ Λ ′ − → Γ * (7) Γ * green<label>(8)</label></formula><p>Note that the liquidity constraints (8) are satisfied if the final state Γ * is a green (there is no overdraft in users' wallets). The problem in financial literature is known as bank payment clearance, which is NP-hard <ref type="bibr" target="#b3">[4,</ref><ref type="bibr" target="#b10">11]</ref>, so we adopt a heuristic algorithm to implement the netting procedure that avoids enumerations and tries to maximize the number of transactions performed. Since we need an algorithm that can run on a smart contract (thus incurring affordable gas expenses), we adopt a heuristic approach that sacrifices optimality for efficiency, and we propose Algorithm 1 that runs in polynomial time (quadratic in the size of the queue, at worst). </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Algorithm 1 Heuristic netting procedure implementation</head><formula xml:id="formula_14">Input: Λ = [𝑠 1 , 𝑠 2 , . . . , 𝑠 𝑙 ], Γ Output: Λ 𝑟 Initialization: Λ 𝑟 ← Λ, Γ 0 ← Γ 1: Γ 0 Λ𝑟 = = ⇒ Γ 𝑙 ◁ Starting simulation 2: while Γ 𝑙 red ∧ Λ 𝑟 ̸ = ∅ do ◁ Final</formula><formula xml:id="formula_15">Γ 𝑖 𝑠 𝑖+1 = == ⇒ Γ 𝑖+1 𝑠 𝑖+2 = == ⇒ Γ 𝑖+2 • • • 𝑠 𝑓 = ⇒ Γ 𝑓 7:</formula><p>Γ 𝑙 ← Γ 𝑓 ◁ Update the variable Γ 𝑙 8: end while 9: return Λ 𝑟 Intuitively, Algorithm 1 simulates the swap actions ignoring the liquidity constraints. It starts by initializing Λ 𝑟 with Λ, the initial queue of pending actions, and Γ 0 with Γ, the initial state.</p><p>It then starts a loop (line 2), where it simulates action execution until either the final state Γ 𝑙 is not red or the queue Λ 𝑟 becomes empty, namely, until there are still actions to be processed and overdrafts in the system. During each iteration, we select from Λ 𝑟 the first action 𝑠 𝑖 that makes the balance of some account A become negative, i.e., the execution of 𝑠 𝑖 leads Γ 𝑙 to red state (line 3). Then, the algorithm removes 𝑠 𝑖 from Λ 𝑟 (line 4) and updates the simulation state Γ 𝑖 (line 5) by reverting 𝑠 𝑖 . We achieve that by simply considering the previous state Γ 𝑖−1 that is the last green state. After we recover to the last green state, the simulation is run again but from Γ 𝑖 using the actions following 𝑠 𝑖 until all balances are non-negative. As a result of this last simulation, we obtain the green state Γ 𝑓 (line 6). Finally, Γ 𝑙 is updated with the final state Γ 𝑓 (line 7) and the loop starts again.</p><p>These steps are iterated until we obtain a green state or empty Λ 𝑟 . When this happens, the algorithm returns Λ 𝑟 . In the following section, we provide an example of execution of Algorithm 1.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3.">Liquidity-saving behavior</head><p>Our mechanism enables liquidity-saving behavior that is not possible in ordinary AMMs. An example is the simultaneous change of tokens through AMMs that we presented in Section 2. Another interesting behavior enabled by our mechanism is the ability to perform arbitrage on multiple AMMs simultaneously and with no liquidity.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3.1.">Liquidity-saving arbitrage Example</head><p>Assume to have three AMMs with the following token reserves {8 : 𝜏 0 , 18 : 𝜏 1 }, {8 : 𝜏 1 , 18 : 𝜏 2 }, {8 : 𝜏 2 , 18 : 𝜏 0 } If we assume, a 1-to-1 exchange rate, we could see three arbitrage opportunities, only available to users with sufficient funds. Now suppose that a user A has no tokens but wants to perform the following actions 𝑠 1 𝑠 2 𝑠 3 :</p><p>A : swap(4 : 𝜏 0 , 6 : 𝜏 1 ), A : swap(4 : 𝜏 1 , 6 : 𝜏 2 ), A : swap(4 : 𝜏 2 , 6 : 𝜏 0 ) When considering AMMs without our mechanism, all the actions are discarded because A does not have an upfront balance. Figure <ref type="figure" target="#fig_1">2</ref> shows a flow diagram of the actions performed adopting our mechanism. Now 𝑠 1 𝑠 2 are enqueued because they cause an overdraft that is then covered by 𝑠 3 . The execution of 𝑠 3 results in the following green state:</p><formula xml:id="formula_16">[A[2 : 𝜏 0 , 2 : 𝜏 1 , 2 : 𝜏 2 ]|{12 : 𝜏 0 , 12 : 𝜏 1 }|{12 : 𝜏 1 , 12 : 𝜏 2 }|{12 : 𝜏 2 , 12 : 𝜏 0 }]</formula><p>The above scenario has similarities with the traditional finance scenario known as gridlock <ref type="bibr" target="#b5">[6]</ref> where banks cannot settle their payments individually due to their insufficient liquidity. Through netting, each bank submits its payment instructions to designated queues, performing multilateral settlement exclusively for the net obligations. Back to our example, user A overcomes the stuck state with possible no evolution of the system of traditional AMMs protocol where individual swap incurs in an overdraft, enqueuing her actions and atomically perform them when reaching a positive balance.</p><p>The approach we developed may settle transactions on the blockchain differently than the ones used by standard AMM protocols: netting can select transactions that the standard approach discards and vice versa. This difference may affect users' rewards and lead them to apply new/different market strategies. The following scenario exemplifies a case in which the netting of transactions could prevent swaps that would otherwise be executed.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3.2.">Two Users scenario Example</head><p>Consider a scenario where there are two users A and B and two AMMs with the following wallets and reserves: Assume that user A wants to perform two actions. The first one, 𝑠 1 = A : swap(6 : 𝜏 1 , 4 : 𝜏 0 ), on the first AMM, {12 : 𝜏 0 , 12 : 𝜏 1 }, and the second one, 𝑠 2 = A : swap(4 : 𝜏 2 , 6 : 𝜏 1 ) on the second AMM, {18 : 𝜏 1 , 8 : 𝜏 2 }. User B wants to perform an action 𝑠 3 = B : swap(6 : 𝜏 1 , 4 : 𝜏 0 ) on the first AMM.</p><formula xml:id="formula_17">[A[0 : 𝜏 0 , 0 : 𝜏 1 , 4 : 𝜏 2 ]|B[4 : 𝜏 0 , 6 : 𝜏 1 , 0 : 𝜏 2 ]|{12 : 𝜏 0 , 12 : 𝜏 1 }|{18 : 𝜏 1 , 8 : 𝜏 2 }] User A [0 : 𝜏 0 , 0 : 𝜏 1 , 0 : 𝜏 2 ] AMM 1 {8 : 𝜏 0 , 18 : 𝜏 1 } AMM 2 {8 : 𝜏 1 , 18 : 𝜏 2 } AMM 3 {8 : 𝜏 2 , 18 : 𝜏 0 } 𝑠 1 = A : swap(4 : 𝜏 0 , 6 : 𝜏 1 ) A[−4 : 𝜏 0 , 6 : 𝜏 1 , 0 : 𝜏 2 ]|𝐴𝑀 𝑀 1 {8 : 𝜏 0 , 18 : 𝜏 1 } 𝑠 2 = A : swap(4 : 𝜏 1 , 6 : 𝜏 2 ) A[−4 : 𝜏 0 , 2 : 𝜏 1 , 6 : 𝜏 2 ]|𝐴𝑀 𝑀 2 {12 : 𝜏 1 , 12 : 𝜏 2 } 𝑠 3 = A : swap(4 : 𝜏 2 , 6 : 𝜏 0 ) A[2 : 𝜏 0 , 2 : 𝜏 1 , 2 : 𝜏 2 ]|𝐴𝑀 𝑀 3 {12 : 𝜏 2 , 12 : 𝜏 0 }</formula><p>User A When considering an AMM without our mechanism, 𝑠 1 and 𝑠 2 are discarded because A does not have enough balance, whereas 𝑠 3 is performed reaching the configuration:</p><formula xml:id="formula_18">[0 : 𝜏 0 , 0 : 𝜏 1 , 4 : 𝜏 2 ] AMM 1 {12 : 𝜏 0 , 12 : 𝜏 1 } AMM 2 {18 : 𝜏 1 , 8 : 𝜏 2 } User B [4 : 𝜏 0 , 6 : 𝜏 1 , 0 : 𝜏 2 ] 𝑠 1 = A : swap(6 : 𝜏 1 , 4 : 𝜏 0 ) A[4 : 𝜏 0 , −6 : 𝜏 1 , 4 : 𝜏 2 ]|𝐴𝑀 𝑀 1 {8 : 𝜏 0 , 18 : 𝜏 1 } 𝑠 2 = A : swap(4 : 𝜏 2 , 6 : 𝜏 1 ) A[4 : 𝜏 0 , 0 : 𝜏 1 , 0 : 𝜏 2 ]|𝐴𝑀 𝑀 2 {12 : 𝜏 1 , 12 : 𝜏 2 } 𝑠 3 = B : swap(6 : 𝜏 1 , 4 : 𝜏 0 ) B[8 : 𝜏 0 , 0 : 𝜏 1 , 0 : 𝜏 2 ]|𝐴𝑀 𝑀 1 {8 : 𝜏 0 , 18 : 𝜏 1 }</formula><formula xml:id="formula_19">[A[0 : 𝜏 0 , 0 : 𝜏 1 , 4 : 𝜏 2 ]|B[8 : 𝜏 0 , 0 : 𝜏 1 , 0 : 𝜏 2 ]|{8 : 𝜏 0 , 18 : 𝜏 1 }|{18 : 𝜏 1 , 8 : 𝜏 2 }]</formula><p>Differently with our mechanism 𝑠 1 is enqueued, and when A performs 𝑠 2 on the second AMM, both actions are settled because 𝑠 2 covers the overdraft on A's wallet (see Figure <ref type="figure" target="#fig_2">3</ref>). While 𝑠 3 is not executed on the first AMM because the execution of the previous actions changes the ratio in the reserve, and hence the swap rate. Once 𝑠 1 𝑠 2 are performed, the ratio of the first AMM is updated and 𝑠 3 is discarded (as the red and crossed box denotes in Figure <ref type="figure" target="#fig_2">3</ref>) because user B can swap 6 tokens of 𝜏 1 with 2 tokens of 𝜏 0 that is a different swap amount compared to what she wants to perform (6 tokens of 𝜏 1 with 4 tokens of 𝜏 0 ). This example highlights that the standard mechanism and ours generally settle different transactions, so they are incomparable. However, the behavior is not uncommon from what happens in ordinary AMMs where a user (in this case B) would typically decide to trade at a swap rate based on his local view or speculation on the state of AMMs, which can of course change if transactions of other users (in this case A) are executed.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3.3.">Netting scenario Example</head><p>Consider a scenario where there is user A and three AMMs with the following wallet and reserves:</p><formula xml:id="formula_20">[A[0 : 𝜏 0 , 0 : 𝜏 1 , 4 : 𝜏 2 ]|{12 : 𝜏 0 , 12 : 𝜏 1 }|{18 : 𝜏 1 , 8 : 𝜏 2 }|{12 : 𝜏 2 , 12 : 𝜏 0 }]</formula><p>Assume user A wants to execute three actions sequentially: 𝑠 1 , 𝑠 2 , and 𝑠 3 . With 𝑠 1 user A swaps 6 tokens of type 𝜏 2 for 4 tokens of type 𝜏 0 on the third AMM, in symbols 𝑠 1 = A : swap(6 : 𝜏 2 , 4 : 𝜏 0 ). With 𝑠 2 user A swaps 6 tokens of type 𝜏 1 for 4 tokens of type 𝜏 0 on the first AMM, namely 𝑠 2 = A : swap(6 : 𝜏 1 , 4 : 𝜏 0 ). Finally, with 𝑠 3 user A exchanges 4 tokens of type 𝜏 2 for 6 tokens of type 𝜏 1 on the second AMM: Upon executing the three actions illustrated in Figure <ref type="figure" target="#fig_3">4</ref>, the system achieves a red state where the user's wallet fails to meet liquidity constraints. Consequently, our mechanism triggers the Netting rule and runs the Algorithm 1. During this process, 𝑠 1 is identified as the first action leading to an overdraft in A's wallet (see line 3 of Algorithm 1), and is thus removed from the queue. After this adjustment, the simulation is run again, resulting in a green state, achieved through the execution of 𝑠 2 followed by 𝑠 3 . It is worth noting that without 𝑠 1 , 𝑠 3 covers the overdraft caused by 𝑠 2 , thus, the reached state is green. This example illustrates how our netting mechanism manages transactions while considering liquidity constraints: our mechanism enables the execution of two actions that subsequently cover the balance overdraft, which would typically not be feasible using a standard semantics to execute the transactions.</p><formula xml:id="formula_21">𝑠 3 = A : swap(4 : 𝜏 2 , 6 : 𝜏 1 ). User A [0 : 𝜏 0 , 0 : 𝜏 1 , 4 : 𝜏 2 ] AMM 1 {12 : 𝜏 0 , 12 : 𝜏 1 } AMM 2 {18 : 𝜏 1 , 8 : 𝜏 2 } AMM 3 {12 : 𝜏 2 , 12 : 𝜏 0 } 𝑠 1 = A : swap(6 : 𝜏 2 , 4 : 𝜏 0 ) A[4 : 𝜏 0 , 0 : 𝜏 1 , −2 : 𝜏 2 ]|𝐴𝑀 𝑀 3 {18 : 𝜏 2 , 8 : 𝜏 0 } 𝑠 2 = A : swap(6 : 𝜏 1 , 4 : 𝜏 0 ) A[8 : 𝜏 0 , −6 : 𝜏 1 , −2 : 𝜏 2 ]|𝐴𝑀 𝑀 1 {8 : 𝜏 0 , 18 : 𝜏 1 } 𝑠 3 = A : swap(4 : 𝜏 2 , 6 : 𝜏 1 ) A[8 : 𝜏 0 , 0 : 𝜏 1 , −2 : 𝜏 2 ]|𝐴𝑀 𝑀 2 {12 : 𝜏 1 , 12 : 𝜏 2 }</formula></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">Related work</head><p>The widely spread interest in distributed ledger technology has fostered the development of optimized trading protocols. This section illustrates the most relevant proposals concerning netting mechanism, optimal routing problems, and intent-centric protocols, and compares them with our work.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1.">Netting mechanism</head><p>Several papers have developed decentralized inter-bank payment systems where the role of the payment instructions operator is implemented through a public ledger-based protocol, and the netting mechanism through smart contracts. As a first example of this line of work, Jasper-Ubin Project <ref type="bibr" target="#b11">[12]</ref> investigates the possibility of achieving near-instant cross-border payments using blockchain. The project removes the single point of failure and obtains an immediate settlement without transaction reconciliation but does not give a decentralized multilateral netting. Naganuma et al. <ref type="bibr" target="#b12">[13]</ref> provide a secure netting protocol using the Hyperledger Fabric channel and its access control mechanism. Their secure settlement protocol does not require a specific central server and keeps part of the payment transaction information secret. Similarly, Wang et al. <ref type="bibr" target="#b13">[14]</ref> introduce a blockchain-based netting solution that relies on a central party and preserves the total amount of liquidity, revealing only the net amount of each bank. Cao et al. <ref type="bibr" target="#b5">[6]</ref> propose a non-interactive zero-knowledge proof mechanism to post payment instructions on a public ledger. More precisely, each bank locally computes the netting results and submits its proposal to a coordinating smart contract. However, this approach is not robust against cheating users, who can post-invalid partial netting proposals. The proposals above consider blockchain-related technologies to develop standard financial services, whereas our work introduces a standard financial mechanism into DeFi protocols. To the best of our knowledge, ours is the first attempt to apply LSM used by the works above <ref type="bibr" target="#b12">[13,</ref><ref type="bibr" target="#b13">14,</ref><ref type="bibr" target="#b5">6]</ref> to DeFi services.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2.">Optimal routing problems</head><p>Another relevant research field investigates how to execute several trades of different crypto-assets on networks of multiple CFMMs. These approaches are known as routing problems on Decentralized Exchanges. Angeris et al. <ref type="bibr" target="#b14">[15]</ref> and Diamandis et al. <ref type="bibr" target="#b15">[16]</ref> pointed out that the optimal routing problem can be formulated as an efficiently solvable optimization problem. Solving such a problem means determining the most efficient path for a trade, i.e., a sequence of crypto-assets exchanges in a network of CFMMs that realizes a given trade, to maximize the user's utility and minimize its costs.</p><p>Danos et al. <ref type="bibr" target="#b16">[17]</ref> introduce arbitrage scenarios within exchange networks and develop an effective global routing system. In detail, they explore how optimal routing strategies are employed to capitalize on price differentials across multiple exchanges, enhancing opportunities for profitable arbitrage. Similar to those approaches, our mechanism aims at finding a solution to maximizing a specific parameter. However, the main difference between ours and the above-mentioned papers <ref type="bibr" target="#b14">[15,</ref><ref type="bibr" target="#b15">16,</ref><ref type="bibr" target="#b16">17]</ref> is the objective function to maximize. As illustrated in Section 3, our objective function consists of maximizing the number of actions in the queue, i.e., the number of transactions to settle. On the other hand, those proposals formulate the optimization problem in terms of the largest possible user's utility, and their routing problem tries to detect the most convenient and profitable route for executing trades across AMMs of the same and different token types belonging to the network.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3.">Intent-centric protocols</head><p>A significant area of research in Ethereum ecosystem focuses on addressing the aggregated token swap problem, i.e., determining a sequence of swaps on AMMs that realizes a given trade by improving the liquidity of users. Various DeFi applications, such as UniswapX <ref type="bibr" target="#b17">[18]</ref>, Uniswap V4 <ref type="bibr" target="#b18">[19]</ref>, and CoW Protocol <ref type="bibr" target="#b19">[20]</ref>, tackle this challenge by adopting intent-centric protocols. These protocols shift the focus from transaction execution to defining users' desired outcomes, creating competitive routing marketplaces, introducing gas-free cross-chain swaps, and incorporating batch auctions to discover profitable prices.</p><p>UniswapX <ref type="bibr" target="#b17">[18]</ref> implements intent-centric swaps, combining on-chain and off-chain liquidity for a competitive trading marketplace. Uniswap V4 <ref type="bibr" target="#b18">[19]</ref> enhances liquidity with hooks, enabling gas-free cross-chain swaps and offering flexibility through customizable features. CoW Protocol <ref type="bibr" target="#b19">[20]</ref> utilizes batch auctions for efficient price discovery, and CoW Swap, its decentralized exchange interface, introduces CoW Hooks, allowing custom actions before and after trades.</p><p>While these protocols aim to optimize trading across multiple AMMs, our approach stands out by introducing a Liquidity-Saving Mechanism designed to maximize users' swap actions without a formalized analysis of users' intent.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.">Conclusion</head><p>We have proposed liquidity-optimized AMMs, providing an LSM that settles AMM swap actions through a netting algorithm at the application level. We precisely characterized our mechanism by extending the operational semantics proposed by Bartoletti et al. <ref type="bibr" target="#b6">[7]</ref>. We removed the liquidity constraints on participants' balances when performing swap actions and introduced a queue of actions. When the queue size reaches a fixed bound, and the liquidity constraints are unsatisfied, a greedy algorithm is triggered to compute a sequence of actions with no liquidity violation. Our mechanism enables novel scenarios, allowing users to perform exchanges and arbitrages without the required upfront funds.</p><p>In future work, we plan to extend our mechanism to deal with the deposit and redeem actions and take into account price trends, enabling us to consider realistic DeFi protocols. Moreover, we want to introduce the formalization of fixed transaction costs (such as gas costs) in the LTS. Another line of investigation is to understand if knowing the internals of the netting mechanism encourages users to misbehave and take advantage of it. Additionally, we want to extend our mechanism to take into account also other properties, such as, for example, fairness when selecting the actions to remove. Furthermore, we would like to study the impact of the queue length (a key parameter in our mechanism) on the efficiency of our LSM. We also plan to investigate the impact of validators at the consensus layer on our approach and whether they could be the ones promoting transaction orders that result in near-to-optimal queue orderings, hence taking care of the optimal netting problem.</p><p>Another line of research involves considering our mechanism work in different AMM models, such as Concentrated Liquidity which has been recently added to Uniswap v3 <ref type="bibr" target="#b20">[21]</ref>. Furthermore, our formalization is designed to be implemented as a smart contract on the blockchain. It encompasses the management of various aspects such as user subscriptions, netting procedures with corresponding incentive mechanisms, queue management, and striking a balance between the mechanism's cost and the incentives it offers. An additional research direction involves exploring off-chain management of the actions, either through a trusted third party or in a decentralized manner. This approach aims to ensure the proper behavior of the queue, mitigating potential control issues by validators and simplifying the analysis of incentivized actions for each validator. Finally, we plan to re-model our mechanism, considering users' intents and trying to maximize their utility related to their desired outcome. In this way, we could better analyze user objectives and strategies.</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head>Figure 1 :</head><label>1</label><figDesc>Figure 1: Interaction between two Users and two AMMs.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_1"><head>Figure 2 :</head><label>2</label><figDesc>Figure 2: Flow diagram of the Example 3.3.1 among User A and three AMMs.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_2"><head>Figure 3 :</head><label>3</label><figDesc>Figure 3: Flow diagram of the Example 3.3.2 among two Users and two AMMs.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_3"><head>Figure 4 :</head><label>4</label><figDesc>Figure 4: Flow diagram of the Example 3.3.3 among User A and three AMMs.</figDesc></figure>
		</body>
		<back>

			<div type="acknowledgement">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Acknowledgments</head><p>This work was partially supported by project SERICS (PE00000014) under the MUR National Recovery and Resilience Plan funded by the European Union -NextGenerationEU.</p></div>
			</div>

			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<monogr>
		<ptr target="https://docs.aave.com/faq/flash-loans" />
		<title level="m">Aave Documentation</title>
				<imprint>
			<date type="published" when="2021">2021. 2023-11-23</date>
		</imprint>
	</monogr>
	<note>Flash loans</note>
</biblStruct>

<biblStruct xml:id="b1">
	<analytic>
		<title level="a" type="main">Attacking the defi ecosystem with flash loans for fun and profit</title>
		<author>
			<persName><forename type="first">K</forename><surname>Qin</surname></persName>
		</author>
		<author>
			<persName><forename type="first">L</forename><surname>Zhou</surname></persName>
		</author>
		<author>
			<persName><forename type="first">B</forename><surname>Livshits</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Gervais</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">International conference on financial cryptography and data security</title>
				<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2021">2021</date>
			<biblScope unit="page" from="3" to="32" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<monogr>
		<ptr target="https://docs.uniswap.org/contracts/v2/guides/smart-contract-integration/using-flash-swaps" />
		<title level="m">Uniswap V2 Guide, Flash swaps</title>
				<imprint>
			<date type="published" when="2023-11-23">2023. 2023-11-23</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b3">
	<analytic>
		<title level="a" type="main">Efficient algorithms for the clearing of interbank payments</title>
		<author>
			<persName><forename type="first">M</forename><forename type="middle">M</forename><surname>Güntzer</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><surname>Jungnickel</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Leclerc</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">European Journal of Operational Research</title>
		<imprint>
			<biblScope unit="volume">106</biblScope>
			<biblScope unit="page" from="212" to="219" />
			<date type="published" when="1998">1998</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b4">
	<analytic>
		<title level="a" type="main">Gridlock resolution in payment systems</title>
		<author>
			<persName><forename type="first">M</forename><surname>Bech</surname></persName>
		</author>
		<author>
			<persName><forename type="first">K</forename><surname>Soramaki</surname></persName>
		</author>
		<idno type="DOI">10.2139/ssrn.274290</idno>
	</analytic>
	<monogr>
		<title level="j">Danmarks Nationalbank Monetary Review</title>
		<imprint>
			<biblScope unit="page" from="67" to="79" />
			<date type="published" when="2001">2001</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b5">
	<analytic>
		<title level="a" type="main">Decentralized privacy-preserving netting protocol on blockchain for payment systems</title>
		<author>
			<persName><forename type="first">S</forename><surname>Cao</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Y</forename><surname>Yuan</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><forename type="middle">De</forename><surname>Caro</surname></persName>
		</author>
		<author>
			<persName><forename type="first">K</forename><surname>Nandakumar</surname></persName>
		</author>
		<author>
			<persName><forename type="first">K</forename><surname>Elkhiyaoui</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Y</forename><surname>Hu</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Financial Cryptography and Data Security: 24th International Conference</title>
				<meeting><address><addrLine>FC</addrLine></address></meeting>
		<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2020">2020. 2020</date>
			<biblScope unit="page" from="137" to="155" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b6">
	<analytic>
		<title level="a" type="main">A theory of automated market makers in defi</title>
		<author>
			<persName><forename type="first">M</forename><surname>Bartoletti</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><forename type="middle">H</forename><surname>.-Y. Chiang</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Lluch-Lafuente</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Logical Methods in Computer Science</title>
		<imprint>
			<biblScope unit="volume">18</biblScope>
			<biblScope unit="page">12</biblScope>
			<date type="published" when="2022">2022</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b7">
	<monogr>
		<author>
			<persName><forename type="first">H</forename><surname>Adams</surname></persName>
		</author>
		<ptr target="https://uniswap.org/whitepaper-v3.pdf" />
		<title level="m">Uniswap v3 core</title>
				<imprint>
			<date type="published" when="2021">2021. 2023-07-09</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b8">
	<monogr>
		<author>
			<persName><forename type="first">A</forename><surname>Person</surname></persName>
		</author>
		<ptr target="Ac-cessed:2024" />
		<title level="m">Sushi protocol documentation</title>
				<imprint>
			<date type="published" when="2020-03-12">2020. -03-12</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b9">
	<analytic>
		<title level="a" type="main">Stableswap-efficient mechanism for stablecoin liquidity</title>
		<author>
			<persName><forename type="first">M</forename><surname>Egorov</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Retrieved</title>
		<imprint>
			<date type="published" when="2019-02-24">Feb 24 (2019. 2021</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b10">
	<analytic>
		<title level="a" type="main">An optimization algorithm for the clearing of interbank payments</title>
		<author>
			<persName><forename type="first">Y</forename><forename type="middle">M</forename><surname>Shafransky</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><forename type="middle">A</forename><surname>Doudkin</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">European Journal of Operational Research</title>
		<imprint>
			<biblScope unit="volume">171</biblScope>
			<biblScope unit="page" from="743" to="749" />
			<date type="published" when="2006">2006</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b11">
	<monogr>
		<author>
			<persName><forename type="first">B</forename><surname>Canada</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><forename type="middle">A</forename><surname>Singapore</surname></persName>
		</author>
		<ptr target="https://www.mas.gov.sg/-/media/Jasper-Ubin-Design-Paper.pdf?la=en&amp;hash=EF5857437C4857373A9287CD86F56D0E7C46E7FF" />
		<title level="m">Enabling cross-border high value transfer using distributed ledger technologies</title>
				<imprint>
			<date type="published" when="2018">2018. 2023-07-11</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b12">
	<analytic>
		<title level="a" type="main">Decentralized netting protocol over consortium blockchain</title>
		<author>
			<persName><forename type="first">K</forename><surname>Naganuma</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Yoshino</surname></persName>
		</author>
		<author>
			<persName><forename type="first">H</forename><surname>Sato</surname></persName>
		</author>
		<author>
			<persName><forename type="first">N</forename><surname>Yamada</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Suzuki</surname></persName>
		</author>
		<author>
			<persName><forename type="first">N</forename><surname>Kunihiro</surname></persName>
		</author>
		<idno type="DOI">10.23919/ISITA.2018.8664259</idno>
	</analytic>
	<monogr>
		<title level="m">International Symposium on Information Theory and Its Applications</title>
				<meeting><address><addrLine>ISITA</addrLine></address></meeting>
		<imprint>
			<publisher>IEEE</publisher>
			<date type="published" when="2018">2018. 2018</date>
			<biblScope unit="page" from="174" to="177" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b13">
	<analytic>
		<title level="a" type="main">Inter-bank payment system on enterprise blockchain platform</title>
		<author>
			<persName><forename type="first">X</forename><surname>Wang</surname></persName>
		</author>
		<author>
			<persName><forename type="first">X</forename><surname>Xu</surname></persName>
		</author>
		<author>
			<persName><forename type="first">L</forename><surname>Feagan</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Huang</surname></persName>
		</author>
		<author>
			<persName><forename type="first">L</forename><surname>Jiao</surname></persName>
		</author>
		<author>
			<persName><forename type="first">W</forename><surname>Zhao</surname></persName>
		</author>
		<idno type="DOI">10.1109/CLOUD.2018.00085</idno>
	</analytic>
	<monogr>
		<title level="m">11th IEEE International Conference on Cloud Computing, CLOUD 2018</title>
				<imprint>
			<publisher>IEEE Computer Society</publisher>
			<date type="published" when="2018">2018</date>
			<biblScope unit="page" from="614" to="621" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b14">
	<analytic>
		<title level="a" type="main">Optimal routing for constant function market makers</title>
		<author>
			<persName><forename type="first">G</forename><surname>Angeris</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Evans</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Chitra</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Boyd</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 23rd ACM Conference on Economics and Computation</title>
				<meeting>the 23rd ACM Conference on Economics and Computation</meeting>
		<imprint>
			<date type="published" when="2022">2022</date>
			<biblScope unit="page" from="115" to="128" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b15">
	<monogr>
		<title level="m" type="main">An efficient algorithm for optimal routing through constant function market makers</title>
		<author>
			<persName><forename type="first">T</forename><surname>Diamandis</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Resnick</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Chitra</surname></persName>
		</author>
		<author>
			<persName><forename type="first">G</forename><surname>Angeris</surname></persName>
		</author>
		<idno type="arXiv">arXiv:2302.04938</idno>
		<imprint>
			<date type="published" when="2023">2023</date>
		</imprint>
	</monogr>
	<note type="report_type">arXiv preprint</note>
</biblStruct>

<biblStruct xml:id="b16">
	<analytic>
		<title level="a" type="main">Global order routing on exchange networks</title>
		<author>
			<persName><forename type="first">V</forename><surname>Danos</surname></persName>
		</author>
		<author>
			<persName><forename type="first">H</forename><forename type="middle">E</forename><surname>Khalloufi</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Prat</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Financial Cryptography and Data Security. FC 2021 International Workshops: CoDecFin, DeFi, VOTING, and WTSC</title>
				<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2021">2021</date>
			<biblScope unit="page" from="207" to="226" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b17">
	<monogr>
		<ptr target="https://uniswap.org/whitepaper-uniswapx.pdf" />
		<title level="m">UniswapX whitepaper</title>
				<imprint>
			<date type="published" when="2023">2023. 2024-01-21</date>
		</imprint>
	</monogr>
	<note>Uniswapx</note>
</biblStruct>

<biblStruct xml:id="b18">
	<monogr>
		<ptr target="https://github.com/Uniswap/v4-core/blob/main/docs/whitepaper-v4.pdf" />
		<title level="m">Uniswap V4 core whitepaper</title>
				<imprint>
			<date type="published" when="2023">2023. 2024-01-21</date>
		</imprint>
	</monogr>
	<note>Uniswap</note>
</biblStruct>

<biblStruct xml:id="b19">
	<monogr>
		<author>
			<persName><forename type="first">C</forename><surname>Developers</surname></persName>
		</author>
		<ptr target="https://docs.cow.fi/" />
		<title level="m">Cow protocol</title>
				<imprint>
			<date type="published" when="2021">2021. 2023-10-10</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b20">
	<monogr>
		<author>
			<persName><forename type="first">A</forename><surname>Hayden</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Z</forename><surname>Noah</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Moody</surname></persName>
		</author>
		<author>
			<persName><forename type="first">K</forename><surname>River</surname></persName>
		</author>
		<author>
			<persName><forename type="first">R</forename><surname>Dan</surname></persName>
		</author>
		<ptr target="https://uniswap.org/whitepaper-v3.pdf" />
		<title level="m">Uniswap v3</title>
				<imprint>
			<date type="published" when="2021">2021. 2024-04-23</date>
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
