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

Defender cannot retire from battle

Summary

Once the defender has entered the stage, there is no way for him to leave until a battle takes place.

Vulnerability Details

When the defender enters the battle, his tokens and NFT are transferred to the battle contract, awaiting for another challenger. If no one accepts his battle, his tokens and NFT will be trapped in the contract.

While a solution could be to mint another NFT to enter the battle, this does not seem like the logical method to solve this situation.

Impact

A defender's tokens and NFT can be trapped in the battle contract until another challenger accepts the battle.

Tools Used

Foundry, Manual review

Recommendations

Add a method to exit the stage without having to engage in a battle:

function leaveTheStage() external {
require(msg.sender == defender, "RapBattle: Not the defender");
defender = address(0);
oneShotNft.transferFrom(address(this), msg.sender, defenderTokenId);
credToken.transfer(msg.sender, defenderBet);
}```
Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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