Assessment reports>Y2K Finance>Threat Model>setWeightStrategy

Function: setWeightStrategy(uint8 weightId, uint16 proportion, uint256[] fixedWeights)

A restricted onlyOwner function. There are not checks of fixedWeights values if weightId == 1 or 4. Also, fixedWeights can be an empty list.

Inputs

  • weightId

    • Constraints: 0 < weightId <= 4, but it should be 0 < weightId < 4.

    • Impact: defines the strategy to use for weights. If weightId == 3, fixedWeights contains marketIds and threshold. If weightId == 2, then fixedWeights contains the custom weights. If weightId == 1, then equalWeight, that is, all available funds will be equally distributed between the vaults.

  • proportion

    • Constraints: proportion <= 9999.

    • Impact: Proportion of vault funds to use in each deployment to strategy.

  • fixedWeights

    • Constraints: If weightId == 2, then the sum of weights should not be more than 10,000.

    • Impact: Update the global vaultWeights, which is used by PositionSizer._thresholdWeight and PositionSizer._fixedWeight.

Branches and code coverage (including function calls)

Intended branches

  • weightStrategy, weightProportion, and vaultWeights are updated properly.

Negative behavior

  • weightId == 0.

  • proportion > 9_999.

  • weightId > strategyCount().

  • weightId == 2 and fixedWeights.length != vaultList.length.

  • weightId == 3 and fixedWeights.length != vaultList.length + 1.

Zellic © 2024Back to top ↑