Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: medium
Invalid

Use `safeTransferFrom` instead of `transferFrom`

Summary

The safeTransferFrom function has the same functionality as transferFrom, but adds needed additional checks.

Vulnerability Details

In the contract Streets.sol the function stake is used to stake the user's token, however the transfer is initiated with transferFrom instead of safeTransferFrom. The specific benefit of using safeTransferFrom in this case is that it adds one additional check - tokenId token must exist and be owned by from.

Impact

The user may call transferFrom with a non-existent token which would result

Tools Used

Manual review

Recommendations

Update the stake function so that it uses safeTransferFrom:

function stake(uint256 tokenId) external {
stakes[tokenId] = Stake(block.timestamp, msg.sender);
emit Staked(msg.sender, tokenId, block.timestamp);
- oneShotContract.transferFrom(msg.sender, address(this), tokenId);
+ oneShotContract.safeTransferFrom(msg.sender, address(this), tokenId);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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