Skip to content

Solidity Libraries Now Have Storage #18

@mudgen

Description

@mudgen

Page 97 of the book says this:

As we have seen, libraries contracts do not have storage. Therefore, they can’t hold state
variables (state variables that are non-constant).

External functions in libraries can take storage arguments and therefore modify the storage of contracts. An example of this is in the Solidity documentation here: https://docs.soliditylang.org/en/v0.8.30/contracts.html#libraries

With the contract standards ERC-8042 and ERC-7201 libraries can define structs in storage and modify them in storage. This is done extensively in the Compose smart contract library: https://github.com/Perfect-Abstractions/Compose

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions