Hook Function Risk Explainer
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Hook Function Risk Explainer is a read-only tool that analyzes hook functions in smart contracts, generating AI-powered plain-language explanations of what a hook does, when it triggers, what permissions it has, who registered it, and the risks of those permissions. It reads contract address, hook function signature, hook registration status, hook execution context, access control lists, function permissions, trigger conditions, upgrade history, owner address, privileged function signatures, event logs, transaction history, hook activation and deactivation status, governance proposals, and execution order. The tool then presents this data alongside an AI-generated analysis of the hook's permissions and risks, identifying potential threats such as reentrancy, privilege escalation, and state manipulation — helping you understand the trustworthiness of a hook before interacting with or relying on it.
HOW TO USE
Connect your wallet using the BGWallet bridge and select your target network. Enter the contract address and the hook function signature you want to analyze (e.g., "beforeTransfer(address,uint256)"). Click "Analyze hook risk" to read on-chain contract data. The tool displays the contract address, hook function, registration status, trigger context, and hook risk level (Low/Medium/High). Detailed information includes registered by, owner, access control type, permissions, trigger conditions, execution order, activation status, upgrade history, privileged functions, and governance proposals. A risk assessment box provides a summary risk evaluation. An AI explanation appears below the on-chain data, explaining what the hook function does, when it triggers, what permissions it has, who registered or approved it, and the risks of those permissions before you interact with or rely on the hook. The wallet's own signature step still protects you — this explanation is informational only and does not replace reviewing what you approve in your wallet.
TECHNICAL MECHANISM
The tool uses ethers.js v5.7.2 with the provider from the BGWallet bridge to read on-chain contract data. No hardcoded contract addresses are used — you are always in control of which contract you trust. When analyzing hook risks, the tool reads the contract address from the user input, reads the hook function signature from the user input, checks hook registration status via the contract's hook registry (e.g., isHookRegistered()), reads hook execution context via the contract's hook management functions, reads access control lists via the contract's access control functions, reads function permissions via the contract's permission management functions, reads trigger conditions via the contract's hook configuration, reads upgrade history by scanning event logs (e.g., HookAdded, HookRemoved), reads owner address via the contract's owner() function, reads privileged function signatures by analyzing function selectors, reads event logs by scanning for hook-related events, reads transaction history via provider.getTransactionCount(contract), reads hook activation and deactivation status via the contract's hook management functions, reads governance proposals via the governance contract (if available), and reads execution order via the contract's hook configuration. The tool fetches event logs by walking backwards in chunks and halving chunk size on failure, ensuring logs are properly read despite varying RPC limitations. The data is formatted and passed to the AI bridge via BGAI.generate() with a structured prompt that includes all the on-chain data read. The AI is instructed to explain what the hook function does, when it triggers, what permissions it has, who registered or approved it, and the risks of those permissions — while stating plainly that it cannot detect if a hook's registered actions are being used maliciously beyond the on-chain configuration, cannot detect off-chain social engineering attacks or governance manipulation, and cannot guarantee that a hook's behavior will not be changed in a future upgrade. The AI response is capped at 1,024 tokens to ensure concise, focused hook risk assessments. All computed values are guarded against negative numbers — if a permission count or function count appears invalid, the tool flags it rather than displaying nonsensical values.
WHAT IT CANNOT SEE
This tool cannot detect if a hook's registered actions are being used maliciously beyond the on-chain configuration. It cannot detect off-chain social engineering attacks or governance manipulation. It cannot guarantee that a hook's behavior will not be changed in a future upgrade. It cannot detect hooks that are registered but have hidden or off-chain functionality. The AI explanation is generated from on-chain data only and cannot detect hidden hook functionality, off-chain actions, or social engineering attacks. It cannot predict whether a hook's behavior will be changed or removed in the future. The tool does not continuously monitor hook risks; each analysis is a snapshot at the time of the lookup. It cannot detect delayed behavior changes, hidden hooks, or off-chain factors. The tool does not store any data persistently; all state is in-memory and resets on reload. The AI explanation is informational and does not constitute financial advice, legal advice, or a guarantee of hook safety or behavior correctness.
PLEASE NOTE
Hook Function Risk Explainer works exclusively with EVM-compatible chains. It requires a Web3 wallet (MetaMask or similar) and the BGWallet bridge. Explanations are AI-generated from data the app reads on-chain — always review what you are actually signing in your wallet before approving it. Hook functions carry significant risk including reentrancy, privilege escalation, and state manipulation. Use this tool as a guide only; always cross-check with independent sources and contract audits for critical decisions. This is experimental software; use at your own risk.