diff --git a/.gitmodules b/.gitmodules index 3f53fcf..1020b31 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std -[submodule "lib/chainlink"] - path = lib/chainlink - url = https://github.com/smartcontractkit/chainlink [submodule "lib/morpho-blue"] path = lib/morpho-blue url = https://github.com/morpho-labs/morpho-blue diff --git a/lib/chainlink b/lib/chainlink deleted file mode 160000 index 6163d14..0000000 --- a/lib/chainlink +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6163d1432ad6a6c64db25c82fca941762ad4a29c diff --git a/lib/morpho-blue b/lib/morpho-blue index 7d60ca0..fa7e34b 160000 --- a/lib/morpho-blue +++ b/lib/morpho-blue @@ -1 +1 @@ -Subproject commit 7d60ca06e827780115d90508339de5560be9f643 +Subproject commit fa7e34bbc0d80c24143ceb416d831cc6311859ca diff --git a/src/chainlink/interfaces/AggregatorV3Interface.sol b/src/chainlink/interfaces/AggregatorV3Interface.sol new file mode 100644 index 0000000..e12ac3e --- /dev/null +++ b/src/chainlink/interfaces/AggregatorV3Interface.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/// @dev From +/// https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol. +interface AggregatorV3Interface { + function decimals() external view returns (uint8); + + function description() external view returns (string memory); + + function version() external view returns (uint256); + + function getRoundData(uint80 _roundId) + external + view + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); + + function latestRoundData() + external + view + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); +} diff --git a/src/chainlink/libraries/DataFeedLib.sol b/src/chainlink/libraries/DataFeedLib.sol index c3b5086..01344c5 100644 --- a/src/chainlink/libraries/DataFeedLib.sol +++ b/src/chainlink/libraries/DataFeedLib.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import {ErrorsLib} from "./ErrorsLib.sol"; -import {AggregatorV3Interface} from "chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; +import {AggregatorV3Interface} from "../interfaces/AggregatorV3Interface.sol"; library DataFeedLib { /// @dev Performing some security checks and returns the latest price of a feed. diff --git a/test/chainlink/OracleTwoFeedsTest.sol b/test/chainlink/OracleTwoFeedsTest.sol index 93c5b63..8124e4c 100644 --- a/test/chainlink/OracleTwoFeedsTest.sol +++ b/test/chainlink/OracleTwoFeedsTest.sol @@ -68,7 +68,7 @@ contract OracleTwoFeedsTest is Test { } function testNegativeAnswer(int256 price) public { - vm.assume(price < 0); + price = bound(price, type(int256).min, -1); FakeAggregator aggregator = new FakeAggregator(); OracleTwoFeeds oracle = new OracleTwoFeeds(AggregatorV3Interface(address(aggregator)), AggregatorV3Interface(address(0)), 18, 0);