Assessment reports>Yeet>Threat Model>Function: claim()

Function: claim()

This function allows the caller to claim earned rewards. To get the reward, the caller should add YEET volume before. The caller will receive their part of the reward, corresponding to their part of the total YEET. The amount earned is calculated using the getClaimableAmount function, which gets userYeetVolume and totalYeetVolume for each epoch since the last claimed epoch for the caller to calculate the user's part of the reward for each epoch.

Inputs

  • msg.sender

    • Control: N/A.

    • Constraints: If the caller hasn't added any YEET since the last lastClaimedForEpoch, this function will revert.

    • Impact: The reward claimer.

Branches and code coverage (including function calls)

Intended branches

  • The reward for the first user's claim is calculated properly.

  • The reward for the claim of any user but the first is calculated properly and does not take into account the previously claimed reward.

Negative behavior

  • Caller has never added YEET volume.

  • The second claim call after a successful claim is reverted.

Function call analysis

  • getClaimableAmount(msg.sender)

    • What is controllable? N/A.

    • If the return value is controllable, how is it used and how can it go wrong? Return the earned reward for the msg.sender since the last lastClaimedForEpoch.

    • What happens if it reverts, reenters or does other unusual control flow?: N/A.

  • token.transfer(msg.sender, amountEarned);

    • What is controllable? N/A.

    • If the return value is controllable, how is it used and how can it go wrong? N/A.

    • What happens if it reverts, reenters or does other unusual control flow? Transfer reward tokens to the caller.

Zellic © 2024Back to top ↑