@@ -35,6 +35,10 @@ library UnitConversionUtils {
3535 * @dev Converts a uint256 PRECISE_UNIT quote quantity into an alternative decimal format.
3636 *
3737 * This method is borrowed from PerpProtocol's `lushan` repo in lib/SettlementTokenMath
38+ *
39+ * @param _amount PRECISE_UNIT amount to convert from
40+ * @param _decimals Decimal precision format to convert to
41+ * @return Input converted to alternative decimal precision format
3842 */
3943 function fromPreciseUnitToDecimals (uint256 _amount , uint8 _decimals ) internal pure returns (uint256 ) {
4044 return _amount.div (10 ** (18 - uint (_decimals)));
@@ -44,13 +48,21 @@ library UnitConversionUtils {
4448 * @dev Converts an int256 PRECISE_UNIT quote quantity into an alternative decimal format.
4549 *
4650 * This method is borrowed from PerpProtocol's `lushan` repo in lib/SettlementTokenMath
51+ *
52+ * @param _amount PRECISE_UNIT amount to convert from
53+ * @param _decimals Decimal precision format to convert to
54+ * @return Input converted to alternative decimal precision format
4755 */
4856 function fromPreciseUnitToDecimals (int256 _amount , uint8 _decimals ) internal pure returns (int256 ) {
4957 return _amount.div (int256 (10 ** (18 - uint (_decimals))));
5058 }
5159
5260 /**
5361 * @dev Converts an arbitrarily decimalized quantity into a PRECISE_UNIT quantity.
62+ *
63+ * @param _amount Non-PRECISE_UNIT amount to convert
64+ * @param _decimals Decimal precision of amount being converted to PRECISE_UNIT
65+ * @return Input converted to PRECISE_UNIT decimal format
5466 */
5567 function toPreciseUnitsFromDecimals (int256 _amount , uint8 _decimals ) internal pure returns (int256 ) {
5668 return _amount.mul (int256 (10 ** (18 - (uint (_decimals)))));
0 commit comments