The RAACNFT.sol contract relies on the tokenToHousePrice(_tokenId) function from RAACHousePrices.sol to determine the minting price of an NFT. However, this function does not provide a timestamp for the last update, leading to the risk of using stale price data if the Chainlink Functions update is delayed or fails.
The mint() function in RAACNFT.sol retrieves the NFT price using raac_hp.tokenToHousePrice(_tokenId). This function does not return a timestamp, meaning there is no way to verify whether the price is fresh or outdated. If Chainlink Functions fail to update the price in time, users may mint NFTs at an outdated price, which can lead to financial discrepancies.
A better alternative exists within RAACHousePrices.sol: the getLatestPrice(_tokenId) function, which returns both the latest price and the last update timestamp. However, the mint() function does not currently use this function, leading to potential stale data usage.
If the price update from Chainlink Functions is delayed or fails, the contract may allow minting at outdated prices, leading to:
Potential underpricing or overpricing of NFTs.
Financial loss for users or the protocol.
Exploitable opportunities if stale prices favor certain users.
Manual review
Modify the mint() function in RAACNFT.sol to use getLatestPrice(_tokenId) instead of tokenToHousePrice(_tokenId). Additionally, introduce a MAX_STALE_TIME constant to define the maximum allowable staleness for the price before rejecting the transaction. This ensures that only fresh price data is used, mitigating risks related to stale Chainlink Function responses.
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.