private static ContributionSums GetContributionSums()
        {
            byte[] bytes = Storage.Get(Storage.CurrentContext, CURRENT_CONTRIBUTIONS_KEY);
            if (bytes.Length != 0)
            {
                return(ContributionSumsFromBytes(bytes));
            }

            ContributionSums sums = new ContributionSums();

            // Initializing this way makes Runtime.Notify output more uniform when dispalying these values.
            sums.TotalUnitsContributed  = EIGHT_BYTES.AsBigInteger();
            sums.LastAppliedFeeSnapshot = SIXTEEN_BYTES.AsBigInteger();
            sums.TotalFeeUnits          = SIXTEEN_BYTES.AsBigInteger();
            return(sums);
        }
 private static BigInteger BigIntegerFrom8Bytes(byte[] bytes)
 {
     return(bytes.Length == 0 ? EIGHT_BYTES.AsBigInteger() : bytes.AsBigInteger());
 }
 private static byte[] NormalizeBigIntegerTo8ByteArray(BigInteger number)
 {
     byte[] bytes = number.AsByteArray();
     return(bytes.Concat(EIGHT_BYTES.Take(8 - bytes.Length)));
 }