In Solidity, libraries are primarily categorized into two types:
-
Functional Libraries:This type of library contains a set of static functions that can be called in smart contracts but do not store state variables. Functional libraries are designed for code reuse, such as common mathematical operations or data structure manipulations.
-
Data Type Libraries:This type of library offers extended functionality for specific data types, typically using the
using forsyntax. This allows library functions to be called as methods of the target type, which can be viewed as adding new methods or properties to existing data types.