Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
During liquidation flows forceRepay, liquidate, and _doLiquidation, the protocol properly transfers the corresponding MYT tokens from the user’s position and adjusts their collateral and debt balances.
However, the accounting variable mytSharesDeposited which tracks the total amount of MYT shares a user has deposited into the system is not updated or reduced when a liquidation occurs.
This causes a state inconsistency between actual MYT balances and recorded accounting values. Even though the user’s MYT tokens are transferred out of their position to the transmuter, liquidator, mytSharesDeposited remains unchanged.
Vulnerability Details
/// @dev Total yield tokens deposited/// This is used to differentiate between tokens deposited into a CDP and balance of the contractuint256private _mytSharesDeposited;//private
The forceRepay, liquidate, and _doLiquidation functions modify collateral and debt state but never decrement the corresponding user’s mytSharesDeposited or any equivalent share tracking variable after liquidating MYT tokens. This omission allows mytSharesDeposited to remain inflated despite the actual shares being removed from the system.
Impact Details
this can lead to several potential issues:
Accounting drift: system assumes more collateralized MYT shares than actually exist.
Potential mis-calculations.
Misleading TVL.
Recommended mitigation
update mytSharesDeposited aftera successful liquidation or forcerepay.