1
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
2
pragma solidity 0.8.21 ;
3
3
4
- import {IWstEth } from "./interfaces/IWstEth .sol " ;
4
+ import {IStEth } from "./interfaces/IStEth .sol " ;
5
5
import {MinimalAggregatorV3Interface} from "./interfaces/MinimalAggregatorV3Interface.sol " ;
6
6
7
7
import {ErrorsLib} from "./libraries/ErrorsLib.sol " ;
@@ -12,20 +12,21 @@ import {ErrorsLib} from "./libraries/ErrorsLib.sol";
12
12
/// @notice wstETH/ETH exchange rate price feed.
13
13
/// @dev This contract should only be used as price feed for `ChainlinkOracle`.
14
14
contract WstEthEthExchangeRateChainlinkAdapter is MinimalAggregatorV3Interface {
15
+ // @dev The calculated price has 18 decimals precision, whatever the value of `decimals`.
15
16
uint8 public constant decimals = 18 ;
16
17
string public constant description = "wstETH/ETH exchange rate " ;
17
18
18
- IWstEth public immutable WST_ETH ;
19
+ IStEth public immutable ST_ETH ;
19
20
20
- constructor (address wstEth ) {
21
- require (wstEth != address (0 ), ErrorsLib.ZERO_ADDRESS);
21
+ constructor (address stEth ) {
22
+ require (stEth != address (0 ), ErrorsLib.ZERO_ADDRESS);
22
23
23
- WST_ETH = IWstEth (wstEth );
24
+ ST_ETH = IStEth (stEth );
24
25
}
25
26
26
- /// @dev Silently overflows if `stEthPerToken` is greater than `type(int256).max`.
27
+ /// @dev Silently overflows if `getPooledEthByShares`'s return value is greater than `type(int256).max`.
27
28
function latestRoundData () external view returns (uint80 , int256 , uint256 , uint256 , uint80 ) {
28
- // It is assumed that `stEthPerToken ` returns a price with 18 decimals precision.
29
- return (0 , int256 (WST_ETH. stEthPerToken ( )), 0 , 0 , 0 );
29
+ // It is assumed that `getPooledEthByShares ` returns a price with 18 decimals precision.
30
+ return (0 , int256 (ST_ETH. getPooledEthByShares ( 1 ether )), 0 , 0 , 0 );
30
31
}
31
32
}
0 commit comments