113 - Library Restrictions
In comparison to contracts, libraries are restricted in the following ways:
- They cannot have state variables
- They cannot inherit nor be inherited
- They cannot receive Ether
- They cannot be destroyed
- It can only access state variables of the calling contract if they are explicitly supplied (it would have no way to name them, otherwise)
- Library functions can only be called directly (i.e. without the use of DELEGATECALL) if they do not modify the state (i.e. if they are view or pure functions), because libraries are assumed to be stateless
- No State Variables
- X -> Inherit or Inheritied
- X -> Receive Ether
- X -> Be Destroyed
- Calling Contract -> Only State Vars Supplied
- Directly vs. delegatecall
- pure or view Functions
OZ LibrariesselfdestructInheritanceStorage Layout & Inheritance