Skip to main content

Deviation

Git Source

Functions

isDeviatingWithBpsCheck

Checks if the deviation between two values is greater than the given deviation

This function will revert if:

  • deviationBps_ is greater than deviationMax_
function isDeviatingWithBpsCheck(uint256 value_, uint256 benchmark_, uint256 deviationBps_, uint256 deviationMax_)
internal
pure
returns (bool);

Parameters

NameTypeDescription
value_uint256The value to be checked for deviation
benchmark_uint256The reference value to check against
deviationBps_uint256The accepted deviation in basis points (e.g. 100 = 1%)
deviationMax_uint256The maximum deviation in basis points (e.g. 10000 = 100%)

Returns

NameTypeDescription
<none>boolbool True if the deviation is greater than the given deviation, false otherwise

isDeviating

Checks if the deviation between two values is greater than the given deviation

function isDeviating(uint256 value_, uint256 benchmark_, uint256 deviationBps_, uint256 deviationMax_)
internal
pure
returns (bool);

Parameters

NameTypeDescription
value_uint256The value to be checked for deviation
benchmark_uint256The reference value to check against
deviationBps_uint256The accepted deviation in basis points (e.g. 100 = 1%)
deviationMax_uint256The maximum deviation in basis points (e.g. 10000 = 100%)

Returns

NameTypeDescription
<none>boolbool True if the deviation is greater than the given deviation, false otherwise

_isDeviating

Checks if the deviation between two values is greater than the given deviation

This function will revert if:

  • benchmark_ is zero
function _isDeviating(uint256 diff_, uint256 benchmark_, uint256 deviationBps_, uint256 deviationMax_)
internal
pure
returns (bool);

Parameters

NameTypeDescription
diff_uint256The difference between the two values
benchmark_uint256The reference value to check against
deviationBps_uint256The deviation in basis points (e.g. 100 = 1%)
deviationMax_uint256The maximum deviation in basis points (e.g. 10000 = 100%)

Returns

NameTypeDescription
<none>boolbool True if the deviation is greater than the given deviation, false otherwise

Errors

Deviation_InvalidDeviationBps

The provided deviation is greater than the maximum deviation

error Deviation_InvalidDeviationBps(uint256 deviationBps_, uint256 deviationMax_);

Parameters

NameTypeDescription
deviationBps_uint256The accepted deviation in basis points (e.g. 100 = 1%)
deviationMax_uint256The maximum deviation in basis points (e.g. 10000 = 100%)