Skip to main content
Based on EIP-2535: Diamonds (https://eips.ethereum.org/EIPS/eip-2535) Follows diamond-3 implementation (https://github.com/mudgen/diamond-3-hardhat/) Manages all actions (calls, updates and initializations) related to the diamond and its facets.

fallback

Forwards call to the right facet using msg.sig using delegatecall. Reverts if signature is not known.

receive

Allows the contract to receive ether

diamondCut

Add/replace/remove any number of functions and optionally execute a function with delegatecall

Parameters

_diamondCut

Internal function for diamondCut()

_addFunctions

Adds the facet if it wasn’t added yet, and adds its functions to the diamond

Parameters

_replaceFunctions

Updates facet contract address for given function selectors

Parameters

_removeFunctions

Removes some function selectors of a facet from diamond

Parameters

_addFacet

Adds a new facet contract address to the diamond

Parameters

_addFunction

Adds a new function to the diamond for a given facet contract

Parameters

_removeFunction

Removes a function from a facet of the diamond

Parameters

_initializeDiamondCut

Initializes a facet after updating the diamond using delegatecall

Parameters

_enforceHasContractCode

Reverts if the given address is not a contract

Parameters