Henjin V4 introduces several significant advancements and features over Uniswap V3:
1. Hooks and Custom Pools: One of the most notable additions in Henjin V4 is the introduction of “hooks.” Hooks are smart contracts that can be attached to liquidity pools, allowing for extensive customization at different points in the pool’s lifecycle, such as before or after swaps and liquidity adjustments. This flexibility enables features like dynamic fees, limit orders, and custom AMM curves, enhancing the overall functionality and user experience of the platform.
2. Singleton Contract: Henjin V4 employs a singleton contract architecture, which consolidates all liquidity pools into a single smart contract. This approach significantly reduces gas costs for both trading and pool creation. Early estimates suggest that pool creation in V4 is 99% cheaper in gas costs compared to V3. The singleton model also makes multi-hop trades more efficient since tokens do not need to be transferred between multiple contracts.
3. Flash Accounting: This system allows for efficient chaining of multiple actions in a single transaction, such as swap-and-add-liquidity operations. By tracking net balances of inbound and outbound tokens and verifying debts at the end of the transaction, the flash accounting system reduces gas costs and improves transaction efficiency, similar to the concept of flash loans.
4. Dynamic Fees: Henjin V4 allows for unlimited fee tiers for liquidity pools, providing a more tailored approach to different assets and trading strategies. This flexibility can cater to a broader range of users and market needs, optimizing fee structures to maximize competitiveness.