Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MureConfig

Git Source

Inherits: EIP712Upgradeable, OwnableUpgradeable, UUPSUpgradeable, ERC165Upgradeable, Config

Title: MureConfig

Author: Mure

Upgradeable configuration contract governing Mure protocol settings, signers, and app delegates. Implements Ownable for access control, UUPSUpgradeable for efficient upgrades, ERC165Upgradeable for interface support, and Config interface for compatibility checks. Manages whitelisted signers for secure operations, like verifying any EIP-712 signature used within the Mure protocol is signed by one of the whitelisted signers. Supports toggling the whitelisting of signers. Manages app delegates for flexible app functionality. Ensures that delegate contracts being set for an application conform to the Delegatable interface, maintaining consistency and compatibility.

State Variables

MureConfigStorageLocation

Struct hash for storage location keccak256(abi.encode(uint256(keccak256("mure.MureConfig")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant MureConfigStorageLocation =
    0x449166636934a062783bf0dfc33be04087c7302a55ece21ecb76ecfd3ffd2100

Functions

initialize

function initialize(string calldata name, string calldata version, address owner, address[] calldata signers)
    external
    initializer;

toggleWhitelistedSigner

Toggles the whitelisting of the specified address.

function toggleWhitelistedSigner(address signer_) external onlyOwner;

Parameters

NameTypeDescription
signer_addressThe address whose whitelisting is to be toggled.

setAppDelegate

Sets the app delegate.

Set to address(0) to disable delegate

function setAppDelegate(address app, address delegate) external onlyOwner;

Parameters

NameTypeDescription
appaddressaddress of the app
delegateaddressaddress of the delegate

getAppDelegate

Retrieves the app delegate.

function getAppDelegate(address app) external view returns (address);

Parameters

NameTypeDescription
appaddressaddress of the app

verifyMureSignature

Validates if the provided signature has been created by one of the whitelisted signers.

function verifyMureSignature(bytes32 structHash, bytes memory signature) external view;

Parameters

NameTypeDescription
structHashbytes32The hashed message that was signed.
signaturebytesThe signature to be validated.

isWhitelistedSigner

Checks whether the specified address is whitelisted.

function isWhitelistedSigner(address address_) public view returns (bool);

Parameters

NameTypeDescription
address_addressThe address to check.

_toggleWhitelistedSigner

Toggles the whitelisting of the specified address.

function _toggleWhitelistedSigner(address signer_) private;

Parameters

NameTypeDescription
signer_addressThe address whose whitelisting is to be toggled.

_getStorage

Retrieves the storage for the MureConfig contract.

function _getStorage() private pure returns (MureConfigStorage storage $);

_supportsDelegateInterface

Checks if delegate supports delegate interface.

function _supportsDelegateInterface(address delegate) private view returns (bool);

supportsInterface

See IERC165-supportsInterface.

function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(ERC165Upgradeable, IERC165)
    returns (bool);

_authorizeUpgrade

required by the OZ UUPS module

function _authorizeUpgrade(address) internal override onlyOwner;

Events

AppDelegated

event AppDelegated(address indexed app, address indexed delegate);

Structs

MureConfigStorage

Note: storage-location: erc7201:mure.MureConfig

struct MureConfigStorage {
    mapping(address => uint8) signers; // 1 - allowlisted
    mapping(address => address) delegate;
}