Assessment reports>Origami Finance>Threat Model>setConfig

Function: setConfig(uint32 _periodDuration, uint32 _nBuckets, uint128 _cap)

This function allows the caller access to set new values for periodDuration, nBuckets, and cap. Subsequently, secondsPerBucket will be recalculated based on the new values of periodDuration and nBuckets. Additionally, bucketIndex will be reset to zero, and all necessary buckets will be cleared.

Inputs

  • _periodDuration

    • Constraints: _periodDuration % _nBuckets should be zero.

    • Impact: Borrowing within a _periodDuration window is limited to no more than the cap.

  • _nBuckets

    • Constraints: _nBuckets should be less than MAX_BUCKETS.

    • Impact: The number of buckets into which the periodDuration should be divided.

  • _cap

    • Constraints: No constraints.

    • Impact: The maximum allowed amount to be borrowed within each period.

Branches and code coverage

Intended branches

  • Verify that the buckets have been reset correctly.

  • periodDuration, nBuckets, and cap were updated.

Negative behavior

  • Non-whitelisted caller

  • _periodDuration % _nBuckets > 0.

  • _nBuckets more than MAX_BUCKETS`.

Zellic © 2025Back to top ↑