-
-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Labels
effort: mediumDefault level of effort.Default level of effort.priority: 2We will do our best to deal with this.We will do our best to deal with this.type: featureNew feature or request.New feature or request.work: clearSense-categorize-respond. The relationship between cause and effect is clear.Sense-categorize-respond. The relationship between cause and effect is clear.
Description
Discussed in #258
Originally posted by ivanvolov July 18, 2025
Description:
Currently, mulDiv only supports uint256 arguments and returns a uint256. While this is useful in many cases, using it in combination with other operations involving UD60x18 types often leads to repeated wrapping and unwrapping. This not only introduces verbosity but also makes the code less readable.
Example (current):
UD60x18 targetCL = ud(mulDiv(TVL.mul(ud(weight)).unwrap(), longLeverage.unwrap(), price.unwrap()));Proposed Solution:
Add an overloaded version of mulDiv that accepts and returns UD60x18. This would simplify expressions and improve code clarity.
Example (proposed):
UD60x18 targetCL = mulDiv(TVL.mul(ud(weight)), longLeverage, price);This enhancement would be especially valuable when chaining multiple fixed-point operations, as it helps reduce boilerplate and potential errors.
Metadata
Metadata
Assignees
Labels
effort: mediumDefault level of effort.Default level of effort.priority: 2We will do our best to deal with this.We will do our best to deal with this.type: featureNew feature or request.New feature or request.work: clearSense-categorize-respond. The relationship between cause and effect is clear.Sense-categorize-respond. The relationship between cause and effect is clear.