# Insolvency as `YUSD` will depeg overtime as the redemption fees are disbursed with no collaterals backing them.

Aegis approveRedeemRequest sends full collateral backing yusdAmount to user while fee yUSD is transferred unbacked to insurance fund, slowly depegging YUSD.

- Payout: Audit contest
- Severity: high
- Program: Aegis Op Grant
- Found by: 0xNForcer
- Disclosed: 2025-04-26
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-04-aegis-op-grant-judging/issues/1
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-04-aegis-op-grant%3AH-1
- Tags: area:web3 domain:web3 impact:funds-loss impact:integrity kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** AegisMinting.approveRedeemRequest redemption flow
**Root cause:** approveRedeemRequest transfers collateralAmount computed from the full yusdAmount to the user, then transfers the fee portion of yUSD to the insurance fund without reducing the collateral payout, leaving the fee yUSD unbacked.
**Steps:**
1. User calls mint() with collateral, receiving yusdAmount backed 1:1 by collateral.
2. User submits redeem request for yusdAmount.
3. FUNDS_MANAGER calls approveRedeemRequest(requestId, amount).
4. Contract computes collateralAmount from full request.order.yusdAmount via _calculateRedeemMinCollateralAmount.
5. Contract transfers full collateralAmount to user, transfers fee yUSD to insuranceFundAddress, burns burnAmount.
6. Fee yUSD remains in circulation but its collateral was already paid out, so backing per yUSD decreases each redemption.
**How found:** Code review of approveRedeemRequest: noticed collateralAmount is derived from the full yusdAmount while the fee is carved out of yusdAmount afterward, so the fee portion is paid out in collateral but not burned.
**Exploitation:** Repeated redemptions with nonzero redeemFeeBP accumulate unbacked yUSD in the insurance fund; over time the collateral pool is depleted relative to outstanding yUSD, causing YUSD to depeg and the protocol to become insolvent.
**Escalation:** Higher redeemFeeBP (up to 50%) accelerates the unbacked fee accumulation and depeg.
**Insight:** In redemption flows, verify that the collateral payout is computed from the burned amount, not the gross amount, whenever a fee is skimmed from the same token being redeemed.

## Proof of concept (copied exactly from the original report)

**approveRedeemRequest fee/collateral accounting bug**

```
function approveRedeemRequest(string calldata requestId, uint256 amount) external nonReentrant onlyRole(FUNDS_MANAGER_ROLE) whenRedeemUnpaused {
    RedeemRequest storage request = _redeemRequests[keccak256(abi.encode(requestId))];
    if (request.timestamp == 0 || request.status != RedeemRequestStatus.PENDING) {
      revert InvalidRedeemRequest();
    }
    if (amount == 0 || amount > request.order.collateralAmount) {
      revert InvalidAmount();
    }

    uint256 collateralAmount = _calculateRedeemMinCollateralAmount(request.order.collateralAsset, amount, request.order.yusdAmount);
//code snip ... some checks.
    uint256 availableAssetFunds = _untrackedAvailableAssetBalance(request.order.collateralAsset);
    if (availableAssetFunds < collateralAmount) {
      revert NotEnoughFunds();
    }

    // Take a fee, if it's applicable
    // @audit  fee amount is taken without accounting for the collateral backing thereby leading to a depegging of the YUSD
    (uint256 burnAmount, uint256 fee) = _calculateInsuranceFundFeeFromAmount(request.order.yusdAmount, redeemFeeBP);
    if (fee > 0) {
      yusd.safeTransfer(insuranceFundAddress, fee);
    }

    request.status = RedeemRequestStatus.APPROVED;
    totalRedeemLockedYUSD -= request.order.yusdAmount;
   //@audit transfers the entire collateral amount to the user.
    IERC20(request.order.collateralAsset).safeTransfer(request.order.userWallet, collateralAmount);
    yusd.burn(burnAmount);

    emit ApproveRedeemRequest(requestId, _msgSender(), request.order.userWallet, request.order.collateralAsset, collateralAmount, burnAmount, fee);
  }
```

