Oracle deployment for Morpho markets
-
To deploy a
MorphoChainlinkOracleV2
on Ethereum or any network, use theMorphoChainlinkOracleV2Factory
to create a new oracle. -
The
MorphoChainlinkOracleV2Factory
is functionning for any feeds that is respecting the Chainlink interface. TheSCALE_FACTOR
variable andprice()
function existing in the MorphoChainlinkOracleV2 are automatically computed at the creation via the factory. -
For custom oracles it is easier to implement the custom feeds and use the factory directly.
1. Jump on the oracle factory contract
See the address section.
E.g: Ethereum mainnet address is 0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766
2. Fill all attributes
On the createMorphoChainlinkOracleV2
function :
-
baseVault
: The ERC4626 token vault for the base asset. -
baseVaultConversionSample
: A sample amount for converting base vault units. -
baseFeed1
,baseFeed2
: Chainlink-interface-compliant data feeds for the base asset. -
baseTokenDecimals
: Decimal precision of the base asset. See the note below for more information. -
quoteVault
: The ERC4626 token vault for the quote asset. -
quoteVaultConversionSample
: A sample amount for converting quote vault units. -
quoteFeed1
,quoteFeed2
: Chainlink-interface-compliant data feeds for the quote asset. -
quoteTokenDecimals
: Decimal precision of the quote asset. See the note below for more information. -
salt
: A unique identifier to create deterministic addresses for deployed oracles.- If there is an ERC4626-compliant vault for
baseVault
orquoteVault
, thebaseTokenDecimals
orquoteTokenDecimals
are still the decimals of the asset in the vault, and not the decimals of the Vault asset. E.g: for a Morpho WETH vault, asbaseVault
, thebaseTokenDecimals
is 18 as WETH has 18 decimals. - It is encouraged to use
0x
for the salt value at creation time. Note that if an oracle with the same parameters has already been deployed, the transaction will revert. If that's the case, it's recommended do use the deployed oracle. Do not hesitate to reach out on discord to get the address.
- If there is an ERC4626-compliant vault for
1. WETH/USDT oracle
- `baseVault`: "0x0000000000000000000000000000000000000000",
- `baseVaultConversionSample`: 1,
- `baseFeed1`: "0x0000000000000000000000000000000000000000",
- `baseFeed2`: "0x0000000000000000000000000000000000000000",
- `baseTokenDecimals`: 18,
- `quoteVault`:"0x0000000000000000000000000000000000000000",
- `quoteVaultConversionSample`: 1,
- `quoteFeed1`: "0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46",
- `quoteFeed2`: "0x0000000000000000000000000000000000000000",
- `quoteTokenDecimals`: 6,
- `salt`: "0x",
2. sDAI/USDC oracle
- `baseVault`: "0x83F20F44975D03b1b09e64809B757c47f942BEeA",
- `baseVaultConversionSample`: 1000000000000000000, // 1e18
- `baseFeed1`: "0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9",
- `baseFeed2`: "0x0000000000000000000000000000000000000000",
- `baseTokenDecimals`: 18,
- `quoteVault`: "0x0000000000000000000000000000000000000000",
- `quoteVaultConversionSample`: 1,
- `quoteFeed1`: "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6",
- `quoteFeed2`: "0x0000000000000000000000000000000000000000",
- `quoteTokenDecimals`: 6,
- `salt`: "0x",
3. wstETH/ETH oracle
As stated in this section, the WstEthStEthExchangeRateChainlinkAdapter
provides the exchange rate between wstETH and stETH as a Chainlink-interface-compliant feed.
This adapter is deployed on Ethereum Mainnet at the address 0x905b7dAbCD3Ce6B792D874e303D336424Cdb1421.
- `baseVault`: "0x0000000000000000000000000000000000000000",
- `baseVaultConversionSample`: 1,
- `baseFeed1`: "0x905b7dAbCD3Ce6B792D874e303D336424Cdb1421",
- `baseFeed2`: "0x86392dC19c0b719886221c78AB11eb8Cf5c52812",
- `baseTokenDecimals`: 18,
- `quoteVault`: "0x0000000000000000000000000000000000000000",
- `quoteVaultConversionSample`: 1,
- `quoteFeed1`: "0x0000000000000000000000000000000000000000",
- `quoteFeed2`: "0x0000000000000000000000000000000000000000",
- `quoteTokenDecimals`: 18,
- `salt`: "0x",
3. Sign the transaction
You are done.