Core Contracts

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

Fee Types Documentation vs Implementation Mismatch in Fee Collector

Description

The FeeCollector contract contains a misleading documentation for fee types. While the contract implementation properly handles 8 different fee types (0-7), each with distinct distribution parameters, the code comments suggest these are separate elements rather than clarifying that each fee type is a configuration of the same 4 share parameters (veRAACShare, burnShare, repairShare, treasuryShare).

/**
* Fee types (0-7):
* 0: Protocol Fees - General operations
* 1: Lending Fees - Lending/borrowing activities
* 2: Performance Fees - Yield products
* 3: Insurance Fees - NFT loan insurance
* 4: Mint/Redeem Fees - Token operations
* 5: Vault Fees - Vault management
* 6: Swap Tax - Trading operations
* 7: NFT Royalties - NFT transactions
*/
mapping(uint8 => FeeType) public feeTypes;

The comment structure implies these are different fee components rather than clarifying that each type uses the same FeeType struct with different share configurations:

struct FeeType {
uint256 veRAACShare; // Basis points
uint256 burnShare; // Basis points
uint256 repairShare; // Basis points
uint256 treasuryShare; // Basis points
}

Impact

  • Misleading documentation could cause developer confusion

  • Risk of misunderstanding how fee types relate to distribution parameters

  • Potential integration errors if developers misinterpret fee type structure

  • Reduced code maintainability due to unclear documentation

Proof of Concept

The actual implementation in _initializeFeeTypes() shows how each fee type is really a configuration of the same 4 parameters:

function _initializeFeeTypes() internal {
// Protocol Fees: 80% to veRAAC holders, 20% to treasury
feeTypes[0] = FeeType({
veRAACShare: 8000, // 80%
burnShare: 0,
repairShare: 0,
treasuryShare: 2000 // 20%
});
// Different configuration for Swap Tax
feeTypes[6] = FeeType({
veRAACShare: 500, // 0.5%
burnShare: 500, // 0.5%
repairShare: 1000, // 1.0%
treasuryShare: 0
});
// And so on for other types...
}

Fix Recommendation

Update the documentation to clearly explain the relationship between fee types and distribution parameters:

/**
* @notice Fee management state
* @dev Maps fee type IDs to their distribution parameters using FeeType struct
*
* Each fee type (0-7) represents a different protocol activity with its own
* distribution configuration across 4 share parameters:
* - veRAACShare: Percentage for veRAAC holders
* - burnShare: Percentage for token burning
* - repairShare: Percentage for repair fund
* - treasuryShare: Percentage for treasury
*
* Fee type configurations:
* 0: Protocol Fees
* (80% veRAAC, 20% treasury)
* 1: Lending Fees
* (70% veRAAC, 30% treasury)
* 2: Performance Fees
* (60% veRAAC, 40% treasury)
* 3: Insurance Fees
* (50% veRAAC, 20% repair, 30% treasury)
* 4: Mint/Redeem Fees
* (60% veRAAC, 20% repair, 20% treasury)
* 5: Vault Fees
* (70% veRAAC, 30% treasury)
* 6: Swap Tax
* (0.5% veRAAC, 0.5% burn, 1% repair)
* 7: NFT Royalties
* (0.5% veRAAC, 1% repair, 0.5% treasury)
*/
mapping(uint8 => FeeType) public feeTypes;

Tools Used

  • Manual code review

  • Documentation analysis

  • Contract implementation verification

Recommendations

  1. Update documentation to clearly explain the relationship between fee types and FeeType struct

  2. Add distribution percentages to the fee type documentation

  3. Consider adding constants for fee type IDs to improve code readability

  4. Add validation functions to verify fee type configurations

  5. Consider adding events that show full fee type configurations when changes are made

Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Fee shares for fee type 6 and 7 inside FeeCollector do not total up to the expected 10000 basis points, this leads to update problems, moreover they are 10x the specifications

Support

FAQs

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