GNSDiamondCut
Last updated
Was this helpful?
Last updated
Was this helpful?
Based on EIP-2535: Diamonds () Follows diamond-3 implementation () Manages all actions (calls, updates and initializations) related to the diamond and its facets.
Forwards call to the right facet using msg.sig using delegatecall. Reverts if signature is not known.
Allows the contract to receive ether
Add/replace/remove any number of functions and optionally execute a function with delegatecall
_faceCut
_init
address
The address of the contract or facet to execute _calldata
_calldata
bytes
A function call, including function selector and arguments _calldata is executed with delegatecall on _init
Internal function for diamondCut()
Adds the facet if it wasn't added yet, and adds its functions to the diamond
_facetAddress
address
address of the facet contract
_functionSelectors
bytes4[]
array of function selectors
Updates facet contract address for given function selectors
_facetAddress
address
address of the facet contract
_functionSelectors
bytes4[]
array of function selectors
Removes some function selectors of a facet from diamond
_facetAddress
address
address of the facet contract
_functionSelectors
bytes4[]
array of function selectors
Adds a new facet contract address to the diamond
s
diamond storage pointer
_facetAddress
address
address of the new facet contract
Adds a new function to the diamond for a given facet contract
s
diamond storage pointer
_selector
bytes4
function selector
_selectorPosition
uint96
position of the function selector in the facet selectors array
_facetAddress
address
address of the facet contract
Removes a function from a facet of the diamond
s
diamond storage pointer
_facetAddress
address
address of the facet contract
_selector
bytes4
function selector
Initializes a facet after updating the diamond using delegatecall
_init
address
address of the contract to execute _calldata
_calldata
bytes
function call (selector and arguments)
Reverts if the given address is not a contract
_contract
address
address to check