Core Contracts

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

Boost calculator does not incorporate time weighted averages in its calculation

Summary

Boost calculation is done with the intent of using time weighted functions, however they are not used in the function definition.

This will lead to unexpected behavior when expecting time related details to affect Boost for users and the calculation for it

Vulnerability Details

function calculateTimeWeightedBoost(
BoostState storage state,
uint256 userBalance,
uint256 totalSupply,
uint256 amount
) internal view returns (uint256 boostBasisPoints, uint256 boostedAmount) {
if (totalSupply == 0 || amount == 0) {
return (0, amount);
}
// Create parameters struct for calculation
BoostParameters memory params = BoostParameters({
maxBoost: state.maxBoost,
minBoost: state.minBoost,
boostWindow: state.boostWindow,
totalWeight: state.totalWeight,
totalVotingPower: state.totalVotingPower,
votingPower: state.votingPower
});
// Get boost multiplier in basis points (e.g., 10000 = 1x, 25000 = 2.5x)
boostBasisPoints = calculateBoost(
userBalance,
totalSupply,
params
);
// Calculate boosted amount: amount * (boost / 10000)
boostedAmount = (amount * boostBasisPoints) / 10000;
return (boostBasisPoints, boostedAmount);
}
// Overloaded function for memory parameters (for testing)
function calculateTimeWeightedBoost(
BoostParameters memory params,
uint256 userBalance,
uint256 totalSupply,
uint256 amount
) internal pure returns (uint256 boostBasisPoints, uint256 boostedAmount) {
if (totalSupply == 0 || amount == 0) {
return (0, amount);
}
// Get boost multiplier in basis points (e.g., 10000 = 1x, 25000 = 2.5x)
boostBasisPoints = calculateBoost(
userBalance,
totalSupply,
params
);
// Calculate boosted amount: amount * (boost / 10000)
boostedAmount = (amount * boostBasisPoints) / 10000;
return (boostBasisPoints, boostedAmount);
}

We can see that it doesn't account for the time weight boost based on time but a regular calculation dependent on the Boost percentage

Impact

The time related effects won't affect the boost calculation and it will default on normal calculation instead of enforcing time related boosts or penalities.

Tools Used

manual analysis

Recommendations

Use time calculations like intervals with it

Updates

Lead Judging Commences

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

BoostCalculator::calculateTimeWeightedBoost misleadingly named as it performs simple ratio calculations without any time-weighted averaging despite having TWA functionality available

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

BoostCalculator::calculateTimeWeightedBoost misleadingly named as it performs simple ratio calculations without any time-weighted averaging despite having TWA functionality available

Support

FAQs

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