Assessment reports>Yeet>Threat Model>Function: addYeetVolume(address user, uint256 amount)

Function: addYeetVolume(address user, uint256 amount)

This is available only for the yeetContract address. Before executing the main logic of this function, the epoch will be updated if the current epoch has ended. The function increases the userYeetVolume by the amount for the provided user address and for the current epoch. Additionally, the totalYeetVolume is updated by the provided amount.

Inputs

  • user

    • Control: N/A.

    • Constraints: Cannot be zero address.

    • Impact: The address of the user-added volume.

  • amount

    • Control: N/A.

    • Constraints: Must be greater than zero.

    • Impact: The amount of volume.

Branches and code coverage (including function calls)

Intended branches

  • userYeetVolume is updated properly.

  • totalYeetVolume is updated properly.

  • If _shouldEndEpoch is true, the epoch is updated.

Negative behavior

  • amount == 0.

  • User is zero address.

Function call analysis

  • _shouldEndEpoch()

    • 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? Returns true if block.timestamp is greater than or equal to the currentEpochEnd — otherwise, it returns false. If the current epoch ends, the _endEpoch function is triggered.

  • _endEpoch()

    • What is controllable? N/A.

    • Argument control?: 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?: The function updates the epoch contract state; the currentEpoch is incremented, the currentEpochStart is updated using the current currentEpochEnd, and after that, the currentEpochEnd is set to the currentEpochStart + EPOCH_LENGTH. Also, this function updates the epochRewards for the new epoch.

Zellic © 2024Back to top ↑