You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,6 +150,36 @@ On networks where Uniswap v4 is deployed, EulerSwap is deployed using a factory
150
150
151
151
The `script` folder contains scripts for deploying pools, as well as executing test trades on them. See the dedicated [README](./script/README.md)
152
152
153
+
## For Solvers
154
+
155
+
### Swaps
156
+
157
+
There are two ways to swap directly on EulerSwap: via a Uniswap V4 hook or by calling the pool’s [swap](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/interfaces/IEulerSwap.sol#L65) function, which has the same ABI and behaviour as Uniswap V2 pools.
158
+
159
+
Additionally, the `EulerSwapPeriphery` contract provides helper functions: [swapExactIn](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/interfaces/IEulerSwapPeriphery.sol#L8) and [swapExactOut](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/interfaces/IEulerSwapPeriphery.sol#L21)
160
+
161
+
### Quotes
162
+
163
+
EulerSwap pools expose the [computeQuote](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/interfaces/IEulerSwap.sol#L53) function for quoting both exact input and exact output trades. The function will revert if there is insufficient liquidity for the requested amount or if the pool has been decommissioned. If the function returns a quote, it means the trade is executable based on the pool’s current state (assuming the pool is operational—see the **Creating and Decommissioning Pools** section).
164
+
165
+
The `EulerSwapPeriphery` contract also provides the [quoteExactInput](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/interfaces/IEulerSwapPeriphery.sol#L32) and [quoteExactOutput](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/interfaces/IEulerSwapPeriphery.sol#L38) helper functions
166
+
167
+
### Liquidity
168
+
169
+
Unlike traditional AMMs, EulerSwap pools do not hold token reserves directly. Instead, liquidity is provided just-in-time from the underlying Euler lending vaults. The amount that can be deposited to or withdrawn from the lending vaults depends on the current state of the EulerSwap account and various factors, such as supply and borrow caps, vault utilization, etc. This means there may be limits at any given moment on how much can be sold or bought in a trade.
170
+
171
+
These limits are directional, resulting in four distinct parameters: input and output limits for trades in each direction. The [getLimits](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/interfaces/IEulerSwap.sol#L59) function can be used to fetch the current liquidity limits available for swapping and is also available via `EulerSwapPeriphery`.
172
+
173
+
Note that these limits are enforced by the quoting functions, which will revert if a trade exceeds them.
174
+
175
+
### Creating and Decomissioning Pools
176
+
177
+
The EulerSwap pools are created by the `EulerSwapFactory` contract, which emits a [PoolDeployed](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/EulerSwapFactory.sol#L32) event and provides functions to list existing instances.
178
+
179
+
Pools can also be uninstalled by LPs, for example during rebalancing, in which case the factory emits a [PoolUninstalled](https://github.com/euler-xyz/euler-swap/blob/1f73f5cb07f2e64e8c9815076749574b1b54e204/src/EulerSwapFactory.sol#L34) event.
180
+
181
+
However, note that EulerSwap instances are installed on top of regular accounts within the Euler lending platform—they do not control these accounts. This means an LP can abandon an EulerSwap instance simply by withdrawing their position from the lending vaults. In such cases, the factory has no indication that the pool is no longer operational, but quoting functions will start reverting. If a pool continually fails to return quotes, it should likely be blacklisted.
182
+
153
183
## Safety
154
184
155
185
This software is experimental and is provided "as is" and "as available".
0 commit comments