Skip to content

Commit

Permalink
docs: comments improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD committed Oct 3, 2023
1 parent f06c212 commit 1994aca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/chainlink/Oracle2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract Oracle2 is IOracle {
AggregatorV3Interface public immutable BASE_FEED;
/// @notice Quote feed.
AggregatorV3Interface public immutable QUOTE_FEED;
/// @notice Price scale factor. Automatically computed at contract creation.
/// @notice Price scale factor, computed at contract creation.
uint256 public immutable SCALE_FACTOR;

/* CONSTRUCTOR */
Expand All @@ -25,8 +25,8 @@ contract Oracle2 is IOracle {
/// @param quoteTokenDecimals Quote token decimals. Pass 0 if the price = 1.
constructor(
AggregatorV3Interface baseFeed,
uint256 baseTokenDecimals,
AggregatorV3Interface quoteFeed,
uint256 baseTokenDecimals,
uint256 quoteTokenDecimals
) {
BASE_FEED = baseFeed;
Expand Down
4 changes: 2 additions & 2 deletions src/chainlink/Oracle4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract Oracle4 is IOracle {
AggregatorV3Interface public immutable FIRST_QUOTE_FEED;
/// @notice Second quote feed.
AggregatorV3Interface public immutable SECOND_QUOTE_FEED;
/// @notice Price scale factor. Automatically computed at contract creation.
/// @notice Price scale factor, computed at contract creation.
uint256 public immutable SCALE_FACTOR;

/* CONSTRUCTOR */
Expand All @@ -27,7 +27,7 @@ contract Oracle4 is IOracle {
/// @param secondBaseFeed Second base feed. Pass address zero if the price = 1.
/// @param firstQuoteFeed Quote feed. Pass address zero if the price = 1.
/// @param secondQuoteFeed Quote feed. Pass address zero if the price = 1.
/// @param baseTokenDecimals Base token decimals.
/// @param baseTokenDecimals Base token decimals. Pass 0 if the price = 1.
/// @param quoteTokenDecimals Quote token decimals. Pass 0 if the price = 1.
constructor(
AggregatorV3Interface firstBaseFeed,
Expand Down
6 changes: 3 additions & 3 deletions src/chainlink/libraries/DataFeedLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import {ErrorsLib} from "./ErrorsLib.sol";
import {AggregatorV3Interface} from "chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

library DataFeedLib {
/// @dev Performing some security checks and returns the lateste price of a feed.
/// @dev When feed is the address zero, returns 1.
/// @dev Performing some security checks and returns the latest price of a feed.
/// @dev When `feed` is the address zero, returns 1.
function getPrice(AggregatorV3Interface feed) internal view returns (uint256) {
if (address(feed) == address(0)) return 1;
(, int256 answer,,,) = feed.latestRoundData();
require(answer >= 0, ErrorsLib.NEGATIVE_ANSWER);
return uint256(answer);
}

/// @dev Returns feed.decimals() if feed != address(0), else returns 0.
/// @dev Returns `feed.decimals()` when `feed` is not the address zero, else returns 0.
function getDecimals(AggregatorV3Interface feed) internal view returns (uint256) {
if (address(feed) == address(0)) return 0;
return feed.decimals();
Expand Down

0 comments on commit 1994aca

Please sign in to comment.