project screenshot 1
project screenshot 2
project screenshot 3

MC Hooks Template

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

MC Hooks Template

Created At

ETHGlobal Bangkok

Winner of

Blockscout - Blockscout Explorer Big Pool Prize

Prize Pool

Project Description

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

background image mobile

Join the mailing list

Get the latest news and updates