when ReserveBase undercollateralized , Manager.orders will not be able to execute
Summary
Manager.sol does not take into account that reserve.redeemPrice may be less than 1:1
The current code, reserve.redeem(amount) followed by a direct transfer of the same USDC, will fail because it results in an insufficient balance and the order will not be triggered successfully
If balance order.interfaceFee.unwrap=true, need to convert DSU to USDC
Use reserve.redeem(amount);
But this method, in the case of undercollateralized, is possible to convert less than amount, but the current code implementation logic directly uses amount.
/// @inheritdoc IReserve
function redeemPrice() public view returns (UFixed18) {
// if overcollateralized, cap at 1:1 redemption / if undercollateralized, redeem pro-rata
return assets().unsafeDiv(dsu.totalSupply()).min(UFixed18Lib.ONE);
}
function _unwrapAndWithdaw(address receiver, UFixed18 amount) private {
reserve.redeem(amount);
USDC.push(receiver, UFixed6Lib.from(amount));
}
Internal pre-conditions
No response
External pre-conditions
XXXReserve.sol undercollateralized
Attack Path
alice place TriggerOrder[1] = {price < 123 , interfaceFee.unwrap=true}
bin2chen
Medium
when ReserveBase undercollateralized , Manager.orders will not be able to execute
Summary
Manager.sol
does not take into account thatreserve.redeemPrice
may be less than 1:1 The current code,reserve.redeem(amount)
followed by a direct transfer of the same USDC, will fail because it results in an insufficient balance and the order will not be triggered successfullyRoot Cause
in Manager.sol:219
If balance
order.interfaceFee.unwrap=true
, need to convertDSU
toUSDC
Usereserve.redeem(amount);
But this method, in the case ofundercollateralized
, is possible to convert less thanamount
, but the current code implementation logic directly usesamount
.Internal pre-conditions
No response
External pre-conditions
Attack Path
TriggerOrder[1] = {price < 123 , interfaceFee.unwrap=true}
executeOrder(TriggerOrder[1])
, but execute fail because revert Insufficient balanceImpact
No response
PoC
No response
Mitigation