Skip to content

Commit 0007653

Browse files
committed
refactor: repo structure
1 parent 2ce15dd commit 0007653

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

src/chainlink/ChainlinkOracle.sol renamed to src/ChainlinkOracle.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ pragma solidity 0.8.19;
33

44
import {IOracle} from "morpho-blue/interfaces/IOracle.sol";
55

6-
import {AggregatorV3Interface, DataFeedLib} from "./libraries/DataFeedLib.sol";
6+
import {AggregatorV3Interface, ChainlinkDataFeedLib} from "./libraries/ChainlinkDataFeedLib.sol";
77

88
contract ChainlinkOracle is IOracle {
9-
using DataFeedLib for AggregatorV3Interface;
9+
using ChainlinkDataFeedLib for AggregatorV3Interface;
1010

1111
/* CONSTANT */
1212

src/chainlink/libraries/DataFeedLib.sol renamed to src/libraries/ChainlinkDataFeedLib.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
44
import {ErrorsLib} from "./ErrorsLib.sol";
55
import {AggregatorV3Interface} from "../interfaces/AggregatorV3Interface.sol";
66

7-
library DataFeedLib {
7+
library ChainlinkDataFeedLib {
88
/// @dev Performs some safety checks and returns the latest price of a feed.
99
/// @dev When `feed` is the address zero, returns 1.
1010
function getPrice(AggregatorV3Interface feed) internal view returns (uint256) {
File renamed without changes.

test/chainlink/ChainlinkOracleTest.sol

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
pragma solidity ^0.8.0;
33

44
import "forge-std/Test.sol";
5-
import "src/chainlink/ChainlinkOracle.sol";
6-
import "src/chainlink/libraries/ErrorsLib.sol";
5+
import "src/ChainlinkOracle.sol";
6+
import "src/libraries/ErrorsLib.sol";
77

88
AggregatorV3Interface constant feedZero = AggregatorV3Interface(address(0));
99
// 8 decimals of precision
@@ -43,8 +43,7 @@ contract ChainlinkOracleTest is Test {
4343
}
4444

4545
function testOracleWbtcUsdc() public {
46-
ChainlinkOracle oracle =
47-
new ChainlinkOracle(wBtcBtcFeed, btcUsdFeed, usdcUsdFeed, feedZero, 8, 6);
46+
ChainlinkOracle oracle = new ChainlinkOracle(wBtcBtcFeed, btcUsdFeed, usdcUsdFeed, feedZero, 8, 6);
4847
(, int256 firstBaseAnswer,,,) = wBtcBtcFeed.latestRoundData();
4948
(, int256 secondBaseAnswer,,,) = btcUsdFeed.latestRoundData();
5049
(, int256 quoteAnswer,,,) = usdcUsdFeed.latestRoundData();
@@ -56,8 +55,7 @@ contract ChainlinkOracleTest is Test {
5655
}
5756

5857
function testOracleUsdcWbtc() public {
59-
ChainlinkOracle oracle =
60-
new ChainlinkOracle(usdcUsdFeed, feedZero, wBtcBtcFeed, btcUsdFeed, 6, 8);
58+
ChainlinkOracle oracle = new ChainlinkOracle(usdcUsdFeed, feedZero, wBtcBtcFeed, btcUsdFeed, 6, 8);
6159
(, int256 baseAnswer,,,) = usdcUsdFeed.latestRoundData();
6260
(, int256 firstQuoteAnswer,,,) = wBtcBtcFeed.latestRoundData();
6361
(, int256 secondQuoteAnswer,,,) = btcUsdFeed.latestRoundData();
@@ -69,8 +67,7 @@ contract ChainlinkOracleTest is Test {
6967
}
7068

7169
function testOracleWbtcEth() public {
72-
ChainlinkOracle oracle =
73-
new ChainlinkOracle(wBtcBtcFeed, btcEthFeed, feedZero, feedZero, 8, 18);
70+
ChainlinkOracle oracle = new ChainlinkOracle(wBtcBtcFeed, btcEthFeed, feedZero, feedZero, 8, 18);
7471
(, int256 firstBaseAnswer,,,) = wBtcBtcFeed.latestRoundData();
7572
(, int256 secondBaseAnswer,,,) = btcEthFeed.latestRoundData();
7673
assertEq(oracle.price(), (uint256(firstBaseAnswer) * uint256(secondBaseAnswer) * 10 ** (36 + 18 - 8 - 8 - 18)));

0 commit comments

Comments
 (0)