Description:Description\
In CvgOracle.sol, the state variable WETH is set to a hardcoded value representing the WETH address on Ethereum mainnet. This means that the contract is incompatible with all other EVM chains, and even if it is not intended to be deployed elsewhere at the present time, it is still best practice to avoid hardcoded addresses to ensure contracts are future proof.
Attack Scenario\
WETH address will be incorrect on any chain other than mainnet, meaning CvgOracle is unable to fetch ETH price, severely limiting the usability of the oracle and introducing consequences in other areas of the protocol that rely on the oracle.
Github username: @Madalad Submission hash (on-chain): 0xbed8d2273ee6cc1b0945acab6754aaeb375053d1a205281e4ef38ab6082368c9 Severity: low
Description: Description\ In CvgOracle.sol, the state variable
WETH
is set to a hardcoded value representing the WETH address on Ethereum mainnet. This means that the contract is incompatible with all other EVM chains, and even if it is not intended to be deployed elsewhere at the present time, it is still best practice to avoid hardcoded addresses to ensure contracts are future proof.Attack Scenario\
WETH
address will be incorrect on any chain other than mainnet, meaningCvgOracle
is unable to fetch ETH price, severely limiting the usability of the oracle and introducing consequences in other areas of the protocol that rely on the oracle.Line of code: https://github.com/Cvg-Finance/hats-audit/blob/main/contracts/Oracles/CvgOracle.sol#L35
Recommendation\ Pass the WETH address as a parameter in the constructor of
CvgOracle
, and change theWETH
state variable fromconstant
toimmutable
: