Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

Delete depositor in withdrawEgg() __ EggVault.sol

Summary

The withdrawEgg function clears the depositor before calling transferFrom.

/// @notice Allows the depositor to withdraw their egg from the vault.
function withdrawEgg(uint256 tokenId) public {
require(storedEggs[tokenId], "Egg not in vault");
require(eggDepositors[tokenId] == msg.sender, "Not the original depositor");
storedEggs[tokenId] = false;
delete eggDepositors[tokenId];
eggNFT.transferFrom(address(this), msg.sender, tokenId);
emit EggWithdrawn(msg.sender, tokenId);
}

Vulnerability Details

In the current implementation, the contract deletes the eggDepositors[tokenId]) **before **calling the external eggNFT.transferFrom(). This could lead to a state where the egg is not transferred but the tracking is already deleted.

Impact

User can't withdraw their egg from the vault.

Tools Used

Manual review

Recommendations

Delete after calling transferFrom.

Updates

Lead Judging Commences

m3dython Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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