public void RehydrateHeader(IDataRehydrator rehydrator) { AdaptiveLong1_9 adaptiveLong = new AdaptiveLong1_9(); // then the various bounties AmountSerializationOffsetsCalculator bountyCalculator = new AmountSerializationOffsetsCalculator(); adaptiveLong.Rehydrate(rehydrator); ushort bountySetCount = (ushort)adaptiveLong.Value; this.BountyAllocations.Clear(); if (bountySetCount > 0) { Amount bountyAmount = new Amount(); for (ushort i = 0; i < bountySetCount; i++) { bountyAmount.Rehydrate(rehydrator); decimal offset = bountyAmount.Value; Amount bountyEntry = new Amount(bountyCalculator.RebuildValue(offset)); this.BountyAllocations.Add(bountyEntry); bountyCalculator.AddLastOffset(); } } // now retrieve the network service fees this.InfrastructureServiceFees = rehydrator.ReadRehydratable <Amount>(); }
public void Rehydrate(IDataRehydrator rehydrator, IElectionContextRehydrationFactory electionContextRehydrationFactory) { this.Bounty.Rehydrate(rehydrator); this.MaintenanceServiceFeesEnabled = rehydrator.ReadBool(); this.MaintenanceServiceFees = rehydrator.ReadRehydratable <SimplePercentage>(); this.BountyAllocationMethod = BountyAllocationMethodRehydrator.Rehydrate(rehydrator); this.TransactionTipsAllocationMethod = TransactionTipsAllocationMethodRehydrator.Rehydrate(rehydrator); }
public void RehydrateDelegateAccountEntry(AccountId accountId, INeuraliumDelegateResults entry, IDataRehydrator rehydrator) { // now the bounty allocation AdaptiveLong1_9 bountyAllocationOffset = rehydrator.ReadRehydratable <AdaptiveLong1_9>(); ushort index = (ushort)bountyAllocationOffset.Value; if (index != ushort.MaxValue) { // max value means there is no bounty associated entry.BountyShare = this.BountyAllocations[index]; } }