IDiamondStorage

Based on EIP-2535: Diamonds (https://eips.ethereum.org/EIPS/eip-2535) Follows diamond-3 implementation (https://github.com/mudgen/diamond-3-hardhat/) Contains the types used in the diamond management contracts.

DiamondStorage

struct DiamondStorage {
  mapping(bytes4 => struct IDiamondStorage.FacetAddressAndPosition) selectorToFacetAndPosition;
  mapping(address => struct IDiamondStorage.FacetFunctionSelectors) facetFunctionSelectors;
  address[] facetAddresses;
  address[47] __gap;
}

FacetAddressAndPosition

struct FacetAddressAndPosition {
  address facetAddress;
  uint96 functionSelectorPosition;
}

FacetFunctionSelectors

struct FacetFunctionSelectors {
  bytes4[] functionSelectors;
  uint256 facetAddressPosition;
}

FacetCutAction

enum FacetCutAction {
  ADD,
  REPLACE,
  REMOVE,
  NOP
}

FacetCut

struct FacetCut {
  address facetAddress;
  enum IDiamondStorage.FacetCutAction action;
  bytes4[] functionSelectors;
}