Appearance
Solidity API
PropsBaseFacet
_Base contract for Props facets, providing utility functions and access control. This contract serves as a foundation for other facets in the Props Diamond Framework, incorporating:
- Role-based access control via PropsAccessControl
- Pausability functionality via Pausable
- OFAC sanctions checking via PropsOFACInternal
- Relayer management via PropsRelayersInternal
- Utility functions for diamond-specific operations
- ERC165 interface support management
It defines key roles such as PAUSABLE_ROLE, OFAC_MANAGER_ROLE, and RELAYER_MANAGER_ROLE, and provides methods for pausing/unpausing, managing sanctions, and handling approved relayers. The contract also includes internal helper functions for executing diamond facet calls and managing interface support._
_facet
solidity
address _facetAs PropsBaseFacet is inherited by facets in the diamond, we can store the facet address within the context of each facet
pause
solidity
function pause() externalPauses the contract
_This function can only be called by accounts with the PAUSABLE_ROLE or higher, or by the diamond owner. It triggers the pause() function from the Pausable contract.
unpause
solidity
function unpause() externalUnpauses the contract
_This function can only be called by accounts with the PAUSABLE_ROLE or higher, or by the diamond owner. It triggers the unpause() function from the Pausable contract.
addApproveDiamonds
solidity
function addApproveDiamonds(address[] diamondAddresses) external_addApproveDiamonds
solidity
function _addApproveDiamonds(address[] diamondAddresses) internalremoveApproveDiamonds
solidity
function removeApproveDiamonds(address[] diamondAddresses) external_removeApproveDiamonds
solidity
function _removeApproveDiamonds(address[] diamondAddresses) internalsetSanctionsContract
solidity
function setSanctionsContract(address newSanctionsContract) publicOnly accounts with OFAC_MANAGER_ROLE or the diamond owner can call this function
Sets a new sanctions contract address
Parameters
| Name | Type | Description |
|---|---|---|
| newSanctionsContract | address | The address of the new sanctions contract |
isSanctioned
solidity
function isSanctioned(address _operatorAddress) public view returns (bool)This function queries the current sanctions contract to determine if an address is sanctioned
Checks if an address is sanctioned
Parameters
| Name | Type | Description |
|---|---|---|
| _operatorAddress | address | The address to check for sanctions |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | bool Returns true if the address is sanctioned, false otherwise |
revertIfSanctioned
solidity
function revertIfSanctioned(address _operatorAddress) public viewThis function checks if the address is sanctioned and reverts if it is
Reverts if the address is sanctioned
Parameters
| Name | Type | Description |
|---|---|---|
| _operatorAddress | address | The address to check for sanctions |
setApprovedRelayers
solidity
function setApprovedRelayers(address[] _addresses) publicOnly the diamond owner can call this function
Sets the approved relayers
Parameters
| Name | Type | Description |
|---|---|---|
| _addresses | address[] | The addresses of the approved relayers |
isApprovedRelay
solidity
function isApprovedRelay(address _operatorAddress) public view returns (bool)This function checks if the address is an approved relayer and returns the result
Checks if an address is an approved relayer
Parameters
| Name | Type | Description |
|---|---|---|
| _operatorAddress | address | The address to check for approval |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | bool Returns true if the address is an approved relayer, false otherwise |
revertIfNotApprovedRelay
solidity
function revertIfNotApprovedRelay(address _operatorAddress) public viewThis function checks if the address is an approved relayer and reverts if it is not
Reverts if the address is not an approved relayer
Parameters
| Name | Type | Description |
|---|---|---|
| _operatorAddress | address | The address to check for approval |
_executeDiamondFacetReadCall
solidity
function _executeDiamondFacetReadCall(bytes functionCallData) internal view returns (bytes)This function allows for dynamic execution of read-only functions on the diamond contract.
Executes a read-only call to a diamond facet.
Parameters
| Name | Type | Description |
|---|---|---|
| functionCallData | bytes | The encoded function call data. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bytes | result The result of the function call. |
_supportsFacetFunctionInterface
solidity
function _supportsFacetFunctionInterface(address facetAddress, string functionSignature) internal view returns (bool)This function is used to determine if a specific facet implements a given function.
Checks if a facet supports a specific function interface.
Parameters
| Name | Type | Description |
|---|---|---|
| facetAddress | address | The address of the facet. |
| functionSignature | string | The function signature to check. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | bool True if the facet supports the function, false otherwise. |
_bytesToHexString
solidity
function _bytesToHexString(bytes4 _bytes) internal pure returns (string)This utility function is useful for debugging and logging purposes.
Converts a bytes4 value to its hexadecimal string representation.
Parameters
| Name | Type | Description |
|---|---|---|
| _bytes | bytes4 | The bytes4 value to convert. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | string | string The hexadecimal string representation of the input. |
_setSupportsInterface
solidity
function _setSupportsInterface(bytes4 interfaceId, bool status) internal virtualThis function is used to update the ERC165 interface support status.
Sets the status of interface support
Parameters
| Name | Type | Description |
|---|---|---|
| interfaceId | bytes4 | id of interface to set status for |
| status | bool | boolean indicating whether interface will be set as supported |
addHooks
solidity
function addHooks(struct IPropsBaseFacet.Hook[] _hooks) external_addHooks
solidity
function _addHooks(struct IPropsBaseFacet.Hook[] _hooks) internalThis function is used to add hooks to the diamond
Adds hooks to the diamond
Parameters
| Name | Type | Description |
|---|---|---|
| _hooks | struct IPropsBaseFacet.Hook[] | The hooks to add |
removeHooks
solidity
function removeHooks(struct IPropsBaseFacet.Hook[] _hooks) external_removeHooks
solidity
function _removeHooks(struct IPropsBaseFacet.Hook[] _hooks) internalThis function is used to remove hooks from the diamond
Removes hooks from the diamond
Parameters
| Name | Type | Description |
|---|---|---|
| _hooks | struct IPropsBaseFacet.Hook[] | The hooks to remove |
updateHooks
solidity
function updateHooks(struct IPropsBaseFacet.Hook[] _hooks) external_updateHooks
solidity
function _updateHooks(struct IPropsBaseFacet.Hook[] _hooks) internalThis function is used to update hooks in the diamond
Updates hooks in the diamond
Parameters
| Name | Type | Description |
|---|---|---|
| _hooks | struct IPropsBaseFacet.Hook[] | The hooks to update |
getHooks
solidity
function getHooks(string _triggerFunctionName) external view returns (struct IPropsBaseFacet.Hook[])getDiamondAddress
solidity
function getDiamondAddress() public view returns (address)onlyDiamond
solidity
modifier onlyDiamond()onlyApprovedDiamond
solidity
modifier onlyApprovedDiamond()_delegateHookCall
solidity
function _delegateHookCall(string _triggerFunctionName, bytes _functionCallData) internal returns (bytes)