Function: optOut(ERC20 strategy, FlywheelCore flywheel)

  1. Performs the check that the strategy and flywheel addresses were optIn by msg.sender.

    1. Accrues rewards for the msg.sender on a strategy.

    2. Decreases the whole amount of flywheelStrategyGaugeWeight[strategy][flywheel] by the current user balance allocated to the strategy.

    3. Deletes the flywheel address from userGaugeFlywheels[msg.sender][strategy].

    4. Deletes the index of the flywheel address from userGaugeflywheelId[msg.sender][strategy][flywheel].

Inputs

  • strategy

    • Constraints: The userFlywheelId should not be zero for the provided strategy and flywheel.

    • Impact: The strategy address for which the user will optOut, but only after the optIn call.

  • flywheel

    • Constraints: The userFlywheelId should not be zero for the provided strategy and flywheel.

    • Impact: The flywheel address for which the user will optOut, but only after the optIn call.

Branches and code coverage (including function calls)

Intended branches

  • The userGaugeflywheelId == 0 after the call.

  • The flywheelStrategyGaugeWeight decremented.

Negative behavior

  • msg.sender did not optIn before for strategy and flywheel.

  • msg.sender did not optIn before for strategy.

  • msg.sender did not optIn before for flywheel.

  • The case when length != userFlywheelId.

Function call analysis

  • flywheel.accrue(strategy, msg.sender)

    • What is controllable? flywheel and strategy.

    • If return value 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? If reverted, the user will not be able to optIn and the user’s balance will not be able to take into account total supply.

  • bHermesGauges(owner()).getUserGaugeWeight(msg.sender, address(strategy))

    • What is controllable? strategy.

    • If return value controllable, how is it used and how can it go wrong? Return the user's allocated weight to that gauge (strategy).

    • What happens if it reverts, reenters, or does other unusual control flow? No problem --- just view function.

Zellic © 2025Back to top ↑