Skip to content

Commit 5fbaa3d

Browse files
committed
Add param natspec to UnitConversionUtils methods
1 parent 8015d03 commit 5fbaa3d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contracts/lib/UnitConversionUtils.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)