Closed codekoriko closed 2 weeks ago
Morpho | Borrow: WBTC / WETH
To get to the correct price it's: WETH Decimals + IOracle.SCALE_FACTOR() Decimals >> 28 + 18 = 46 ethers.utils.formatUnits(231526751276196240000000000000000000000000000000n, 46) >> correctly formatted price: 23.152675127619624
WETH Decimals + IOracle.SCALE_FACTOR() Decimals
ethers.utils.formatUnits(231526751276196240000000000000000000000000000000n, 46)
Morpho | Borrow: WBTC / USDT
To get to the correct price it's: WBTC Decimals + IOracle.SCALE_FACTOR() Decimals >> 26 + 8 = 34 ethers.utils.formatUnits(634191901421668523189305629876995670202n, 34) >> correctly formatted price: 63419.1901421668523189305629876995670202
WBTC Decimals + IOracle.SCALE_FACTOR() Decimals
ethers.utils.formatUnits(634191901421668523189305629876995670202n, 34)
To get to the correct price it's: WBTC Decimals + IOracle.SCALE_FACTOR() Decimals >> 24 + 0 = 24 ethers.utils.formatUnits(634191901421668523189305629876995670202n, 24) >> correctly formatted price: 64238.890625138135724857677952
ethers.utils.formatUnits(634191901421668523189305629876995670202n, 24)
Why is there those inconsistencies in the oracle price decimals?
How can I reliably get the correct price for every morpho market oracles? cause I suppose than morpho blue is able to do it somehow
Got it wrong, it's simply
IOracle.price() / (10 ** (loanTokenDecimals - collatTokenDecimals ))
I'm not sure what the IOracle.SCALE_FACTOR() was intended for though
Morpho | Borrow: WBTC / WETH
To get to the correct price it's:
WETH Decimals + IOracle.SCALE_FACTOR() Decimals
>> 28 + 18 = 46ethers.utils.formatUnits(231526751276196240000000000000000000000000000000n, 46)
>> correctly formatted price: 23.152675127619624Morpho | Borrow: WBTC / USDT
To get to the correct price it's:
WBTC Decimals + IOracle.SCALE_FACTOR() Decimals
>> 26 + 8 = 34ethers.utils.formatUnits(634191901421668523189305629876995670202n, 34)
>> correctly formatted price: 63419.1901421668523189305629876995670202Morpho | Borrow: WBTC / USDT
To get to the correct price it's:
WBTC Decimals + IOracle.SCALE_FACTOR() Decimals
>> 24 + 0 = 24ethers.utils.formatUnits(634191901421668523189305629876995670202n, 24)
>> correctly formatted price: 64238.890625138135724857677952Why is there those inconsistencies in the oracle price decimals?
How can I reliably get the correct price for every morpho market oracles? cause I suppose than morpho blue is able to do it somehow