A v4 hook generator leveraging generative AI where users can select a pair, introduce a prompt, get the hook generated, deployed and verified in a couple clicks.
Prize Pool
Prize Pool
Cook Some Hooks is a tool that allows users to create and deploy Uniswap v4 hooks easily leveraging generative AI.
Users can select their preferred DeFi dApp (e.g., Uniswap or PancakeSwap), choose the pair they want to create a pool for, and leverage an LLM model to generate the hook’s functionality. The generated hooks can then be deployed on any EVM-compatible chain.
This project aims to simplify the process of creating and deploying customized v4 hooks - lowering the barrier both for non-technical users but also for developers, which can learn faster, and use it as a bootstrap for more complex hooks.
The frontend is built with React and uses state management libraries to handle user input and interaction. The backend interacts with various APIs and handles the deployment of hooks on EVM chains.
The AI part is split in two parts: Using APIs from OpenAI and Anthropic, and on the other side, using Galadriel for onchain access to LLMs. In both cases, a RAG (Retrieval-Augmented Generation) has been made to first go through a set of summaries of hooks, in order to select the ones most relevant to the incoming prompt. Then, a prompt with the relevant hook examples and v4 documentation is crafted, which acts as the real prompt to obtain the hook solidity code. Once the code is obtained - it is compiled - to see if it compiles. If not, the errors are passed back to the LLMs, which attempt to fix the mistake - in a iterative way.
Once the solidity compiles, a python script mines the CREATE2 salt for the hook deployment, which is then sent to the frontend client, who can deploy leveraging metamask. Here, an optional step is verifying the worldID of WorldCoin for an optional extra layer of verification, trust and credibility.
In a last step, this deployed hook contract is verified on Blockscout using their API. Also, Walletconnect is used to connect to different wallets in the app.