Skip to content

Commit

Permalink
Merge pull request #82 from morpho-org/refactor/hardcode-steth
Browse files Browse the repository at this point in the history
Hardcode stETH address
  • Loading branch information
MathisGD authored Mar 5, 2024
2 parents ad5e168 + c46887b commit 9cc2150
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
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 [email protected]
Expand All @@ -15,14 +13,7 @@ contract WstEthEthExchangeRateChainlinkAdapter is MinimalAggregatorV3Interface {
// @dev The calculated price has 18 decimals precision, whatever the value of `decimals`.
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

0 comments on commit 9cc2150

Please sign in to comment.