DiamondLib
View Source: contracts/diamond/DiamondLib.sol
DiamondLib
Provides Diamond storage slot and supported interface checks.
Structs
DiamondStorage
struct DiamondStorage {
mapping(bytes4 => bytes32) facets,
mapping(uint256 => bytes32) selectorSlots,
uint16 selectorCount,
mapping(bytes4 => bool) supportedInterfaces,
contract IAccessControl accessController
}
Contract Members
Constants & Variables
bytes32 internal constant DIAMOND_STORAGE_POSITION;
Functions
diamondStorage
Gets the Diamond storage slot.
function diamondStorage()
internal
pure
returns(DiamondStorage storage ds)
Returns
Name | Type | Description |
---|---|---|
ds | DiamondLib.DiamondStorage | Diamond storage slot cast to DiamondStorage |
addSupportedInterface
Adds a supported interface to the Diamond.
function addSupportedInterface(bytes4 _interfaceId)
internal
Arguments
Name | Type | Description |
---|---|---|
_interfaceId | bytes4 | the interface to add |
supportsInterface
Checks if a specific interface is supported.
Implementation of ERC-165 interface detection standard.
function supportsInterface(bytes4 _interfaceId)
internal
view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_interfaceId | bytes4 | the sighash of the given interface |
Returns
bool