From c10da46d0752d63d0e0d2a8d41c2780f7f78ef2e Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Mon, 7 Oct 2024 16:17:16 -0400 Subject: [PATCH] re-add comments --- src/libraries/Descriptor.sol | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libraries/Descriptor.sol b/src/libraries/Descriptor.sol index 09a3cf5c..8e32a35d 100644 --- a/src/libraries/Descriptor.sol +++ b/src/libraries/Descriptor.sol @@ -439,16 +439,16 @@ library Descriptor { } else { // represents fee less than 1% // else if decimal < 1 - nZeros = 5 - digits; - params.zerosStartIndex = 2; - params.zerosEndIndex = uint8(nZeros + params.zerosStartIndex - 1); - params.bufferLength = uint8(nZeros + numSigfigs + 2); - params.sigfigIndex = uint8(params.bufferLength - 2); + nZeros = 5 - digits; // number of zeros, inlcuding the zero before decimal + params.zerosStartIndex = 2; // leading zeros will start after the decimal point + params.zerosEndIndex = uint8(nZeros + params.zerosStartIndex - 1); // end index for leading zeros + params.bufferLength = uint8(nZeros + numSigfigs + 2); // total length of string buffer, including "0." and "%" + params.sigfigIndex = uint8(params.bufferLength - 2); // index of starting signficant figure params.isLessThanOne = true; } - params.sigfigs = uint256(fee) / (10 ** (digits - numSigfigs)); + params.sigfigs = uint256(fee) / (10 ** (digits - numSigfigs)); // the signficant figures of the fee params.isPercent = true; - params.decimalIndex = digits > 4 ? uint8(digits - 4) : 0; + params.decimalIndex = digits > 4 ? uint8(digits - 4) : 0; // based on total number of digits in the fee return generateDecimalString(params); }