Skip to content

Unused contract detector#

Reports abstract contracts, interfaces, and libraries that are not used in the source code.

Example#

abstract contract A { // (1)!
    function foo() external virtual;
}

interface I { // (2)!
    function bar() external;
}

library L { // (3)!
    function baz() external {}
}

contract C {
    function qux() external {}
}
  1. The abstract contract A is not used in the source code.
  2. The interface I is not used in the source code.
  3. The library L is not used in the source code.

Parameters#

Command-line name TOML name Type Default value Description
--abstract/--no-abstract abstract bool true Whether to report unused abstract contracts.
--interface/--no-interface interface bool true Whether to report unused interfaces.
--library/--no-library library bool true Whether to report unused libraries.