Skip to content

Commit d0c8fee

Browse files
committed
fix: safecast on unit price feed
1 parent 396eb72 commit d0c8fee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/misc/UnitPriceFeed.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
pragma solidity 0.8.28;
44

55
import {AggregatorV3Interface} from 'src/dependencies/chainlink/AggregatorV3Interface.sol';
6+
import {SafeCast} from 'src/dependencies/openzeppelin/SafeCast.sol';
67

78
/// @title UnitPriceFeed contract
89
/// @author Aave Labs
910
/// @notice Price feed that returns the unit price (1), with decimals precision.
1011
/// @dev This price feed can be set for reserves that use the base currency as collateral.
1112
contract UnitPriceFeed is AggregatorV3Interface {
13+
using SafeCast for uint256;
14+
1215
/// @inheritdoc AggregatorV3Interface
1316
uint8 public immutable decimals;
1417

@@ -23,7 +26,7 @@ contract UnitPriceFeed is AggregatorV3Interface {
2326
constructor(uint8 decimals_, string memory description_) {
2427
decimals = decimals_;
2528
description = description_;
26-
_units = int256(10 ** decimals_);
29+
_units = (10 ** decimals_).toInt256();
2730
}
2831

2932
/// @inheritdoc AggregatorV3Interface

0 commit comments

Comments
 (0)