This app runs inside the BotSurf browser. Don't have it yet? Get the app or extension now!

Contract Event Assertion Helper Generator

Developer Tools · All
0 installs · Verified BotGentz app
Launch App
Opens in BotSurf — nothing to install.
CategoryDeveloper Tools
PlatformAll
Pricing Free
Installs0
Download BotSurf to use — free
No account needed for free apps. Once BotSurf is open, find this app in Apps from the + menu.

About this app

WHAT IT DOES

This tool connects to your EVM wallet and generates event assertion helper functions from smart contract ABIs. It reads event definitions, including event names, parameter types, and indexed/non-indexed parameters. The tool produces reusable assertion helper functions that simplify testing event emissions in Hardhat or Foundry test suites. It also provides sample test code showing how to use the helpers with chai matchers like expect().to.emit().

HOW TO USE

Connect your Web3 wallet using the Connect button. Enter the contract ABI in JSON format in the ABI field—this should include all event definitions. Optionally, enter the contract name in the Contract Name field. Click "Generate Helpers" to produce event assertion functions. Click "Load Sample" to populate fields with an example ABI containing Transfer, ValueChanged, and OwnershipTransferred events. Results appear in the Results card with a summary of events found, helpers generated, and total assertions created, followed by detailed helper functions and usage examples.

TECHNICAL MECHANISM: EVENT-DRIVEN ASSERTION GENERATION FROM ABI

The tool parses the contract ABI to extract all event definitions. For each event, it captures the event name, indexed parameters (which become filter topics), and non-indexed parameters (which become data payload). The tool generates a custom assertion function for each event that takes a log object and expected values, asserting that the event name matches and each parameter equals the expected value. The generated functions include parameter-specific assertions for addresses, numbers, booleans, and other common types. The tool also generates usage examples showing how to integrate the helpers with chai's .to.emit() matcher for comprehensive event testing.

WHAT IT CANNOT SEE

This tool cannot verify that generated event assertions correctly reflect expected behavior—the assertions must be validated against contract logic. It cannot generate assertions for events with complex or custom parameter types—the tool handles common types but may not support all custom types. It cannot ensure that event emission is tested in all execution paths—the tool generates helpers but does not analyze code coverage. It relies on ABI parsing and may miss events defined in inherited contracts—the ABI must include all events. It cannot generate assertions for events without corresponding test cases or context—the tool provides helpers but not test strategies.

PLEASE NOTE

This is a read-only tool—it never signs transactions. All data is processed in-memory and never persists. The tool supports EVM chains only—Ethereum, Polygon, BSC, Arbitrum, Optimism, Avalanche, Base, and Fantom. Generated event assertion helpers are templates and should be reviewed and adapted to your testing framework. The examples assume Hardhat/Chai—adjust for your specific test environment.

Similar Apps

Log in to BotGentz

Suggest an App

Tell us what you'd find useful — if we build it, we'll email you the moment it's ready.