Multiple liquidation-related functions in AlchemistV3 (_forceRepay, _liquidate, and _doLiquidation) fail to update the global _mytSharesDeposited variable after transferring MYT tokens out of the contract. This creates a permanent accounting inflation where _mytSharesDeposited exceeds the actual MYT token balance held by the protocol. This inflation corrupts the Total Value Locked (TVL) calculation used in critical solvency checks, potentially allowing the protocol to bypass emergency liquidation protections during market stress events.
Root Cause
The protocol maintains _mytSharesDeposited as a tracking variable for the total MYT (yield token shares) held by the Alchemist contract. This value is used in _getTotalUnderlyingValue() to calculate the protocol's TVL, which feeds into global collateralization checks.
The invariant that must be maintained:
_mytSharesDeposited == actual MYT token balance held by Alchemist
if (alchemistCurrentCollateralization < alchemistMinimumCollateralization) {
// Force FULL liquidation in emergency low-collateralization state
return (debt, debt, 0, outsourcedFee);
}
// Line 862
uint256 alchemistCurrentCollateralization =
normalizeUnderlyingTokensToDebt(_getTotalUnderlyingValue()) * FIXED_POINT_SCALAR / totalDebt;
// Line 1239 (_getTotalUnderlyingValue)
uint256 yieldTokenTVLInUnderlying = convertYieldTokensToUnderlying(_mytSharesDeposited);
- User creates position: 200e18 collateral
- User borrows max debt: 180e18 (at 90% LTV)
- Create transmuter redemption to enable earmarking
- Advance blocks to earmark 60% of debt
- Drop collateral price by ~5.9% to trigger undercollateralization
- Call liquidate(accountId)
- This internally calls:
* _liquidate()
→ _forceRepay() for earmarked debt
→ _doLiquidation() for remaining debt
MYT Token Flows:
- To Liquidator: 1.14e18 (fee)
- To Transmuter: 0 (in this scenario)
- To Protocol Fee: 0 (insufficient balance scenario)
- Total transferred OUT: 1.14e18
_mytSharesDeposited update: NONE ❌
Result:
- Actual MYT balance decreased by ~115.5e18 total
(114.37e18 used for debt burn + 1.14e18 transferred out)
- _mytSharesDeposited unchanged
- Inflation created: 1.14e18
Reported TVL (using _mytSharesDeposited): 377.7e18
Actual TVL (using actual balance): 268.6e18
Artificial Inflation: 109.0e18 (40.6%!)