Skip to content

Commit 0908598

Browse files
committed
Merge branch 'refactor/repo' into feat/vault-quote
2 parents 2bb1191 + bf37d41 commit 0908598

14 files changed

+146
-26
lines changed

src/ChainlinkOracle.sol renamed to src/morpho-chainlink-v1/ChainlinkOracle.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
pragma solidity 0.8.21;
33

44
import {IChainlinkOracle} from "./interfaces/IChainlinkOracle.sol";
5-
import {IOracle} from "../lib/morpho-blue/src/interfaces/IOracle.sol";
5+
import {IOracle} from "../../lib/morpho-blue/src/interfaces/IOracle.sol";
66

77
import {AggregatorV3Interface, ChainlinkDataFeedLib} from "./libraries/ChainlinkDataFeedLib.sol";
88
import {IERC4626, VaultLib} from "./libraries/VaultLib.sol";
99
import {ErrorsLib} from "./libraries/ErrorsLib.sol";
10-
import {Math} from "../lib/openzeppelin-contracts/contracts/utils/math/Math.sol";
10+
import {Math} from "../../lib/openzeppelin-contracts/contracts/utils/math/Math.sol";
1111

1212
/// @title ChainlinkOracle
1313
/// @author Morpho Labs

src/interfaces/IChainlinkOracle.sol renamed to src/morpho-chainlink-v1/interfaces/IChainlinkOracle.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity >=0.5.0;
33

44
import {IERC4626} from "./IERC4626.sol";
55
import {AggregatorV3Interface} from "./AggregatorV3Interface.sol";
6-
import {IOracle} from "../../lib/morpho-blue/src/interfaces/IOracle.sol";
6+
import {IOracle} from "../../../lib/morpho-blue/src/interfaces/IOracle.sol";
77

88
/// @title IChainlinkOracle
99
/// @author Morpho Labs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
pragma solidity 0.8.21;
3+
4+
import {IWstEth} from "./interfaces/IWstEth.sol";
5+
import {MinimalAggregatorV3Interface} from "./interfaces/MinimalAggregatorV3Interface.sol";
6+
7+
import {ErrorsLib} from "./libraries/ErrorsLib.sol";
8+
9+
/// @title WstEthEthExchangeRateChainlinkAdapter
10+
/// @author Morpho Labs
11+
/// @custom:contact [email protected]
12+
/// @notice wstETH/ETH exchange rate price feed.
13+
/// @dev This contract should only be used as price feed for `ChainlinkOracle`.
14+
contract WstEthEthExchangeRateChainlinkAdapter is MinimalAggregatorV3Interface {
15+
uint8 public constant decimals = 18;
16+
string public constant description = "wstETH/ETH exchange rate";
17+
18+
IWstEth public immutable WST_ETH;
19+
20+
constructor(address wstEth) {
21+
require(wstEth != address(0), ErrorsLib.ZERO_ADDRESS);
22+
23+
WST_ETH = IWstEth(wstEth);
24+
}
25+
26+
function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) {
27+
// It is assumed that `stEthPerToken` returns a price with 18 decimals precision.
28+
return (0, int256(WST_ETH.stEthPerToken()), 0, 0, 0);
29+
}
30+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
pragma solidity >=0.5.0;
3+
4+
interface IWstEth {
5+
function stEthPerToken() external view returns (uint256);
6+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity >=0.5.0;
3+
4+
/// @dev Inspired by
5+
/// https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol
6+
interface MinimalAggregatorV3Interface {
7+
function decimals() external view returns (uint8);
8+
9+
function latestRoundData()
10+
external
11+
view
12+
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
13+
}

0 commit comments

Comments
 (0)