The _processResponse
function in RAACHousePriceOracle
does not properly account for the price scaling factor applied in the Chainlink script. The script multiplies the house price by 100 to prevent precision issues, but the contract does not adjust for this, leading to incorrect price updates and potential misconfigurations.
The issue arises in the _processResponse
function, which decodes the price directly from the response without adjusting for the scaling factor:
Code Reference: https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/oracles/RAACHousePriceOracle.sol#L43
However, the Chainlink script applies a multiplication factor of 100 before encoding the price:
Code Reference: https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/chainlink-api/house-price-api.js#L48
Steps leading to the problem
The Chainlink script fetches the house price from an API.
Before returning the price, the script multiplies it by 100 to maintain precision.
The contract receives the response but does not divide the price by 100 before storing it.
As a result, the stored house price is 100 times larger than expected, leading to inaccurate price settings.
Incorrect House Prices: The house prices stored in the contract will be 100 times larger than the actual intended values.
Financial Misconfigurations: Any contracts relying on these prices may experience incorrect calculations, leading to financial discrepancies.
Manual Review
By dividing the received price by 100, the contract ensures that the stored price matches the expected real-world value.
To resolve this issue, the contract should adjust the price before storing it in setHousePrice
:
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.