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
_periodDurationConstraints:
_periodDuration % _nBucketsshould be zero.Impact: Borrowing within a
_periodDurationwindow is limited to no more than thecap.
_nBucketsConstraints:
_nBucketsshould be less thanMAX_BUCKETS.Impact: The number of buckets into which the
periodDurationshould be divided.
_capConstraints: 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, andcapwere updated.
Negative behavior
Non-whitelisted caller
_periodDuration % _nBuckets > 0._nBucketsmore thanMAX_BUCKETS`.