Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcode stETH address #82

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ pragma solidity 0.8.21;
import {IStEth} from "./interfaces/IStEth.sol";
import {MinimalAggregatorV3Interface} from "./interfaces/MinimalAggregatorV3Interface.sol";

import {ErrorsLib} from "./libraries/ErrorsLib.sol";

/// @title WstEthEthExchangeRateChainlinkAdapter
/// @author Morpho Labs
/// @custom:contact security@morpho.org
Expand All @@ -14,14 +12,7 @@ import {ErrorsLib} from "./libraries/ErrorsLib.sol";
contract WstEthEthExchangeRateChainlinkAdapter is MinimalAggregatorV3Interface {
uint8 public constant decimals = 18;
string public constant description = "wstETH/ETH exchange rate";

IStEth public immutable ST_ETH;

constructor(address stEth) {
require(stEth != address(0), ErrorsLib.ZERO_ADDRESS);

ST_ETH = IStEth(stEth);
}
IStEth public constant ST_ETH = IStEth(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);

/// @dev Silently overflows if `getPooledEthByShares`'s return value is greater than `type(int256).max`.
function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) {
Expand Down
11 changes: 0 additions & 11 deletions src/wsteth-exchange-rate-adapter/libraries/ErrorsLib.sol

This file was deleted.

7 changes: 1 addition & 6 deletions test/WstEthEthExchangeRateChainlinkAdapterTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract WstEthEthExchangeRateChainlinkAdapterTest is Test {

function setUp() public {
vm.createSelectFork(vm.envString("ETH_RPC_URL"));
oracle = new WstEthEthExchangeRateChainlinkAdapter(address(ST_ETH));
oracle = new WstEthEthExchangeRateChainlinkAdapter();
chainlinkOracle = new ChainlinkOracle(
vaultZero, AggregatorV3Interface(address(oracle)), feedZero, feedZero, feedZero, 1, 18, 18
);
Expand All @@ -28,11 +28,6 @@ contract WstEthEthExchangeRateChainlinkAdapterTest is Test {
assertEq(oracle.description(), "wstETH/ETH exchange rate");
}

function testDeployZeroAddress() public {
vm.expectRevert(bytes(ErrorsLib.ZERO_ADDRESS));
new WstEthEthExchangeRateChainlinkAdapter(address(0));
}

function testLatestRoundData() public {
(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) =
oracle.latestRoundData();
Expand Down
Loading