Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Valid

Wrong Update Time Information While Fetching a RAAC Token Price

Vulnerability Details

In RAACHousePrices contract the setHousePrice function is used to set the price of a house via the Oracle. It updates the price of a RAAC token ID and then updates the global lastUpdateTimestamp variable to the current block timestamp. But this creates an issue in getLatestPrice since it returns the price of a house and the last updated time, which wrongfully would equal to the time of the last updated RAAC token ID.

function getLatestPrice(
uint256 _tokenId
) external view returns (uint256, uint256) {
return (tokenToHousePrice[_tokenId], lastUpdateTimestamp); <@
}
constructor(address initialOwner) Ownable(initialOwner) {}
/**
* @notice Allows the owner to set the house price for a token
* @param _tokenId The ID of the RAAC token
* @param _amount The price to set for the house in USD
*
* Updates timestamp for each token individually
*/
function setHousePrice(
uint256 _tokenId,
uint256 _amount
) external onlyOracle {
tokenToHousePrice[_tokenId] = _amount;
lastUpdateTimestamp = block.timestamp; <@
emit PriceUpdated(_tokenId, _amount);
}

Steps to reproduce:

  • Oracle updates the price of token ID 10.

  • The tokenToHousePrice updates the price of the 10th token and the lastUpdateTimestamp is updated.

  • getLatestPrice is called for token ID 3, the function wrongfully returns the last updated time of token ID 10.

Impact

Results in wrong information about the last time when the RAAC token ID price was updated, the price could be stale but the lastUpdatedTimeStamp might be recent since its the time of the last updated token.

Tools Used

Manual Review

Recommendations

Use mapping for lastUpdateTimestamp
mapping(uint256 tokenID => uint256 time) public lastUpdateTimestamp

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RAACHousePrices uses a single global lastUpdateTimestamp for all NFTs instead of per-token tracking, causing misleading price freshness data

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RAACHousePrices uses a single global lastUpdateTimestamp for all NFTs instead of per-token tracking, causing misleading price freshness data

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.