Cook some hooks

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.

ETHGlobal BrusselsShipped July 12, 2024Prize winner#ai#defi#identity#uniswap#world
Visit Repo
Cook some hooks banner

About

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.

How it's made

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.

Prizes

  • PancakeSwap · Most creative hook ideas · 3rd place
  • Blockscout · Best use of Blockscout Block Explorer · Best use of Blockscout Block Explorer
  • Worldcoin · Pool Prize · Pool Prize
  • Uniswap Foundation · Research and Experimentation · 2nd place
  • ETHGlobal · ETHGlobal · 🏆 ETHGlobal Brussels Finalist

From the public ETHGlobal showcase page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.

HookLens

Discover, inspect, and simulate Uniswap v4 hooks with an swap simulator pipeline.

Coupled Markets

DeFi Innovation: Coupling of Uniswap V4 Hook with AI Agent. Allows for improving the returns for the liquidity providers while maintaining market rate swap rates for all attached liquidity pools. Unique to our design: Minimal gas cost for swappers despite rich hook functionality

MC Hooks Template

Uniswap V4 Hooks template based on a Meta Contract framework with function-level upgradeability and clonability

ETHGlobal BangkokPrize winner

Univ4 Hooks Wizard

A wizard no code tool to combine, personnalize and build customs uniswap v4 hooks.