Omniscia Myso Finance Audit
OlympusOracle Code Style Findings
OlympusOracle Code Style Findings
OOE-01C: Misleading Contract Setup
Type | Severity | Location |
---|---|---|
Code Style | OlympusOracle.sol:L36 |
Description:
The OlympusOracle::constructor
is meant to assign the ETH_OHM_ORACLE_ADDR
oracle to the gOHM
asset (GOHM_ADDR
) to ensure the conversion mechanism within OlympusOracle::getPrice
works as expected, however, the OHM_ADDR
variable is initialized instead.
Example:
contracts/peer-to-peer/oracles/chainlink/OlympusOracle.sol
17address internal constant OHM_ADDR =18 0x0ab87046fBb341D058F17CBC4c1133F25a20a52f;19address internal constant GOHM_ADDR =20 0x0ab87046fBb341D058F17CBC4c1133F25a20a52f;21uint256 internal constant SOHM_DECIMALS = 9;22address internal constant ETH_OHM_ORACLE_ADDR =23 0x9a72298ae3886221820B1c878d12D872087D3a23;24
25constructor(26 address[] memory _tokenAddrs,27 address[] memory _oracleAddrs28)29 ChainlinkBasic(30 _tokenAddrs,31 _oracleAddrs,32 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, // weth address33 1e18 // 18 decimals for ETH based oracles34 )35{36 oracleAddrs[OHM_ADDR] = ETH_OHM_ORACLE_ADDR;37}
Recommendation:
We advise the OHM_ADDR
variable to be omitted from the contract as it is misleading, pointing to the gOHM
address. The GOHM_ADDR
variable should be utilized in its place, greatly optimizing the legibility of the codebase.
Alleviation (c740f7c6b5ebd365618fd2d7ea77370599e1ca11):
The OHM_ADDR
variable has been safely omitted from the contract, rectifying any confusion that could arise from it and thus addressing this exhibit.