diff --git a/src/chainlink/ChainlinkOracle.sol b/src/ChainlinkOracle.sol similarity index 92% rename from src/chainlink/ChainlinkOracle.sol rename to src/ChainlinkOracle.sol index 196e2c6..1ae9c81 100644 --- a/src/chainlink/ChainlinkOracle.sol +++ b/src/ChainlinkOracle.sol @@ -3,10 +3,10 @@ pragma solidity 0.8.19; import {IOracle} from "morpho-blue/interfaces/IOracle.sol"; -import {AggregatorV3Interface, DataFeedLib} from "./libraries/DataFeedLib.sol"; +import {AggregatorV3Interface, ChainlinkDataFeedLib} from "./libraries/ChainlinkDataFeedLib.sol"; contract ChainlinkOracle is IOracle { - using DataFeedLib for AggregatorV3Interface; + using ChainlinkDataFeedLib for AggregatorV3Interface; /* CONSTANT */ diff --git a/src/chainlink/interfaces/AggregatorV3Interface.sol b/src/interfaces/AggregatorV3Interface.sol similarity index 100% rename from src/chainlink/interfaces/AggregatorV3Interface.sol rename to src/interfaces/AggregatorV3Interface.sol diff --git a/src/chainlink/libraries/DataFeedLib.sol b/src/libraries/ChainlinkDataFeedLib.sol similarity index 96% rename from src/chainlink/libraries/DataFeedLib.sol rename to src/libraries/ChainlinkDataFeedLib.sol index 54c85a3..268d702 100644 --- a/src/chainlink/libraries/DataFeedLib.sol +++ b/src/libraries/ChainlinkDataFeedLib.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {ErrorsLib} from "./ErrorsLib.sol"; import {AggregatorV3Interface} from "../interfaces/AggregatorV3Interface.sol"; -library DataFeedLib { +library ChainlinkDataFeedLib { /// @dev Performs some safety 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) { diff --git a/src/chainlink/libraries/ErrorsLib.sol b/src/libraries/ErrorsLib.sol similarity index 100% rename from src/chainlink/libraries/ErrorsLib.sol rename to src/libraries/ErrorsLib.sol diff --git a/test/chainlink/ChainlinkOracleTest.sol b/test/chainlink/ChainlinkOracleTest.sol index bcbe74f..576112c 100644 --- a/test/chainlink/ChainlinkOracleTest.sol +++ b/test/chainlink/ChainlinkOracleTest.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.0; import "forge-std/Test.sol"; -import "src/chainlink/ChainlinkOracle.sol"; -import "src/chainlink/libraries/ErrorsLib.sol"; +import "src/ChainlinkOracle.sol"; +import "src/libraries/ErrorsLib.sol"; AggregatorV3Interface constant feedZero = AggregatorV3Interface(address(0)); // 8 decimals of precision @@ -43,8 +43,7 @@ contract ChainlinkOracleTest is Test { } function testOracleWbtcUsdc() public { - ChainlinkOracle oracle = - new ChainlinkOracle(wBtcBtcFeed, btcUsdFeed, usdcUsdFeed, feedZero, 8, 6); + ChainlinkOracle oracle = new ChainlinkOracle(wBtcBtcFeed, btcUsdFeed, usdcUsdFeed, feedZero, 8, 6); (, int256 firstBaseAnswer,,,) = wBtcBtcFeed.latestRoundData(); (, int256 secondBaseAnswer,,,) = btcUsdFeed.latestRoundData(); (, int256 quoteAnswer,,,) = usdcUsdFeed.latestRoundData(); @@ -56,8 +55,7 @@ contract ChainlinkOracleTest is Test { } function testOracleUsdcWbtc() public { - ChainlinkOracle oracle = - new ChainlinkOracle(usdcUsdFeed, feedZero, wBtcBtcFeed, btcUsdFeed, 6, 8); + ChainlinkOracle oracle = new ChainlinkOracle(usdcUsdFeed, feedZero, wBtcBtcFeed, btcUsdFeed, 6, 8); (, int256 baseAnswer,,,) = usdcUsdFeed.latestRoundData(); (, int256 firstQuoteAnswer,,,) = wBtcBtcFeed.latestRoundData(); (, int256 secondQuoteAnswer,,,) = btcUsdFeed.latestRoundData(); @@ -69,8 +67,7 @@ contract ChainlinkOracleTest is Test { } function testOracleWbtcEth() public { - ChainlinkOracle oracle = - new ChainlinkOracle(wBtcBtcFeed, btcEthFeed, feedZero, feedZero, 8, 18); + ChainlinkOracle oracle = new ChainlinkOracle(wBtcBtcFeed, btcEthFeed, feedZero, feedZero, 8, 18); (, int256 firstBaseAnswer,,,) = wBtcBtcFeed.latestRoundData(); (, int256 secondBaseAnswer,,,) = btcEthFeed.latestRoundData(); assertEq(oracle.price(), (uint256(firstBaseAnswer) * uint256(secondBaseAnswer) * 10 ** (36 + 18 - 8 - 8 - 18)));