ValuationModule

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "contracts/interfaces/modules/IValuationModule.sol": {
      "content": "pragma solidity 0.8.21;\r
\r
interface IValuationModule {\r
    function portfolioValue() external view returns (uint256);\r
\r
    function onDeposit(uint256 assets) external;\r
\r
    function onWithdraw(uint256 assets) external;\r
\r
    function updatePortfolioValue(uint256 newValue) external;\r
\r
    function setFee(uint256 newFee) external;\r
\r
    function claimFee() external returns (uint256);\r
\r
    function feeAccrued() external view returns (uint256);\r
}\r
"
    },
    "contracts/modules/ValuationModule.sol": {
      "content": "pragma solidity 0.8.21;\r
import {IValuationModule} from "../interfaces/modules/IValuationModule.sol";\r
\r
/// @title High-water-mark valuation and performance fee accrual module\r
/// @notice Tracks portfolio value and accrues performance fees above a high-water mark for a single Hook.\r
/// @dev\r
/// - All state changes are restricted to the configured Hook via onlyHook.\r
/// - Units are denominated in the underlying asset units used by the Vault behind the Hook.\r
/// - feePercent is expressed in basis points (BPS), where 10_000 = 100%.\r
contract ValuationModule is IValuationModule {\r
    /// @notice Authorized caller (the Hook) that drives valuation updates and fee accrual.\r
    /// @dev Immutable after construction.\r
    address public immutable hook;\r
\r
    /// @notice Performance fee percentage in basis points (BPS).\r
    /// @dev 10_000 = 100%. Applied only to gains above the current high-water mark.\r
    uint256 public feePercent = 0;\r
\r
    /// @notice Current high-water mark of the portfolio value.\r
    /// @dev Used to compute performance fees when portfolio value increases.\r
    uint256 public highWaterMark = 0;\r
\r
    /// @notice Accrued, unclaimed fee amount in asset units.\r
    uint256 public feeAccrued = 0;\r
\r
    /// @notice Basis points denominator.\r
    /// @dev 10_000 equals 100%.\r
    uint256 constant ONE_HUNDRED_PERCENT = 10000;\r
\r
    /// @notice Last reported portfolio value in asset units.\r
    /// @dev Updated on deposits, withdrawals, or explicit revaluation.\r
    uint256 public portfolioValue = 0;\r
\r
    /// @notice Create a valuation module tied to a specific Hook.\r
    /// @param _hook The Hook contract authorized to call this module.\r
    constructor(address _hook) {\r
        hook = _hook;\r
    }\r
\r
    /// @notice Restricts function access to the configured Hook only.\r
    modifier onlyHook() {\r
        require(msg.sender == hook, "Not hook");\r
        _;\r
    }\r
\r
    /// @notice Notify the module of an asset deposit increasing portfolio value.\r
    /// @param assets Amount of assets deposited (asset units).\r
    /// @dev Increases both portfolioValue and highWaterMark by assets.\r
    function onDeposit(uint256 assets) external onlyHook {\r
        portfolioValue += assets;\r
        highWaterMark += assets;\r
    }\r
\r
    /// @notice Notify the module of an asset withdrawal decreasing portfolio value.\r
    /// @param assets Amount of assets withdrawn (asset units).\r
    /// @dev Decreases both portfolioValue and highWaterMark by assets.\r
    function onWithdraw(uint256 assets) external onlyHook {\r
        portfolioValue -= assets;\r
        highWaterMark -= assets;\r
    }\r
\r
    /// @notice Update the portfolio value and accrue performance fees vs. the high-water mark.\r
    /// @param newValue New portfolio value in asset units.\r
    /// @dev\r
    /// - If newValue > highWaterMark, accrue fee on the delta and raise highWaterMark to newValue.\r
    /// - Always sets portfolioValue = newValue.\r
    function updatePortfolioValue(uint256 newValue) external onlyHook {\r
        if (newValue > highWaterMark) {\r
            feeAccrued +=\r
                ((newValue - highWaterMark) * feePercent) /\r
                ONE_HUNDRED_PERCENT;\r
            highWaterMark = newValue;\r
        }\r
        portfolioValue = newValue;\r
    }\r
\r
    /// @notice Claim all accrued fees and reset the accumulator.\r
    /// @return fee Amount of fees to be transferred by the caller (asset units).\r
    function claimFee() external onlyHook returns (uint256) {\r
        uint256 fee = feeAccrued;\r
        feeAccrued = 0;\r
        return fee;\r
    }\r
\r
    /// @notice Set the performance fee percentage (BPS).\r
    /// @param newFee New fee in basis points, where 10_000 = 100%.\r
    /// @dev No bounds checking; callers should validate acceptable ranges at a higher layer.\r
    function setFee(uint256 newFee) external onlyHook {\r
        feePercent = newFee;\r
    }\r
}\r
"
    }
  },
  "settings": {
    "evmVersion": "paris",
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "metadata": {
      "useLiteralContent": true
    }
  }
}}

Tags:
Factory|addr:0x92616c5abd01b734ef4035431acbbaeddc1ecb7b|verified:true|block:23654644|tx:0x258a137bf285b289fbc5ab503a5b8938cd25deeb2e6ea0a07866215ba16325a5|first_check:1761401220

Submitted on: 2025-10-25 16:07:01

Comments

Log in to comment.

No comments yet.