Skip to content

Commit c7f93de

Browse files
committed
add eulerswaphook audit note
1 parent 76c1a3e commit c7f93de

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# EulerSwapHook Audit
2+
3+
Through a new partnership between Euler Labs and Uniswap Foundation, the teams intend to expose EulerSwap's core logic and mechanisms via a Uniswap v4 Hook interface.
4+
5+
This is primarily done by inheriting `EulerSwap.sol:EulerSwap`, i.e. `EulerSwapHook is EulerSwap, BaseHook`, and implementing a "custom curve" via `beforeSwap`. The implementation will allow integrators, interfaces, and aggregators, to trade on EulerSwap as-if it is any other Uniswap v4 Pool
6+
7+
```solidity
8+
// assuming the EulerSwapHook was instantiated via EulerSwapFactory
9+
PoolKey memory poolKey = PoolKey({
10+
currency0: currency0,
11+
currency1: currency1,
12+
fee: fee,
13+
tickSpacing: 60,
14+
hooks: IHooks(address(eulerSwapHook))
15+
});
16+
17+
minimalRouter.swap(poolKey, zeroForOne, amountIn, 0);
18+
```
19+
20+
21+
## Audit Scope
22+
23+
The scope of audit involves the code-diff introduced by [PR #48](https://github.com/euler-xyz/euler-swap/pull/48/files). **As of Apr 1st, 2025, the diff is subject to change but will be code-complete by the audit start time.**
24+
25+
Major Changes will include:
26+
27+
* Replacing `binarySearch` quoting algorithm with a closed-form formula
28+
* Implementing a protocol fee, as a percentage of LP fees, enacted by governance
29+
30+
As for the files in scope, only files from `src/` should be considered:
31+
32+
```
33+
├── src
34+
│ ├── EulerSwapFactory.sol
35+
│ ├── EulerSwapHook.sol
36+
│ └── utils
37+
│ └── HookMiner.sol
38+
```
39+
40+
## Known Caveats
41+
42+
### Prepaid Inputs
43+
44+
Due to technical requirements, EulerSwapHook must take the input token from PoolManager and deposit it into Euler Vaults. It will appear that EulerSwapHook can only support input sizes of `IERC20.balanceOf(PoolManager)`. However swap routers can pre-emptively send input tokens (from user wallet to PoolManager) prior to calling `poolManager.swap` to get around this limitation.
45+
46+
An example `test/utils/MinimalRouter.sol` is provided as an example.

0 commit comments

Comments
 (0)