# Incorrect redeemAmount Is Accounted Due To Not Accounting For The  Exchange Rate

Cork Protocol liquidation accounting treats Ct/Ds redeemAmount as RA without applying the exchange rate, mis-reserving redemption assets.

- Payout: Audit contest
- Severity: high
- Program: Cork Protocol
- Found by: 0x73696d616f
- Disclosed: 2024-08-22
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-08-cork-protocol-judging/issues/119
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-cork-protocol%3AH-4
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:precision-loss

**Target:** VaultLib/PsmLib/FlashSwapRouter liquidation accounting
**Root cause:** redeemAmount is denominated in Ct/Ds but is added directly to RA accounting without multiplying by the exchange rate (RA per CT+DS pair), so reserved RA is wrong.
**Steps:**
1. In `VaultLib.liquidateLp`, DS reserve is emptied and paired with CT returned from AMM to form redeemAmount (Ct/Ds units).
2. At VaultLib.sol#L390 the same redeemAmount is added to RA accounting without applying exchange rate.
3. RA reserved at L392 is therefore incorrect, mis-attributing withdrawable/redeemable RA.
4. Same unit mismatch recurs at PsmLib.sol#L122, FlashSwapRouter.sol#L368, VaultLib.sol#L331.
**How found:** Code reading of liquidation flow: noticed redeemAmount (Ct/Ds) was reused directly as an RA quantity, flagging a unit mismatch against the documented exchange rate.
**Insight:** When a protocol has an explicit exchange rate between share-like units (CT+DS) and underlying (RA), audit every accounting line for unit consistency—grep for variables reused across both denominations.

