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

Unused error and event in raffle contract

Summary

There are an error and an event declared in the contract but never used in the functions.

Vulnerability Details

ERROR_TRANSFER_FAILED error and RequestedRaffleWinner is never used in the contract, remove them if it is not need, or emit them in the functions.

Impact

It confuses the developer and user if they want to query such event/error in block explorers.

Tools Used

Manual Review

Recommendations

Remove the event and error, or use them in corresponding places.

For example, emitting RequestedRaffleWinner event in request_raffle_winner:

@external
def request_raffle_winner() -> uint256:
is_open: bool = RaffleState.OPEN == self.raffle_state
time_passed: bool = (block.timestamp - self.last_timestamp) > RAFFLE_DURATION
has_players: bool = len(self.players) > 0
has_balance: bool = self.balance > 0 # NOTE: Check address(this).balance refinement
assert is_open and time_passed and has_players and has_balance, ERROR_NOT_ENDED
self.raffle_state = RaffleState.CALCULATING
request_id: uint256 = VRF_COORDINATOR.requestRandomWords(
GAS_LANE,
SUBSCRIPTION_ID,
REQUEST_CONFIRMATIONS,
CALLBACK_GAS_LIMIT,
NUM_WORDS
)
+ emit RequestedRaffleWinner(request_id)
return ERC721._total_supply()
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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