The contract emits events before executing critical state changes and transfers, which can lead to incorrect event logs in cases where the subsequent operations fail. This creates a discrepancy between what actually happened on-chain and what the events indicate happened, potentially misleading users and applications that rely on these events for transactions.
In several functions throughout the contract, events are emitted before the actual state-changing operations or transfers take place. Here are the specific instances:
In the claimNft()
function:
In the divideNft()
function:
In the buyOrder()
function:
If an event is emitted before a transfer, and the transfer fails, the contract’s state will not be updated to reflect the failed transaction. This can lead to discrepancies between the expected state and the actual state of the contract.
Incorrect Blockchain Data: If a transfer fails after an event is emitted, the event log will indicate that an action succeeded when it actually failed. This creates an incorrect record of contract interactions.
Integration Issues: Third-party applications, users, or protocols that rely on these events for tracking state changes might malfunction or make incorrect decisions based on the misleading event data.
Events should be emitted after all state changes and transfers have been successfully completed. Here's how the code should be modified:
For the claimNft()
function:
For the divideNft()
function:
For the buyOrder()
function:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.