Skip to content

Commit 6aca70e

Browse files
authored
Add getters for immutables for LsETH and rETH (#863)
* getters for LsETH and rETH * test for getters for lsETH/rETH/stETH
1 parent 03b66f6 commit 6aca70e

File tree

9 files changed

+94
-1
lines changed

9 files changed

+94
-1
lines changed

contracts/src/instances/lseth/LsETHTarget0.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ contract LsETHTarget0 is HyperdriveTarget0, LsETHBase {
3030

3131
/// Getters ///
3232

33+
/// @notice Gets the LsETH token contract.
34+
/// @return The LsETH token contract.
35+
function lsEth() external view returns (IRiverV1) {
36+
_revert(abi.encode(_river));
37+
}
38+
3339
/// @notice Returns the MultiToken's decimals.
3440
/// @return The MultiToken's decimals.
3541
function decimals() external pure override returns (uint8) {

contracts/src/instances/reth/RETHTarget0.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ contract RETHTarget0 is HyperdriveTarget0, RETHBase {
3131

3232
/// Getters ///
3333

34+
/// @notice Gets the Rocket Storage contract.
35+
/// @return The Rocket Storage contract.
36+
function rocketStorage() external view returns (IRocketStorage) {
37+
_revert(abi.encode(_rocketStorage));
38+
}
39+
40+
/// @notice Gets the Rocket Token rETH contract.
41+
/// @return The Rocket Token rETH contract.
42+
function rocketTokenRETH() external view returns (IRocketTokenRETH) {
43+
_revert(abi.encode(_rocketTokenReth));
44+
}
45+
3446
/// @notice Returns the MultiToken's decimals.
3547
/// @return The MultiToken's decimals.
3648
function decimals() external pure override returns (uint8) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity 0.8.20;
3+
4+
import { IHyperdrive } from "./IHyperdrive.sol";
5+
import { IRETHHyperdriveRead } from "./IRETHHyperdriveRead.sol";
6+
7+
interface IRETHHyperdrive is IHyperdrive, IRETHHyperdriveRead {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity 0.8.20;
3+
4+
import { IHyperdriveRead } from "./IHyperdriveRead.sol";
5+
import { IRocketStorage } from "./IRocketStorage.sol";
6+
import { IRocketTokenRETH } from "./IRocketTokenRETH.sol";
7+
8+
interface IRETHHyperdriveRead is IHyperdriveRead {
9+
/// @notice Gets the Rocket Storage contract.
10+
/// @return The Rocket Storage contract.
11+
function rocketStorage() external view returns (IRocketStorage);
12+
13+
/// @notice Gets the Rocket Token rETH contract.
14+
/// @return The Rocket Token rETH contract.
15+
function rocketTokenRETH() external view returns (IRocketTokenRETH);
16+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity 0.8.20;
3+
4+
import { IHyperdrive } from "../IHyperdrive.sol";
5+
import { ILsETHHyperdriveRead } from "./ILsETHHyperdriveRead.sol";
6+
7+
interface ILsETHHyperdrive is IHyperdrive, ILsETHHyperdriveRead {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity 0.8.20;
3+
4+
import { IHyperdriveRead } from "../IHyperdriveRead.sol";
5+
import { IRiverV1 } from "./IRiverV1.sol";
6+
7+
interface ILsETHHyperdriveRead is IHyperdriveRead {
8+
/// @notice Gets the LsETH token contract.
9+
/// @return The LsETH token contract.
10+
function lsEth() external view returns (IRiverV1);
11+
}

test/instances/lseth/LsETHHyperdrive.t.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { LsETHTarget3Deployer } from "contracts/src/deployers/lseth/LsETHTarget3
1313
import { LsETHTarget4Deployer } from "contracts/src/deployers/lseth/LsETHTarget4Deployer.sol";
1414
import { IERC20 } from "contracts/src/interfaces/IERC20.sol";
1515
import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol";
16+
import { ILsETHHyperdrive } from "contracts/src/interfaces/lseth/ILsETHHyperdrive.sol";
1617
import { IRiverV1 } from "contracts/src/interfaces/lseth/IRiverV1.sol";
1718
import { AssetId } from "contracts/src/libraries/AssetId.sol";
1819
import { ETH } from "contracts/src/libraries/Constants.sol";
@@ -220,6 +221,15 @@ contract LsETHHyperdriveTest is HyperdriveTest {
220221
vm.recordLogs();
221222
}
222223

224+
/// Getters ///
225+
226+
function test_getters() external {
227+
assertEq(
228+
address(ILsETHHyperdrive(address(hyperdrive)).lsEth()),
229+
address(RIVER)
230+
);
231+
}
232+
223233
/// Deploy and Initialize ///
224234

225235
function test__lseth__deployAndInitialize() external {

test/instances/reth/RETHHyperdrive.t.sol

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import { HyperdriveTest } from "test/utils/HyperdriveTest.sol";
1212
import { HyperdriveUtils } from "test/utils/HyperdriveUtils.sol";
1313
import { IERC20 } from "contracts/src/interfaces/IERC20.sol";
1414
import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol";
15-
import { IRocketPoolDAOProtocolSettingsDeposit } from "contracts/src/interfaces/IRocketPoolDAOProtocolSettingsDeposit.sol";
15+
import { IRETHHyperdrive } from "contracts/src/interfaces/IRETHHyperdrive.sol";
1616
import { IRocketDepositPool } from "contracts/src/interfaces/IRocketDepositPool.sol";
1717
import { IRocketNetworkBalances } from "contracts/src/interfaces/IRocketNetworkBalances.sol";
18+
import { IRocketPoolDAOProtocolSettingsDeposit } from "contracts/src/interfaces/IRocketPoolDAOProtocolSettingsDeposit.sol";
1819
import { IRocketStorage } from "contracts/src/interfaces/IRocketStorage.sol";
1920
import { IRocketTokenRETH } from "contracts/src/interfaces/IRocketTokenRETH.sol";
2021
import { Lib } from "test/utils/Lib.sol";
@@ -247,6 +248,19 @@ contract RETHHyperdriveTest is HyperdriveTest {
247248
vm.recordLogs();
248249
}
249250

251+
/// Getters ///
252+
253+
function test_getters() external {
254+
assertEq(
255+
address(IRETHHyperdrive(address(hyperdrive)).rocketStorage()),
256+
address(ROCKET_STORAGE)
257+
);
258+
assertEq(
259+
address(IRETHHyperdrive(address(hyperdrive)).rocketTokenRETH()),
260+
address(rocketTokenRETH)
261+
);
262+
}
263+
250264
/// Deploy and Initialize ///
251265

252266
function test__reth__deployAndInitialize() external {

test/instances/steth/StETHHyperdrive.t.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { HyperdriveFactory } from "contracts/src/factory/HyperdriveFactory.sol";
1313
import { IERC20 } from "contracts/src/interfaces/IERC20.sol";
1414
import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol";
1515
import { ILido } from "contracts/src/interfaces/ILido.sol";
16+
import { IStETHHyperdrive } from "contracts/src/interfaces/IStETHHyperdrive.sol";
1617
import { AssetId } from "contracts/src/libraries/AssetId.sol";
1718
import { ETH } from "contracts/src/libraries/Constants.sol";
1819
import { FixedPointMath, ONE } from "contracts/src/libraries/FixedPointMath.sol";
@@ -216,6 +217,15 @@ contract StETHHyperdriveTest is HyperdriveTest {
216217
vm.recordLogs();
217218
}
218219

220+
/// Getters ///
221+
222+
function test_getters() external {
223+
assertEq(
224+
address(IStETHHyperdrive(address(hyperdrive)).lido()),
225+
address(LIDO)
226+
);
227+
}
228+
219229
/// Deploy and Initialize ///
220230

221231
function test__steth__deployAndInitialize__asBase() external {

0 commit comments

Comments
 (0)