MureFee
Inherits: OwnableUpgradeable, UUPSUpgradeable, FeeConfig
Author: Mure
Manages pool specific fee configuration and calculations. If specific config is not set for a pool; default fee config is applied. Fee configuration is stored in a mapping against an encoded key.
Upgradeable configuration contract governing Mure protocol fee settings
Implements Ownable for access control, UUPSUpgradeable for efficient upgrades, ERC165Upgradeable for interface support, and FeeConfig interface for compatibility checks.
State Variables
MureFeeStorageLocation
Struct hash for storage location
keccak256(abi.encode(uint256(keccak256("mure.MureFee")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant MureFeeStorageLocation = 0x5ce6e1025f6bcb2fbc14816760e865aaac081dc4c60162a5e592c26e03f6f100;
Functions
initialize
function initialize(address defaultFeeRecipient_, uint16 defaultFeePercentage_, address owner) external initializer;
setPoolFee
Sets fee configurations for a particular pool.
Requires the pool to exist. Can only be called by the contract owner.
function setPoolFee(address poolApp, string calldata poolName, uint16 feePercentage, address feeRecipient)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
poolApp | address | address of the pool app |
poolName | string | the name of the pool |
feePercentage | uint16 | fee percentage in basis points |
feeRecipient | address | address of the fee recipient |
setDefaultFeeConfig
Sets the default fee configuration.
Can only be called by the contract owner.
function setDefaultFeeConfig(uint16 defaultFeePercentage_, address defaultFeeRecipient_) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
defaultFeePercentage_ | uint16 | default fee percentage in basis points |
defaultFeeRecipient_ | address | default address of the fee recipient |
getPoolFee
Calculates the fee to be charged on amount.
function getPoolFee(address poolApp, string calldata poolName, uint256 amount)
external
view
returns (uint256, address);
Parameters
Name | Type | Description |
---|---|---|
poolApp | address | address of the pool app |
poolName | string | the name of the pool |
amount | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | fee amount and recipient |
<none> | address |
poolFeePercentage
Retrieves the pool fee percentage.
function poolFeePercentage(address poolApp, string calldata poolName) public view returns (uint16 feePercentage);
Parameters
Name | Type | Description |
---|---|---|
poolApp | address | address of the pool app |
poolName | string | the name of the pool |
Returns
Name | Type | Description |
---|---|---|
feePercentage | uint16 | configured fee percentage |
encodeHash
Calculates the encoded hash for pool config.
function encodeHash(address poolApp, string calldata poolName) public pure returns (bytes32);
Parameters
Name | Type | Description |
---|---|---|
poolApp | address | address of the pool app |
poolName | string | the name of the pool |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32 | encoded hash |
supportsInterface
See IERC165-supportsInterface.
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool);
_calculateFee
Calculates the fee to be charged.
function _calculateFee(uint256 amount, uint256 feePercentage) private pure returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | total amount |
feePercentage | uint256 | fee percentage in basis points |
_supportsPoolAppInterface
Checks if address supports the pool app interface.
function _supportsPoolAppInterface(address pool) private view returns (bool);
_getStorage
Retrieves the storage for the MureFee contract.
function _getStorage() private pure returns (MureFeeStorage storage $);
_authorizeUpgrade
required by the OZ UUPS module
function _authorizeUpgrade(address) internal override onlyOwner;
Events
FeeConfigSet
event FeeConfigSet(
address indexed poolApp, string poolName, uint16 indexed feePercentage, address indexed feeRecipient
);
Structs
MureFeeStorage
Note: storage-location: erc7201:mure.MureFee
struct MureFeeStorage {
address defaultFeeRecipient;
uint16 defaultFeePercentage;
mapping(bytes32 => PoolFeeConfig) poolFee;
}