What Are Hooks?
Hooks are smart contract modules that you attach to your Gotchipus to give it autonomous behavior. When specific on-chain events occur, Hooks trigger and execute logic — without requiring your manual intervention. Think of Hooks as your Gotchipus’s instincts: pre-programmed responses to the world around it.Hook Events
Hooks are triggered at two points in the execution lifecycle:
Each Gotchipus can have up to 10 Hooks per event, creating layered behavioral logic.
How Hooks Work
Hook Parameters
Every Hook receives context about the execution:
AfterExecute Hooks also receive the execution result (success/failure and return data).
Managing Hooks
Adding a Hook
Hooks are added viaaddHook(tokenId, hookAddress) — you attach a deployed smart contract to your Gotchipus. The Hook contract declares which events it supports (BeforeExecute, AfterExecute, or both).
Removing a Hook
Hooks can be removed at any time by the Gotchipus owner viaremoveHook().
Viewing Hooks
QuerygetHooks(tokenId, eventType) to see all Hooks currently attached to a Gotchipus for a specific event.
Example Hooks
The protocol includes example Hook contracts to demonstrate the pattern:Building Your Own
Hooks extend theBaseHook abstract contract. To create a custom Hook:
- Inherit from
BaseHook - Implement
beforeExecute()and/orafterExecute() - Declare supported events via hook permissions
- Deploy and attach to your Gotchipus
Why Hooks Matter
Hooks transform Gotchipus from a collectible into a programmable agent:- For players: Automate care routines, react to market conditions, optimize strategies
- For developers: Build and share behavioral modules, creating an ecosystem of composable AI logic
- For the ecosystem: 20,000 Gotchipus running diverse Hook logic creates emergent, unpredictable on-chain behavior — the foundation of an autonomous agent civilization