ABI to interface

paste an abi, get a solidity interface with structs.

interface name
abijson abi, a foundry/hardhat artifact, or human-readable lines
try

IExchange.sol

5 abi items · tap to copy
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; interface IExchange { struct Order { address maker; uint256 amount; uint64 deadline; } event Filled(address indexed maker, uint256 amount); error Expired(uint64 deadline); function balanceOf(address owner) external view returns (uint256); function fill(Order calldata order, bytes calldata signature) external payable returns (uint256 filled); receive() external payable; }

about this tool

Turn a JSON ABI, a Foundry or Hardhat artifact, or human-readable ABI into a Solidity interface: structs from tuples, events, custom errors, payable and view functions, receive and fallback.

good to know

where do struct names come from?

from internalType in the abi (solc includes it). abis without it get Tuple1, Tuple2… which still encode the same.

what input does it take?

a json abi, a whole foundry or hardhat artifact (the abi is pulled out of it), or human-readable lines like “function transfer(address to, uint256 amount) returns (bool)”.