-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Overview
uniswap-hooks is an invaluable tool for building v4 hooks.
It is part of a broader tool set which includes
- v4-router: A simple and optimized router for swapping on Uniswap V4. ABI inspired by UniswapV2Router02.
- uniswap-hooks: from OpenZeppelin a library of v4 hook functions using
solc 0.8.26- Uses SwapRouterNoChecks from v4-core
- hookmate: A library for Uniswap v4 hook development. I personally love this as it allows me to use later versions of the solidity compiler rather than being forced to use
solc 0.8.26.- Provides interfaces for
- v4-template: A template for writing Uniswap v4 Hooks 🦄 from Uniswap Foundation
- It leverages
- hookmate which uses v4-router
- uniswap-hooks which uses SwapRouterNoChecks
- It leverages
A Potential Development Approach
When writing a new protocol. I wanted the following
- The ability to write Solidity using the latest Solidity compiler. At the time of writing
solc 0.8.30 - The ability to interact with the latest versions of v4-core and v4-periphery
- Consistent use of a swapRouter for testing, ideally v4-router
- Ability to build upon v4-router to offer additional functionality. In my case I need to support async swaps for swap-based intents.
My approach
- Fork v4-router
- Upgrade to use th the latest versions of v4-core and v4-periphery. This request.
- Build out an UniIntentSwapV4Router04 to handle processing of intentBased Swaps
- Fork hookmate and use this fork to include the artifact for the UniIntentSwapV4Router04
- Note there I updated README.md as I walked through the code to improve understanding of how it works.
- Will ensure the artifacts come from the latest version of v4-core and v4-periphery
- Build out the protocol repository currently private, previous versions here
- Move v4-core and v4-periphery to higher level gitmodules rather than using hookmate
- Copy uniswap-hooks contracts as needed and modify the tests to use UniIntentSwapV4Router04
- Include create3 functionality to ensure that can use the same contract addresses across chains regardless of the salt.
Closing Thoughts
It would great to see a consolidation of the codebases above to use a consistent approach including
- uniswap-hooks using v4-router
- uniswap-hooks using the latest version of Solidity e.g.
solc 0.8.30perhaps by taking advantage of hookmate - v4-template using the latest versions of v4-core and v4-periphery
Please reach out to me if you want to collaborate on any of the above my contact details can be found at https://github.com/johnwhitton
Reference code
gitmodules
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/v4-core"]
path = lib/v4-core
url = https://github.com/Uniswap/v4-core
[submodule "lib/v4-periphery"]
path = lib/v4-periphery
url = https://github.com/Uniswap/v4-periphery
[submodule "lib/hookmate"]
path = lib/hookmate
url = https://github.com/jincubator/hookmate.git
[submodule "lib/the-compact"]
path = lib/the-compact
url = https://github.com/jincubator/the-compact
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "lib/create3-factory"]
path = lib/create3-factory
url = https://github.com/jincubator/create3-factory
Metadata
Metadata
Assignees
Labels
No labels