@@ -49,20 +49,28 @@ contract ChainlinkOracleTest is Test {
49
49
}
50
50
51
51
function testLastRoundData () public {
52
- (uint80 roundId , int256 answer , uint256 startedAt , uint256 updatedAt , uint80 answeredInRound ) = oracle.latestRoundData ();
52
+ (uint80 roundId , int256 answer , uint256 startedAt , uint256 updatedAt , uint80 answeredInRound ) =
53
+ oracle.latestRoundData ();
53
54
assertEq (roundId, 0 );
54
- assertEq (answer, int256 ( ST_ETH.getPooledEthByShares (10 ** 18 ) ));
55
+ assertEq (uint256 ( answer), ST_ETH.getPooledEthByShares (10 ** 18 ));
55
56
assertEq (startedAt, 0 );
56
57
assertEq (updatedAt, 0 );
57
58
assertEq (answeredInRound, 0 );
58
59
}
59
60
60
61
function testGetLastRoundData () public {
61
- (uint80 roundId , int256 answer , uint256 startedAt , uint256 updatedAt , uint80 answeredInRound ) = oracle.getRoundData (1 );
62
+ (uint80 roundId , int256 answer , uint256 startedAt , uint256 updatedAt , uint80 answeredInRound ) =
63
+ oracle.getRoundData (1 );
62
64
assertEq (roundId, 0 );
63
- assertEq (answer, int256 ( ST_ETH.getPooledEthByShares (10 ** 18 ) ));
65
+ assertEq (uint256 ( answer), ST_ETH.getPooledEthByShares (10 ** 18 ));
64
66
assertEq (startedAt, 0 );
65
67
assertEq (updatedAt, 0 );
66
68
assertEq (answeredInRound, 0 );
67
69
}
70
+
71
+ function testLastRoundDataBounds () public {
72
+ (, int256 answer ,,,) = oracle.latestRoundData ();
73
+ assertGe (uint256 (answer), 1154690031824824994 ); // Exchange rate queried at block 19070943
74
+ assertLe (uint256 (answer), 1.5e18 ); // Max bounds of the exchange rate. Should work for a long enough time.
75
+ }
68
76
}
0 commit comments