Jolly Mauve Parakeet
Medium
NoopAdiabatic6Lib does the same calculations as LinearAdiabatic6Lib, returns the same fees as LinearAdiabatic6Lib
According to the notice from this library
For the NoopAdiabatic6Lib, the purpose is to not adjust the fee dynamically based on market conditions. Therefore, this library should return a constant fee or bypass the fee adjustment mechanism. Instead of calling the AdiabaticMath6.linearFee, it could return a fixed fee, such as zero or a pre-configured static value
library NoopAdiabatic6Lib {
/// @notice Computes the linear fee
/// @param self The adiabatic configuration
/// @param change The change in skew in asset terms
/// @param price The price of the underlying asset
/// @return The linear fee in underlying terms
function linear(NoopAdiabatic6 memory self, Fixed6 change, UFixed6 price) internal pure returns (UFixed6) {
return AdiabaticMath6.linearFee(self.linearFee, change, price);
}
/// @notice Computes the proportional fee
/// @param self The adiabatic configuration
/// @param change The change in skew in asset terms
/// @param price The price of the underlying asset
/// @return The proportional fee in underlying terms
function proportional(NoopAdiabatic6 memory self, Fixed6 change, UFixed6 price) internal pure returns (UFixed6) {
return AdiabaticMath6.proportionalFee(self.scale, self.proportionalFee, change, price);
}
}
adiabatic/types/NoopAdiabatic6.sol#L22
library LinearAdiabatic6Lib {
...
/// @notice Computes the linear fee
/// @param self The adiabatic configuration
/// @param change The change in skew in asset terms
/// @param price The price of the underlying asset
/// @return The linear fee in underlying terms
function linear(LinearAdiabatic6 memory self, Fixed6 change, UFixed6 price) internal pure returns (UFixed6) {
return AdiabaticMath6.linearFee(self.linearFee, change, price);
}
/// @notice Computes the proportional fee
/// @param self The adiabatic configuration
/// @param change The change in skew in asset terms
/// @param price The price of the underlying asset
/// @return The proportional fee in underlying terms
function proportional(LinearAdiabatic6 memory self, Fixed6 change, UFixed6 price) internal pure returns (UFixed6) {
return AdiabaticMath6.proportionalFee(self.scale, self.proportionalFee, change, price);
}
...
}
adiabatic/types/LinearAdiabatic6.sol#L35
There is a similar Noop library where a fixed value is being returned NoopFiatReserve.sol
No response
No response
No response
The makerFee is being calculated incorrectly because it is using NoopAdiabatic6, but it is not behaving as it is supposed to.
No response
Returns fixed or zero from that library like it described
function linear(NoopAdiabatic6 memory self, Fixed6 change, UFixed6 price) internal pure returns (UFixed6) {
- return AdiabaticMath6.linearFee(self.linearFee, change, price);
+ return self.linearFee;