コード例 #1
0
        public async Task CreatePlanAsync(
            DateTime from,
            DateTime to)
        {
            _log.Info($"Creating distribution plan for {from:s} - {to:s}...");

            var claimedGasAmounts = await _claimedGasAmountRepository.GetAsync(from, to);

            _log.Info("Claimed GAS amount found", new
            {
                claimedGasAmounts
            });

            var snapshots = await _snapshotRepository.GetAsync(from, to);

            _log.Info($"{snapshots.Count} balance snapshots found");

            var scale = _assetService.AssetGet(_gasAssetId).Accuracy;

            _log.Info($"GAS scale {scale}");

            var distributionAmounts = DistributionPlanCalculator.CalculateAmounts(snapshots, claimedGasAmounts, scale).ToArray();

            _log.Info($"{distributionAmounts.Length} distribution amounts gotten");

            var distributionPlan = DistributionPlanAggregate.Create(to, distributionAmounts);

            _log.Info($"Distribution plan {distributionPlan.Id} created");

            await _distributionPlanRepository.SaveAsync(distributionPlan);
        }