Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pzixel/sandwich-protector-hook
https://github.com/pzixel/sandwich-protector-hook
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/pzixel/sandwich-protector-hook
- Owner: Pzixel
- License: mit
- Created: 2024-09-16T00:04:30.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-16T11:05:43.000Z (4 months ago)
- Last Synced: 2024-09-17T02:24:10.228Z (4 months ago)
- Language: Solidity
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SandwichProtectorHook
This project aims to create a hook that is transparent for regular users but prevents third parties from sandwiching their transactions. The hook achieves this by imposing increasing fees on the rebalancing buyout (the closing part of the sandwich), making the entire sandwich attack unprofitable. While simultaneous swaps in opposite directions on the same pool are rare, the hook still imposes a minimal fee—almost zero for regular users, and only slightly more in rare cases. However, actual sandwich attackers face significantly higher fees, preventing them from profiting off regular users. This keeps the profits with the swapper, who will prefer this pool over others.
The hook is fully compatible with existing aggregation protocols, making it easily composable and enabling multi-hop trades.
The tests folder includes tests that check all the invariants and also features a few property tests that validate the essential properties of the hook.