MureConfig

Git Source

Inherits: EIP712Upgradeable, OwnableUpgradeable, UUPSUpgradeable, ERC165Upgradeable, Config

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) external initializer;

toggleWhitelistedSigner

Toggles the whitelisting of the specified address.

function toggleWhitelistedSigner(address mureSigner_) external onlyOwner;

Parameters

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

setMureFeeContract

Sets the fee contract address.

function setMureFeeContract(address feeContractAddress) external onlyOwner;

Parameters

NameTypeDescription
feeContractAddressaddressaddress of the fee contract

getAppDelegate

Retrieves the app delegate.

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

Parameters

NameTypeDescription
appaddressaddress of the app

getFeeContractAddress

Retrieves the fee contract address.

function getFeeContractAddress() external view returns (address);

getPoolFee

function getPoolFee(address poolApp, string calldata poolName, uint256 amount) external returns (uint256, address);

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.

_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);

_supportsFeeConfigInterface

Checks if fee config supports the fee config interface.

function _supportsFeeConfigInterface(address feeConfig) private view 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);

FeeContractSet

event FeeContractSet(address indexed mureFeeContract);

Structs

MureConfigStorage

struct MureConfigStorage {
    mapping(address => uint8) signers;
    mapping(address => address) delegate;
    address mureFeeContract;
}