1
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
2
pragma solidity 0.8.21 ;
3
3
4
+ import {IChainlinkOracle} from "./interfaces/IChainlinkOracle.sol " ;
4
5
import {IOracle} from "../lib/morpho-blue/src/interfaces/IOracle.sol " ;
5
6
6
7
import {AggregatorV3Interface, ChainlinkDataFeedLib} from "./libraries/ChainlinkDataFeedLib.sol " ;
@@ -12,27 +13,32 @@ import {Math} from "../lib/openzeppelin-contracts/contracts/utils/math/Math.sol"
12
13
/// @author Morpho Labs
13
14
/// @custom:contact [email protected]
14
15
/// @notice Morpho Blue oracle using Chainlink-compliant feeds.
15
- contract ChainlinkOracle is IOracle {
16
+ contract ChainlinkOracle is IChainlinkOracle {
16
17
using Math for uint256 ;
17
18
using VaultLib for IERC4626 ;
18
19
using ChainlinkDataFeedLib for AggregatorV3Interface;
19
20
20
21
/* IMMUTABLES */
21
22
22
- /// @notice Vault.
23
+ /// @inheritdoc IChainlinkOracle
23
24
IERC4626 public immutable VAULT;
24
- /// @notice Vault conversion sample. The sample amount of shares used to convert to the underlying asset.
25
- /// @notice Should be chosen such that converting `VAULT_CONVERSION_SAMPLE` to assets has enough precision.
25
+
26
+ /// @inheritdoc IChainlinkOracle
26
27
uint256 public immutable VAULT_CONVERSION_SAMPLE;
27
- /// @notice First base feed.
28
+
29
+ /// @inheritdoc IChainlinkOracle
28
30
AggregatorV3Interface public immutable BASE_FEED_1;
29
- /// @notice Second base feed.
31
+
32
+ /// @inheritdoc IChainlinkOracle
30
33
AggregatorV3Interface public immutable BASE_FEED_2;
31
- /// @notice First quote feed.
34
+
35
+ /// @inheritdoc IChainlinkOracle
32
36
AggregatorV3Interface public immutable QUOTE_FEED_1;
33
- /// @notice Second quote feed.
37
+
38
+ /// @inheritdoc IChainlinkOracle
34
39
AggregatorV3Interface public immutable QUOTE_FEED_2;
35
- /// @notice Price scale factor, computed at contract creation.
40
+
41
+ /// @inheritdoc IChainlinkOracle
36
42
uint256 public immutable SCALE_FACTOR;
37
43
38
44
/* CONSTRUCTOR */
@@ -50,7 +56,9 @@ contract ChainlinkOracle is IOracle {
50
56
/// @param baseFeed2 Second base feed. Pass address zero if the price = 1.
51
57
/// @param quoteFeed1 First quote feed. Pass address zero if the price = 1.
52
58
/// @param quoteFeed2 Second quote feed. Pass address zero if the price = 1.
53
- /// @param vaultConversionSample Vault conversion sample. Pass 1 if the oracle does not use a vault.
59
+ /// @param vaultConversionSample The sample amount of vault shares used to convert to the underlying asset.
60
+ /// Pass 1 if the oracle does not use a vault. Should be chosen such that converting `vaultConversionSample` to
61
+ /// assets has enough precision.
54
62
/// @param baseTokenDecimals Base token decimals.
55
63
/// @param quoteTokenDecimals Quote token decimals.
56
64
constructor (
0 commit comments