Core Contracts

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

Inconsistent Timestamp Tracking in `RAACHousePrices`

Summary

The RAACHousePrices contract has a design flaw where the lastUpdateTimestamp variable tracks a single timestamp for all token price updates, rather than storing a separate timestamp for each _tokenId. This means that querying getLatestPrice does not return an accurate update time for individual token prices.

Vulnerability Details

Source

Code Snippet

​
function getLatestPrice(uint256 _tokenId) external view returns (uint256, uint256) {
​
return (tokenToHousePrice[_tokenId], lastUpdateTimestamp);
​
}
​
​
​
function setHousePrice(uint256 _tokenId, uint256 _amount) external onlyOracle {
​
  tokenToHousePrice[_tokenId] = _amount;
​
  lastUpdateTimestamp = block.timestamp;
​
emit PriceUpdated(_tokenId, _amount);
​
}
​

Issue Explanation

  • The lastUpdateTimestamp variable is a single state variable used for all token updates.

  • When setHousePrice is called for any _tokenId, lastUpdateTimestamp is updated globally, meaning that all token IDs appear to have the same last update time.

  • This can lead to inaccurate data representation when fetching the price for a specific _tokenId.

Impact

  • Users querying getLatestPrice cannot determine the actual last update time of a specific token price.

  • This could lead to incorrect assumptions about the freshness of pricing data.

  • External systems relying on accurate timestamps for price tracking may be misled.

Tools Used

  • Manual code review

Recommendation

Refactor the contract to track timestamps on a per-token basis by using a struct:

​
struct HousePriceData {
​
uint256 price;
​
uint256 lastUpdated;
​
}
​
mapping(uint256 => HousePriceData) public tokenHousePrices;
​

This ensures that each _tokenId has an independent timestamp for when its price was last updated.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year 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 over 1 year 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.

Give us feedback!