Exemplo n.º 1
0
        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>();
        }
Exemplo n.º 2
0
        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];
            }
        }