Skip to content

Smart Contract Interface Generator for Ethereum Developers

License

Notifications You must be signed in to change notification settings

rmsrob/abisiggen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

abisiggen 🛠️⚡

Sanity checks License: AGPL-3.0-only

Smart Contract Interface Generator for Ethereum Developers

Overview

Automatically generates type-safe Go bindings, event topics, method selectors, and documentation from smart contract ABIs. Designed for Foundry/Go Ethereum projects to prevent signature mismatches and accelerate development.

Key features:

  • 🎯 Event topic hashes with full signatures
  • 🔑 Method selectors with ABI encoding
  • 📘 CLI-friendly lowercase method names
  • 📖 Auto-generated contract documentation
  • 🔄 Initialization helpers for Go code

Features

  • Event Topic Generation - Precise keccak256 hashes for all events
  • Method Selectors - Pre-computed 4-byte signatures with full function signatures
  • Multi-Contract Support - Processes all sub folders that contain an ABI
  • Documentation Generation - Creates _help.md with event/view details
  • Type Safety - Generates Go structs with proper types
  • Version Control - Maintains consistency across contract versions

Install dependencies

brew install jq go-ethereum foundry

Usage

  • Copy abisiggen.sh to your project.
  • Copy your contract ABIs to pkg/contracts/[ContractName]/[Contract].abi

Tip

You can edit the CONTRACT_SOURCES_DIR:

# Find all directories in the contract sources directory
# you can edit this to hardcode the contracts you want to process
PROJECT_ROOT="$(dirname "$(dirname "$(realpath "$0")")")"
CONTRACT_SOURCES_DIR="$PROJECT_ROOT/pkg/contracts"

Follow this structure, or ensure PROJECT_ROOT is set correctly:

.sh/
├── abisiggen.sh        # Main generator script
└── pkg/contracts/
    └── [ContractName]/
        └── [Contract].abi      # Contract ABI
chmod +x sh/abisiggen.sh
./sh/abisiggen.sh

Output

.sh/
├── abisiggen.sh        # Main generator script
└── pkg/contracts/
    └── [ContractName]/
        ├── [Contract].abi      # Contract ABI
        ├── [Contract].go       # Go bindings (abigen)
        ├── [Contract]_extra.go # Generated topics/methods
        └── [Contract]_help.md  # Generated documentation

Example console:
See the generated output for Sablier contract in example

sh .sh/abisiggen.sh
Processing SablierV2LockupLinear with abigen
✓ Generated SablierV2LockupLinear bindings
✓ Generated SablierV2LockupLinear_extra.go
Created SablierV2LockupLinear_help.md
Processing SablierV2LockupDynamic with abigen
✓ Generated SablierV2LockupDynamic bindings
✓ Generated SablierV2LockupDynamic_extra.go
Created SablierV2LockupDynamic_help.md

About

Smart Contract Interface Generator for Ethereum Developers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages