@@ -4,17 +4,17 @@ pragma solidity ^0.8.0;
4
4
import "./helpers/Constants.sol " ;
5
5
import "../lib/forge-std/src/Test.sol " ;
6
6
import {MorphoChainlinkOracleV2} from "../src/morpho-chainlink/MorphoChainlinkOracleV2.sol " ;
7
- import "../src/wsteth-exchange-rate-adapter/WstEthEthExchangeRateChainlinkAdapter .sol " ;
7
+ import "../src/wsteth-exchange-rate-adapter/WstEthStEthExchangeRateChainlinkAdapter .sol " ;
8
8
9
- contract WstEthEthExchangeRateChainlinkAdapterTest is Test {
10
- IWstEth internal constant WST_ETH = IWstEth ( 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 );
9
+ contract WstEthStEthExchangeRateChainlinkAdapterTest is Test {
10
+ IStEth internal constant ST_ETH = IStEth ( 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 );
11
11
12
- WstEthEthExchangeRateChainlinkAdapter internal adapter;
12
+ WstEthStEthExchangeRateChainlinkAdapter internal adapter;
13
13
MorphoChainlinkOracleV2 internal morphoOracle;
14
14
15
15
function setUp () public {
16
16
vm.createSelectFork (vm.envString ("ETH_RPC_URL " ));
17
- adapter = new WstEthEthExchangeRateChainlinkAdapter ( address (WST_ETH) );
17
+ adapter = new WstEthStEthExchangeRateChainlinkAdapter ( );
18
18
morphoOracle = new MorphoChainlinkOracleV2 (
19
19
vaultZero, 1 , AggregatorV3Interface (address (adapter)), feedZero, 18 , vaultZero, 1 , feedZero, feedZero, 18
20
20
);
@@ -25,19 +25,14 @@ contract WstEthEthExchangeRateChainlinkAdapterTest is Test {
25
25
}
26
26
27
27
function testDescription () public {
28
- assertEq (adapter.description (), "wstETH/ETH exchange rate " );
29
- }
30
-
31
- function testDeployZeroAddress () public {
32
- vm.expectRevert (bytes (ErrorsLib.ZERO_ADDRESS));
33
- new WstEthEthExchangeRateChainlinkAdapter (address (0 ));
28
+ assertEq (adapter.description (), "wstETH/stETH exchange rate " );
34
29
}
35
30
36
31
function testLatestRoundData () public {
37
32
(uint80 roundId , int256 answer , uint256 startedAt , uint256 updatedAt , uint80 answeredInRound ) =
38
33
adapter.latestRoundData ();
39
34
assertEq (roundId, 0 );
40
- assertEq (uint256 (answer), WST_ETH. stEthPerToken ( ));
35
+ assertEq (uint256 (answer), ST_ETH. getPooledEthByShares ( 1 ether ));
41
36
assertEq (startedAt, 0 );
42
37
assertEq (updatedAt, 0 );
43
38
assertEq (answeredInRound, 0 );
@@ -49,7 +44,7 @@ contract WstEthEthExchangeRateChainlinkAdapterTest is Test {
49
44
assertLe (uint256 (answer), 1.5e18 ); // Max bounds of the exchange rate. Should work for a long enough time.
50
45
}
51
46
52
- function testOracleWstEthEthExchangeRate () public {
47
+ function testOracleWstEthStEthExchangeRate () public {
53
48
(, int256 expectedPrice ,,,) = adapter.latestRoundData ();
54
49
assertEq (morphoOracle.price (), uint256 (expectedPrice) * 10 ** (36 + 18 - 18 - 18 ));
55
50
}
0 commit comments