Omniscia Myso Finance Audit
ChainlinkBasicWithWbtc Code Style Findings
ChainlinkBasicWithWbtc Code Style Findings
CBW-01C: Inexplicable Price Methodology
Type | Severity | Location |
---|---|---|
Gas Optimization | ChainlinkBasicWithWbtc.sol:L37-L39 |
Description:
The ChainlinkBasicWithWbtc::getPriceOfToken
function contains special logic to assess the price of the wBTC
asset by converting it to its BTC
equivalent and then assessing the BTC
equivalent's price in USD
.
Example:
contracts/peer-to-peer/oracles/chainlink/ChainlinkBasicWithWbtc.sol
33function getPriceOfToken(34 address token35) internal view override(ChainlinkBasic) returns (uint256 tokenPriceRaw) {36 if (token == BASE_CURRENCY) {37 uint256 answer1 = checkAndReturnLatestRoundData(WBTC_BTC_ORACLE);38 uint256 answer2 = checkAndReturnLatestRoundData(BTC_USD_ORACLE);39 tokenPriceRaw = (answer1 * answer2) / BASE_CURRENCY_UNIT;40 } else {41 address oracleAddr = oracleAddrs[token];42 if (oracleAddr == address(0)) {43 revert Errors.NoOracle();44 }45 tokenPriceRaw = checkAndReturnLatestRoundData(oracleAddr);46 }47}
Recommendation:
We advise the wBTC / USD
Chainlink pair to be utilized instead, rendering the ChainlinkBasicWithWbtc
implementation redundant.
Alleviation (c740f7c6b5ebd365618fd2d7ea77370599e1ca11):
After discussions with the Myso Finance team, we have concluded that the blockchain they intend to deploy to does not support the specified oracle. As such, this exhibit is incorrect and thus inapplicable to the context of Myso Finance.