Dria

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

Transferring Asset and tokens can be done as one single Transfer

Description

When purchasing assets, they get transferred to the buyer, and the price if getting transferred to the seller

swan/Swan.sol#L292-L299

function purchase(address _asset) external {
...
>> SwanAsset(_asset).transferFrom(listing.seller, address(this), 1);
SwanAsset(_asset).transferFrom(address(this), listing.buyer, 1);
// transfer money
>> token.transferFrom(listing.buyer, address(this), listing.price);
token.transfer(listing.seller, listing.price);
...
}

There is no need to transfer to address(this) and then to the recipient, transferFrom can be used to transfer directly to the recipient, making it a one-step process instead of 2 step process.

Recommendations

use transferFrom the owner to the recipient directly, instead of transferring to address(this) and then transferring the asset to the recipient.

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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