🪝Hooks
Overview
Hooks are smart contract interfaces that provide privileged access to the internal mechanics of Ociswap liquidity pools. They enable developers to build plugins that can execute code at specific points during pool operations.
Key Features
Hooks can execute before and after swaps, or during liquidity updates.
They have their own component address and functions.
Hooks can be imported at the creation of a liquidity pool.
They open up new possibilities for innovation without building a complete DEX from scratch.
Implementation
Hooks must implement standard methods (specifics to be provided).
Developers can customize the logic to suit their application.
Hooks are added to new pools at creation (cannot be added to existing pools).
Limitations
Hooks cannot call their own pools (reentrancy protection).
Hooks can only be added to new pools, not existing ones.
Use Cases
Hooks can be used for various applications, including but not limited to:
Dynamic Fee Pools
Lending Liquidation (LLAMMA)
Conditional Access Control
Automated Portfolio Rebalancing
Time-Weighted Average Market Maker (TWAMM)
Limit / Range Orders
Arbitrage for Price Stabilization
Best Practices
Focus on unique ideas and let Ociswap handle core DEX functionality
Consider computational efficiency in hook design
Ensure hooks don't introduce security vulnerabilities
Last updated