2
2
pragma solidity ^ 0.8.0 ;
3
3
4
4
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 " ;
7
7
8
8
AggregatorV3Interface constant feedZero = AggregatorV3Interface (address (0 ));
9
9
// 8 decimals of precision
@@ -43,8 +43,7 @@ contract ChainlinkOracleTest is Test {
43
43
}
44
44
45
45
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 );
48
47
(, int256 firstBaseAnswer ,,,) = wBtcBtcFeed.latestRoundData ();
49
48
(, int256 secondBaseAnswer ,,,) = btcUsdFeed.latestRoundData ();
50
49
(, int256 quoteAnswer ,,,) = usdcUsdFeed.latestRoundData ();
@@ -56,8 +55,7 @@ contract ChainlinkOracleTest is Test {
56
55
}
57
56
58
57
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 );
61
59
(, int256 baseAnswer ,,,) = usdcUsdFeed.latestRoundData ();
62
60
(, int256 firstQuoteAnswer ,,,) = wBtcBtcFeed.latestRoundData ();
63
61
(, int256 secondQuoteAnswer ,,,) = btcUsdFeed.latestRoundData ();
@@ -69,8 +67,7 @@ contract ChainlinkOracleTest is Test {
69
67
}
70
68
71
69
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 );
74
71
(, int256 firstBaseAnswer ,,,) = wBtcBtcFeed.latestRoundData ();
75
72
(, int256 secondBaseAnswer ,,,) = btcEthFeed.latestRoundData ();
76
73
assertEq (oracle.price (), (uint256 (firstBaseAnswer) * uint256 (secondBaseAnswer) * 10 ** (36 + 18 - 8 - 8 - 18 )));
0 commit comments