Acidic Raspberry Rook
Medium
In Dao collateral, the code swap is:
function swap(address rwaToken, uint256 amount, uint256 minAmountOut)
public
nonReentrant
whenSwapNotPaused
whenNotPaused
{
uint256 wadQuoteInUSD = _swapCheckAndGetUSDQuote(rwaToken, amount);
// Check if the amount is greater than the minAmountOut
if (wadQuoteInUSD < minAmountOut) {
revert AmountTooLow();
}
_transferRWATokenAndMintStable(rwaToken, amount, wadQuoteInUSD);
// Emit the event
emit Swap(msg.sender, rwaToken, amount, wadQuoteInUSD);
}
the check below is missing, this means that even a rwa token is disabled user can still mint the token out.
// check that rwaToken is a RWA token
if (!_daoCollateralStorageV0().tokenMapping.isUsd0Collateral(rwaToken)) {
revert InvalidToken();
}
add the check to swap function as well.
// check that rwaToken is a RWA token
if (!_daoCollateralStorageV0().tokenMapping.isUsd0Collateral(rwaToken)) {
revert InvalidToken();
}