Summary
RAACMinter.sol::setFeeCollector() doesn't allow the feeCollector to be set to address(0) which is confusing, since in RAACToken.sol::setFeeCollector() address(0) is allowed, so the fees can be disabled.
Vulnerability Details
In RAACMinter.sol::setFeeCollector() the function does not allow setting the _feeCollector to address(0), but RAACToken.sol::setFeeCollector() allows it.
* @dev Sets the fee collector address
* @param _feeCollector The address of the new fee collector
* @notice Only the contract owner can call this function
* @notice This function updates the fee collector address in the RAAC token contract
*/
function setFeeCollector(address _feeCollector) external onlyRole(UPDATER_ROLE) {
if (_feeCollector == address(0)) revert FeeCollectorCannotBeZeroAddress();
raacToken.setFeeCollector(_feeCollector);
emit ParameterUpdated("feeCollector", uint256(uint160(_feeCollector)));
}
* @dev Sets the fee collector address
* @param _feeCollector The address of the new fee collector
*/
function setFeeCollector(address _feeCollector) external onlyOwner {
if(feeCollector == address(0) && _feeCollector != address(0)){
emit FeeCollectionEnabled(_feeCollector);
}
if (_feeCollector == address(0)){
emit FeeCollectionDisabled();
}
feeCollector = _feeCollector;
emit FeeCollectorSet(_feeCollector);
}
Impact
Fee collection cannot be disabled from RAACMinter.sol, even though RAACToken.sol allows it.
Tools Used
Manual
Recommendations
Remove the address(0) check in RAACMinter.sol.
/**
* @dev Sets the fee collector address
* @param _feeCollector The address of the new fee collector
* @notice Only the contract owner can call this function
* @notice This function updates the fee collector address in the RAAC token contract
*/
function setFeeCollector(address _feeCollector) external onlyRole(UPDATER_ROLE) {
// @audit _feeCollector should be able to be set to address(0) as described in
// RAACToken::setFeeCollector(), but right now it cannot.
// workaround is to call RAACToken::setFeeCollector() directly.
- if (_feeCollector == address(0)) revert FeeCollectorCannotBeZeroAddress();
raacToken.setFeeCollector(_feeCollector);
emit ParameterUpdated("feeCollector", uint256(uint160(_feeCollector)));
}