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 byte[] NormalizeBigIntegerTo16ByteArray(BigInteger number) { byte[] bytes = number.AsByteArray(); return(bytes.Concat(SIXTEEN_BYTES.Take(16 - bytes.Length))); }