Large Champagne Terrier
Medium
Missing slippage check in DaoCollateral.sol#redeemDao()
will cause loss of funds for admin as an attacker will manipulate price.
- In
DaoCollateral.sol#redeemDao()
there is no slippage check.
No response
No response
- The attacker sandwich admin's transaction which will cause loss of funds by manipulating price.
The admin suffers loss of funds from attacker's manipulating of price by sandwiching that transaction.
No response
We have to modify DaoCollateral.sol#redeemDao()
as follows.
- function redeemDao(address rwaToken, uint256 amount) external nonReentrant {
+ function redeemDao(address rwaToken, uint256 amount, uint256 minAmountOut) external nonReentrant {
// Amount can't be 0
if (amount == 0) {
revert AmountIsZero();
}
_requireOnlyAdmin();
// check that rwaToken is a RWA token
if (!_daoCollateralStorageV0().tokenMapping.isUsd0Collateral(rwaToken)) {
revert InvalidToken();
}
uint256 returnedCollateral = _burnStableTokenAndTransferCollateral(rwaToken, amount, 0);
+ if (returnedCollateral < minAmountOut) {
+ revert AmountTooLow();
+ }
emit Redeem(msg.sender, rwaToken, amount, returnedCollateral, 0);
}