Skip to content

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 _facet

As PropsBaseFacet is inherited by facets in the diamond, we can store the facet address within the context of each facet

pause

solidity
function pause() external

Pauses 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() external

Unpauses 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) internal

removeApproveDiamonds

solidity
function removeApproveDiamonds(address[] diamondAddresses) external

_removeApproveDiamonds

solidity
function _removeApproveDiamonds(address[] diamondAddresses) internal

setSanctionsContract

solidity
function setSanctionsContract(address newSanctionsContract) public

Only accounts with OFAC_MANAGER_ROLE or the diamond owner can call this function

Sets a new sanctions contract address

Parameters

NameTypeDescription
newSanctionsContractaddressThe 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

NameTypeDescription
_operatorAddressaddressThe address to check for sanctions

Return Values

NameTypeDescription
[0]boolbool Returns true if the address is sanctioned, false otherwise

revertIfSanctioned

solidity
function revertIfSanctioned(address _operatorAddress) public view

This function checks if the address is sanctioned and reverts if it is

Reverts if the address is sanctioned

Parameters

NameTypeDescription
_operatorAddressaddressThe address to check for sanctions

setApprovedRelayers

solidity
function setApprovedRelayers(address[] _addresses) public

Only the diamond owner can call this function

Sets the approved relayers

Parameters

NameTypeDescription
_addressesaddress[]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

NameTypeDescription
_operatorAddressaddressThe address to check for approval

Return Values

NameTypeDescription
[0]boolbool Returns true if the address is an approved relayer, false otherwise

revertIfNotApprovedRelay

solidity
function revertIfNotApprovedRelay(address _operatorAddress) public view

This 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

NameTypeDescription
_operatorAddressaddressThe 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

NameTypeDescription
functionCallDatabytesThe encoded function call data.

Return Values

NameTypeDescription
[0]bytesresult 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

NameTypeDescription
facetAddressaddressThe address of the facet.
functionSignaturestringThe function signature to check.

Return Values

NameTypeDescription
[0]boolbool 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

NameTypeDescription
_bytesbytes4The bytes4 value to convert.

Return Values

NameTypeDescription
[0]stringstring The hexadecimal string representation of the input.

_setSupportsInterface

solidity
function _setSupportsInterface(bytes4 interfaceId, bool status) internal virtual

This function is used to update the ERC165 interface support status.

Sets the status of interface support

Parameters

NameTypeDescription
interfaceIdbytes4id of interface to set status for
statusboolboolean 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) internal

This function is used to add hooks to the diamond

Adds hooks to the diamond

Parameters

NameTypeDescription
_hooksstruct IPropsBaseFacet.Hook[]The hooks to add

removeHooks

solidity
function removeHooks(struct IPropsBaseFacet.Hook[] _hooks) external

_removeHooks

solidity
function _removeHooks(struct IPropsBaseFacet.Hook[] _hooks) internal

This function is used to remove hooks from the diamond

Removes hooks from the diamond

Parameters

NameTypeDescription
_hooksstruct IPropsBaseFacet.Hook[]The hooks to remove

updateHooks

solidity
function updateHooks(struct IPropsBaseFacet.Hook[] _hooks) external

_updateHooks

solidity
function _updateHooks(struct IPropsBaseFacet.Hook[] _hooks) internal

This function is used to update hooks in the diamond

Updates hooks in the diamond

Parameters

NameTypeDescription
_hooksstruct 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)