A TypeScript tool to fetch the full ABI of multimodule contracts, including events from all submodules. Supports EIP-1967 Transparent Proxy pattern.
# Clone the repository
git clone <repository-url>
cd abi-fetcher
# Install dependencies
pnpm installCreate 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.
pnpm get-abi -- --address <proxy-contract-address> --network <network>Or with shortened options:
pnpm get-abi -- -a <proxy-contract-address> -n <network>--addressor-a: Proxy contract address (following EIP-1967 Transparent Proxy pattern)--networkor-n: Network where the contract is deployed (e.g., mainnet, sepolia, hoodi)
pnpm start -- --address 0x1234567890123456789012345678901234567890 --network mainnetThis script assumes that there is a getModuleAddress(uint256) getter at Implementation Contract which allows to retrieve the addresses of Contract Modules.
- Gets the implementation contract address by retrieving it from the storage slot on the proxy contract
- Fetches the implementation contract ABI
- Calls the
getModuleAddress(uint256)function on the proxy contract (using the implementation ABI) - Continues calling with consecutive integers starting from 0 until it receives an error or a zero address
- Extracts events from all module ABIs and merges them with the implementation ABI
The script generates the following files:
baseAbi.json: The ABI of the implementation contractmodule_<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