Description
The AaveDIVAWrapper contract lacks a mechanism to pause operations for specific collateral tokens in emergency scenarios. Once a token is registered, operations with that token can only be stopped by pausing the entire contract or through contract redeployment.
Current implementation has no per-token pause functionality:
https://github.com/Cyfrin/2025-01-diva/blob/main/contracts/src/AaveDIVAWrapperCore.sol#L71
function _registerCollateralToken(address _collateralToken) internal returns (address) {
_collateralTokenToWToken[_collateralToken] = _wToken;
_wTokenToCollateralToken[_wToken] = _collateralToken;
}
function _handleTokenOperations(address _collateralToken, uint256 _collateralAmount, address _wToken) private {
IERC20Metadata(_collateralToken).safeTransferFrom(...);
IAave(_aaveV3Pool).supply(...);
IWToken(_wToken).mint(...);
}
Impact
Critical scenarios requiring immediate token suspension:
Token contract compromise discovered
Aave protocol issues with specific token
Suspicious activity patterns detected
Token upgrade complications
Market-wide token-specific issues
Recommended Fix
Add token-specific pause functionality:
contract AaveDIVAWrapperCore {
mapping(address => bool) public tokenPaused;
error TokenPaused(address token);
function pauseToken(address token) external onlyOwner {
tokenPaused[token] = true;
emit TokenPaused(token);
}
function unpauseToken(address token) external onlyOwner {
tokenPaused[token] = false;
emit TokenUnpaused(token);
}
function _handleTokenOperations(
address _collateralToken,
uint256 _collateralAmount,
address _wToken
) private {
if (tokenPaused[_collateralToken]) {
revert TokenPaused(_collateralToken);
}
}
function pauseTokens(address[] calldata tokens) external onlyOwner {
for (uint256 i = 0; i < tokens.length; i++) {
tokenPaused[tokens[i]] = true;
emit TokenPaused(tokens[i]);
}
}
}
The fix provides critical emergency control without requiring full protocol shutdown or redeployment.