Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: low
Invalid

`Listing.createdAt` is getting overridden when relisting

Description

When listingan item we deploy it, and when for each swan asset, there is createdAt variable which is setted to block.timestamp.

constructor( ... ERC721(_name, _symbol) Ownable(_owner) {
description = _description;
>> createdAt = block.timestamp;
// owner is minted the token immediately
ERC721._mint(_owner, 1);
// Swan (operator) is approved to by the owner immediately.
ERC721._setApprovalForAll(_owner, _operator, true);
}
}

We store out listing address with a variable also named createdAt which make both of them match.

list()

address asset = address(swanAssetFactory.deploy(_name, _symbol, _desc, msg.sender));
listings[asset] = AssetListing({
createdAt: block.timestamp,
royaltyFee: buyer.royaltyFee(),
price: _price,
seller: msg.sender,
status: AssetStatus.Listed,
buyer: _buyer,
round: round
});

When relisting the item, we override this value to block.timestamp, which is a wrong value as the creation time is the time of deploying the asset, not the time we relist it.

relist()

function relist(address _asset, address _buyer, uint256 _price) external {
...
// create listing
listings[_asset] = AssetListing({
>> createdAt: block.timestamp,
royaltyFee: buyer.royaltyFee(),
price: _price,
seller: msg.sender,
status: AssetStatus.Listed,
buyer: _buyer,
round: round
});
...
}

This will make listing mapping have an incorrect value, where the asset (ERC721) createdAt, will be with value differ from the value of createdAt in Swan contract. Besides createdAt should not get overrides.

Recommendations

Don't override createdAt value when relisting

Updates

Lead Judging Commences

inallhonesty Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

alqaqa Submitter
9 months ago
inallhonesty Lead Judge
9 months ago
inallhonesty Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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