Core Contracts

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

User Interests not compounded unless user wants to deposit again

Overview

Currently when a user deposits, the mint operations attempts to get the balanceIncrease based on the liquidity Index so that the interests the user earned are registered and added to the amount.

function mint(
address caller,
address onBehalfOf,
uint256 amountToMint,
uint256 index
) external override onlyReservePool returns (bool, uint256, uint256, uint256) {
if (amountToMint == 0) {
return (false, 0, 0, 0);
}
uint256 amountScaled = amountToMint.rayDiv(index);
if (amountScaled == 0) revert InvalidAmount();
uint256 scaledBalance = balanceOf(onBehalfOf);
bool isFirstMint = scaledBalance == 0;
uint256 balanceIncrease = 0;
if (_userState[onBehalfOf].index != 0 && _userState[onBehalfOf].index < index) {
balanceIncrease = scaledBalance.rayMul(index) - scaledBalance.rayMul(_userState[onBehalfOf].index);
}
_userState[onBehalfOf].index = index.toUint128();
_mint(onBehalfOf, amountToMint.toUint128());
emit Mint(caller, onBehalfOf, amountToMint, index);
return (isFirstMint, amountToMint, totalSupply(), amountScaled);
}

As seen when a user deposits, the mint function checks if its first time, it then attempts to track interest earned based on the liquidity index so that the user’s balance reflects accrued interest.

However, what if the user deposits once and never tries to deposit again. this means that their initial deposit will earn some interests that will not have any compounding effect making them lose on the opportunity of making more.

POC

  • A user deposits 100 tokens into the protocol.

  • Over time, they earn 10 tokens in interest, but these are not added to their principal for further compounding.

  • If the user never deposits again, their balance remains 100 + 10 (uncompounded interest) instead of benefiting from continuous compounding.

Impact

More rewards lost

Recommendation

The protocol can periodically compound interest for all users by updating their balance based on the liquidity index.

Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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