Skip to content

Commit 8d13031

Browse files
committed
refactor: simplify code
1 parent 282095c commit 8d13031

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/adapters/WstEthEthExchangeRateChainlinkAdapter.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ contract WstEthEthExchangeRateChainlinkAdapter is MinimalAggregatorV3Interface {
1515
uint8 public constant decimals = 18;
1616

1717
IWstEth public immutable WST_ETH;
18-
uint256 public immutable WSTETH_DECIMALS;
1918

2019
constructor(address wstEth) {
2120
require(wstEth != address(0), ErrorsLib.ZERO_ADDRESS);
2221

2322
WST_ETH = IWstEth(wstEth);
24-
WSTETH_DECIMALS = WST_ETH.decimals();
2523
}
2624

2725
function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) {
28-
uint256 answer = WST_ETH.stEthPerToken() * 10 ** (WSTETH_DECIMALS - decimals);
29-
return (0, int256(answer), 0, 0, 0);
26+
// It is assumed that `stEthPerToken` returns a price with 18 decimals precision.
27+
return (0, int256(WST_ETH.stEthPerToken()), 0, 0, 0);
3028
}
3129
}

src/interfaces/IWstEth.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
pragma solidity >=0.5.0;
33

44
interface IWstEth {
5-
function decimals() external view returns (uint8);
65
function stEthPerToken() external view returns (uint256);
76
}

0 commit comments

Comments
 (0)