Enabling the best hooks and the most successful pools to come together, again and again
Typically, a pool is "soul-bonded" to a hook at its creation, this forced coupling will inevitably lead to mismatch and sub-optimal pairing. For example, a useful hook may not find sufficient liquidity / volume to bring out its value, and highly used pool may be stuck with an outdated hook.
Symbio Hooks solve this problem by introducing a host/symbiont hooks system that allows multiple hooks to be attached/detached to a pool at anytime:
This project is built on Foundry with a dependency on the Uniswap v4 Core repository, 100% pure Solidity.
Extra attention is given to keep part of Symbio Hooks loosely coupled. Besides that a pool can have multiple hooks attached and a hook can attach to multiple pools, a symbiont hook can further specify which hook call (function selector) it want to respond to for each pool.
User security and fairness is another area of consideration. For this purpose, beforeSwap and beforeDonate are not supported at host hook level, to prevent sandwich attack and just in time liquidity exploit respectively.
Symbion hooks will reimburse caller for the gas they consume (and hopefully more). Symbiont hooks that don't have sufficient balance or result in failure will be promptly removed from host hook to save resource. Also reverts from inside symbiont hooks are swallowed by the host hook and not re-thrown, so successful symbionts are not affected, and again failed ones will be removed.