Building Custom Hooks
What are Custom Hooks?
Why They Matter
How to Create a Custom Hook
contract ERC4626Hook {
function withdraw(uint256 assets, address receiver, address owner) public returns (bytes memory returnData) {
if (HooksLibrary.isBeforeHook()) {
return abi.encode(receiver);
} else if (HooksLibrary.isAfterHook()) {
// no action to take for this hook
return bytes("");
} else {
// this branch will only happen if the hook
// is called by a contract other than the vault
}
}
}Caveats
Last updated

