Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

momo - Interest calculation #59

Open
sherlock-admin3 opened this issue Oct 21, 2024 · 0 comments
Open

momo - Interest calculation #59

sherlock-admin3 opened this issue Oct 21, 2024 · 0 comments

Comments

@sherlock-admin3
Copy link
Contributor

sherlock-admin3 commented Oct 21, 2024

momo

Medium

Interest calculation

Summary

interest accrued by totalBorrowAsset is the amount to pay back while interest by

     totalSupplyAsset is the amount gained by providing liquidity to the pool, however, 
     the function expectedMarketBalances uses the interest of only market.totalBorrowAssets 
     to calculate the interest of both market.totalBorrowAssets and  market.totalSupplyAssets in  
    line 45-47
        uint256 borrowRate = IIrm(marketParams.irm).borrowRateView(marketParams, market);
        uint256 interest = market.totalBorrowAssets.wMulDown(borrowRate.wTaylorCompounded(elapsed));
        market.totalBorrowAssets += interest.toUint128();
        market.totalSupplyAssets += interest.toUint128();

The calculated interest is then added to both totalBorrowAssets and totalSupplyAssets.

Root Cause

No response

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

mplications of This Logic
Incorrect Interest Attribution:
interest accrued on borrowed assets should not directly affect the total supply asset as they are distinct actions
with different risk profiles and financial implications.
Interest on borrow assets represents a cost to borrowers, while interest on supply assets
represents earnings for the liquidity provider of that position.
If both totalBorrowAssets and totalSupplyAssets are updated with the same interest amount, it could lead to misleading balances.

Risk of Economic Exploitation:
If users understand that they can manipulate the system by borrowing and causing inflated supply balances through this logic, it could lead to economic exploits or unintended consequences in how liquidity is managed within the platform.

Recommendations
Separate Interest Calculations:
Implement distinct calculations for interest on borrowed assets and supplied assets.
Clear Documentation:
Document how interest is calculated and attributed within the protocol clearly so that users understand how their balances are determined.

PoC

No response

Mitigation

No response

@sherlock-admin2 sherlock-admin2 changed the title Sparkly Fleece Mammoth - Interest calculation momo - Interest calculation Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant