Mutated Value Computer
Purpose
Mutated value computers are abstract smart contracts that provide the functionality to configure and compute mutated values for an address.
Formula
The formula for computing a mutated value is as follows, in pseudocode:
output = (input * config.scalar) + config.offset
output = min(output, config.max)
output = max(output, config.min)
Implementation
Implementation requires implementing the following functions:
/**
* @notice Returns the raw value for a given token which will later be mutated.
* @dev This is an internal virtual function that must be implemented by the derived contract to provide the
* specific logic for extracting the raw value for the token.
* @param token The token address for which the raw value should be computed.
* @return The raw value for the given token.
*/
function getValue(address token) internal view virtual returns (uint256);
/// @notice Checks if the caller is authorized to set the configuration.
/// @dev This function should contain the access control logic for the setConfig function.
function checkSetConfig() internal view virtual;