The constructor of the DSCEngine
contract takes arrays of token addresses and price feed addresses as input but does not validate if these addresses are non-zero. This could lead to potential issues if invalid addresses are provided.
The constructor of the DSCEngine
contract accepts two arrays: tokenAddresses
and priceFeedAddresses
. These arrays are used to initialize the s_priceFeeds
mapping and s_collateralTokens
array. However, there is no validation to check if these addresses are non-zero. Providing a zero address (which is an invalid address in the Ethereum network) could lead to unexpected behavior in the contract's operation.
In DSCEngine
contract:
If a zero address is provided as a token address or price feed address, it could lead to incorrect price feed data being used in the contract's operation. This could potentially affect the calculation of collateral value, health factor, and other critical operations, leading to incorrect minting, burning, or liquidation actions.
Manual code review
To mitigate this issue, add input validation to check if the provided addresses are non-zero. This can be done using a simple condition check in the constructor. Here is an example of how this could be implemented:
This will ensure that only valid addresses are used to initialize the contract.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.