Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/misc/UnitPriceFeed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
pragma solidity 0.8.28;

import {AggregatorV3Interface} from 'src/dependencies/chainlink/AggregatorV3Interface.sol';
import {SafeCast} from 'src/dependencies/openzeppelin/SafeCast.sol';

/// @title UnitPriceFeed contract
/// @author Aave Labs
/// @notice Price feed that returns the unit price (1), with decimals precision.
/// @dev This price feed can be set for reserves that use the base currency as collateral.
contract UnitPriceFeed is AggregatorV3Interface {
using SafeCast for uint256;

/// @inheritdoc AggregatorV3Interface
uint8 public immutable decimals;

Expand All @@ -23,7 +26,7 @@ contract UnitPriceFeed is AggregatorV3Interface {
constructor(uint8 decimals_, string memory description_) {
decimals = decimals_;
description = description_;
_units = int256(10 ** decimals_);
_units = (10 ** decimals_).toInt256();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kinda unnecessary bc this is a one time fn and if any overflow the contract can be discarded. would be more in favour if this was fixing a run time unsafe cast

}

/// @inheritdoc AggregatorV3Interface
Expand Down
Loading