Users are unable to redeem their full entitled RA amount if they only call redeemRaWithCt and do not also call redeemRaWithDs. This leads to locked funds that cannot be withdrawn.
Alternatively, develop logic to automatically call redeemRaWithDs if redeemRaWithCt was previously called alone, to ensure full RA entitlement can be withdrawn.
hunter_w3b
Medium
Inability to redeem remaining DS+PA after
redeemRaWithCt
call.Summary
The redeemRaWithCt function resets the RA balances, preventing any remaining RA from being redeemed if redeemRaWithDs is not also called.
Vulnerability Details
When
redeemRaWithCt
is called, it resets the RA balances to zero by calling_separateLiquidity
.Every call to
unlockTo
function will revert it.Impact
Users are unable to redeem their full entitled RA amount if they only call redeemRaWithCt and do not also call redeemRaWithDs. This leads to locked funds that cannot be withdrawn.
Code Snippet
https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/PsmLib.sol#L448C1-L471C6 https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/PsmLib.sol#L188 https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/libraries/PsmLib.sol#L346
Tool Used
Manual review
Recommendation
Alternatively, develop logic to automatically call redeemRaWithDs if redeemRaWithCt was previously called alone, to ensure full RA entitlement can be withdrawn.