DiamondCutFacet
View Source: contracts/diamond/facets/DiamondCutFacet.sol
↗ Extends: IDiamondCut
DiamondCutFacet
Provides diamond facet management functionality based on Nick Mudge's gas-optimized diamond-2 reference,
with modifications to support role-based access and management of
supported interfaces. Also added copious code comments throughout.
Reference Implementation : https://github.com/mudgen/diamond-2-hardhat
EIP-2535 Diamond Standard : https://eips.ethereum.org/EIPS/eip-2535
Functions
diamondCut
Cuts facets of the Diamond
Adds/replaces/removes any number of function selectors
If populated, _calldata is executed with delegatecall on _init
Reverts if caller does not have UPGRADER role
function diamondCut(struct IDiamondCut.FacetCut[] _facetCuts,
address _init,
bytes _calldata)
external
Arguments
Name | Type | Description |
---|---|---|
_facetCuts | IDiamondCut.FacetCut[] | contains the facet addresses and function selectors |
_init | address | the address of the contract or facet to execute _calldata |
_calldata | bytes | a function call, including function selector and arguments |