@@ -8,10 +8,11 @@ import {AggregatorV3Interface} from "../interfaces/AggregatorV3Interface.sol";
8
8
/// @author Morpho Labs
9
9
/// @custom:contact [email protected]
10
10
/// @notice wstETH/ETH exchange rate price feed.
11
+ /// @dev This contract should only be used as price feed for `ChainlinkOracle`.
11
12
contract WstEthOracle is AggregatorV3Interface {
12
- uint256 public constant version = 1 ;
13
- uint8 public constant DECIMALS = uint8 (18 );
13
+ uint8 public constant decimals = uint8 (18 );
14
14
string public constant description = "wstETH/ETH exchange rate price " ;
15
+ uint256 public constant version = 1 ;
15
16
16
17
IStETH public immutable ST_ETH;
17
18
@@ -20,18 +21,13 @@ contract WstEthOracle is AggregatorV3Interface {
20
21
ST_ETH = IStETH (stEth);
21
22
}
22
23
23
- function decimals () external pure returns (uint8 ) {
24
- return DECIMALS;
25
- }
26
-
27
24
function getRoundData (uint80 ) external view returns (uint80 , int256 , uint256 , uint256 , uint80 ) {
28
25
return latestRoundData ();
29
26
}
30
27
31
28
function latestRoundData () public view returns (uint80 , int256 , uint256 , uint256 , uint80 ) {
32
- uint256 ethByShares = ST_ETH.getPooledEthByShares (10 ** DECIMALS );
29
+ uint256 ethByShares = ST_ETH.getPooledEthByShares (10 ** decimals () );
33
30
require (ethByShares < type (uint256 ).max, "WstEthOracle: OVERFLOW " );
34
- int256 answer = int256 (ethByShares);
35
- return (0 , answer, 0 , 0 , 0 );
31
+ return (0 , int256 (ethByShares), 0 , 0 , 0 );
36
32
}
37
33
}
0 commit comments