Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Invalid

QA and Low in BoostController

  1. Inconsistent Naming:

    • In the removeBoostDelegation function, the event emitted is DelegationRemoved, which is good. However, in the delegateBoost function, the event emitted is BoostDelegated. For consistency, consider renaming BoostDelegated to DelegationCreated or BoostDelegationCreated.

    // filepath: /Users/mihajlorudenko/projects/sandbox/2025-02-raac/contracts/core/governance/boost/BoostController.sol
    ...existing code...
    emit BoostDelegated(msg.sender, to, amount, duration);
    ...

    Recommendation: Rename the BoostDelegated event to BoostDelegationCreated for consistency.

  2. Redundant Check in modifySupportedPool:

    • The require statement if (supportedPools[pool] == isSupported) revert PoolNotSupported(); should be revert PoolAlreadySupported() or revert PoolSupportStatusUnchanged().

    // filepath: /Users/mihajlorudenko/projects/sandbox/2025-02-raac/contracts/core/governance/boost/BoostController.sol
    function modifySupportedPool(address pool, bool isSupported) external onlyRole(MANAGER_ROLE) {
    if (pool == address(0)) revert InvalidPool();
    if (supportedPools[pool] == isSupported) revert PoolNotSupported();
    supportedPools[pool] = isSupported;
    if (isSupported) {
    emit PoolAdded(pool);
    } else {
    emit PoolRemoved(pool);
    }
    }

    Recommendation: Change the revert reason to PoolSupportStatusUnchanged().

  3. Magic Number:

    • In the updateUserBoost function, the base amount 10000 is hardcoded.

    // filepath: /Users/mihajlorudenko/projects/sandbox/2025-02-raac/contracts/core/governance/boost/BoostController.sol
    function updateUserBoost(address user, address pool) external override nonReentrant whenNotPaused {
    ...existing code...
    uint256 newBoost = _calculateBoost(user, pool, 10000); // Base amount
    ...
    }

    Recommendation: Consider defining this as a constant for better readability and maintainability.

    // filepath: /Users/mihajlorudenko/projects/sandbox/2025-02-raac/contracts/core/governance/boost/BoostController.sol
    uint256 public constant BASE_AMOUNT = 10000;
    function updateUserBoost(address user, address pool) external override nonReentrant whenNotPaused {
    ...existing code...
    uint256 newBoost = _calculateBoost(user, pool, BASE_AMOUNT); // Base amount
    ...
    }
  4. Missing Events:

    • Consider emitting an event when boost delegation is removed by the delegator, not just the recipient. This provides more transparency.

Gas Optimization Considerations:

  • Unnecessary Reads: In removeBoostDelegation, poolBoosts[msg.sender] is read, but msg.sender is the address that delegated to, not the pool.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.