Skip to content

Commit

Permalink
fix [HAL-03] unsafe type casting
Browse files Browse the repository at this point in the history
  • Loading branch information
nikakhachi committed Oct 1, 2024
1 parent 3afae1b commit 90b3c94
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/adapters/MorphoRUSDAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessContr

import {IERC4626} from "openzeppelin-contracts/contracts/interfaces/IERC4626.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {SafeCast} from "openzeppelin-contracts/contracts/utils/math/SafeCast.sol";

import {Stablecoin} from "../Stablecoin.sol";
import {IOracle} from "src/interfaces/IOracle.sol";
Expand Down Expand Up @@ -192,13 +193,13 @@ contract MorphoRUSDAdapter is IAssetAdapter, AccessControl {
{
int256 latestAnswer = underlyingPriceOracle.latestAnswer();

return latestAnswer > 0 ? uint256(latestAnswer) : 0;
return latestAnswer > 0 ? SafeCast.toUint256(latestAnswer) : 0;
}

function _fundPriceOracleLatestAnswer() private view returns (uint256) {
int256 latestAnswer = fundPriceOracle.latestAnswer();

return latestAnswer > 0 ? uint256(latestAnswer) : 0;
return latestAnswer > 0 ? SafeCast.toUint256(latestAnswer) : 0;
}

function recover(address _token) external onlyRole(MANAGER) {
Expand Down

0 comments on commit 90b3c94

Please sign in to comment.