MC Hooks Template

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

ETHGlobal BangkokShipped November 15, 2024Prize winner
Repo
MC Hooks Template banner

About

Successfully rewrote the v4-template using a Meta Contract framework, achieving upgradeable and maintainable hooks.

Many hooks are currently in development, while most are built as standard (immutable) contracts, upgradability is sometimes needed. Stateless hooks require only a single instance, but for stateful hooks, it’s preferable to have one per pool. It’s possible to manage stateful hooks by pool ID, this can introduce risks, such as asset mixing.

Meta Contract offers an upgradable and clonable smart contract paradigm, making it an ideal choice for creating a template for hooks. Meta Contract incorporates the following ERCs as core components: ERC-7546: Upgradeable Clone for Scalable Contracts ERC-7201: Namespaced Storage Layout

How it's made

I used two repository. Template from @uniswapfoundation/v4-template, framework from @metacontract/mc. Since there was a Counter.sol, I rewrote the same functionality as a Hook following the syntax of the Meta Contract framework. I proceeded with the rewrite following the steps below: ・Function separation ・Storage schema construction ・Function registration into a dictionary ・Generation of proxies linked to the dictionary

Prizes

  • Blockscout · Blockscout Explorer Big Pool Prize · Blockscout Explorer Big Pool Prize

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.

HookWizard

A Uniswap v4 hook wizard for non-coders users to launch hook backed policy-aware pools in minutes.

HookLens

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

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.