Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABI Fetcher

A TypeScript tool to fetch the full ABI of multimodule contracts, including events from all submodules. Supports EIP-1967 Transparent Proxy pattern.

Installation

# Clone the repository
git clone <repository-url>
cd abi-fetcher

# Install dependencies
pnpm install

Configuration

Create a .env file in the root directory with your Etherscan API key:

ETHERSCAN_API_KEY=YOUR_ETHERSCAN_API_KEY

You can copy the .env.example file as a starting point.

Usage

pnpm get-abi -- --address <proxy-contract-address> --network <network>

Or with shortened options:

pnpm get-abi -- -a <proxy-contract-address> -n <network>

Arguments

  • --address or -a: Proxy contract address (following EIP-1967 Transparent Proxy pattern)
  • --network or -n: Network where the contract is deployed (e.g., mainnet, sepolia, hoodi)

Example

pnpm start -- --address 0x1234567890123456789012345678901234567890 --network mainnet

IMPORTANT NOTE

This script assumes that there is a getModuleAddress(uint256) getter at Implementation Contract which allows to retrieve the addresses of Contract Modules.

How It Works

  1. Gets the implementation contract address by retrieving it from the storage slot on the proxy contract
  2. Fetches the implementation contract ABI
  3. Calls the getModuleAddress(uint256) function on the proxy contract (using the implementation ABI)
  4. Continues calling with consecutive integers starting from 0 until it receives an error or a zero address
  5. Extracts events from all module ABIs and merges them with the implementation ABI

Output

The script generates the following files:

  • baseAbi.json: The ABI of the implementation contract
  • module_<index>.json: The ABI of each submodule contract (index starts from 0)
  • fullAbi.json: The merged ABI containing the implementation contract's ABI and all events from submodules

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages