This repository has been archived by the owner on Dec 22, 2024. It is now read-only.
mstpr-brainbot - Minting stake tokens is not updating the pool's borrowing fee rate #136
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
mstpr-brainbot
High
Minting stake tokens is not updating the pool's borrowing fee rate
Summary
When users mint new stake tokens, they provide liquidity to the pool, increasing the total amount and decreasing the borrowed utilization. However, this rate is not updated.
Vulnerability Detail
When users mint stake tokens, they add liquidity to the pool and increase the total amount held in the pool:
As we can see, the borrowing rate calculation will change accordingly. However, the rate is not updated:
Impact
Unfair accrual of borrowing fees. It can yield on lesser/higher fees for lps and position holders. It can also delay or cause unfair liquidations. Hence, high.
Code Snippet
https://github.com/sherlock-audit/2024-05-elfi-protocol/blob/8a1a01804a7de7f73a04d794bf6b8104528681ad/elfi-perp-contracts/contracts/process/MintProcess.sol#L45-L91
https://github.com/sherlock-audit/2024-05-elfi-protocol/blob/8a1a01804a7de7f73a04d794bf6b8104528681ad/elfi-perp-contracts/contracts/process/MintProcess.sol#L130-L213
https://github.com/sherlock-audit/2024-05-elfi-protocol/blob/8a1a01804a7de7f73a04d794bf6b8104528681ad/elfi-perp-contracts/contracts/process/MarketQueryProcess.sol#L82C5-L108
Tool used
Manual Review
Recommendation
Just like the opening orders update the rates after the pools base amounts changes.
The text was updated successfully, but these errors were encountered: