public async Task <Keccak?> MakeAsync(Keccak assetId, uint units, UInt256 value, Address address,
                                              UInt256?gasPrice = null)
        {
            Keccak?depositId = await _depositManager.MakeAsync(assetId, units, value, address, gasPrice);

            if (depositId == null)
            {
                return(null);
            }

            if (_logger.IsWarn)
            {
                _logger.Warn($"NDM instantly verifying deposit with id: '{depositId}'...");
            }
            DepositDetails?deposit = await _depositDetailsRepository.GetAsync(depositId);

            if (deposit is null)
            {
                throw new InvalidDataException($"Deposit details are null just after creating deposit with id '{depositId}'");
            }

            if (deposit.Transaction == null)
            {
                throw new InvalidDataException($"Retrieved a deposit {depositId} without Transaction set.");
            }

            deposit.Transaction.SetIncluded();
            deposit.SetConfirmations(_requiredBlockConfirmations);
            deposit.SetConfirmationTimestamp((uint)_timestamper.EpochSeconds);
            await _depositDetailsRepository.UpdateAsync(deposit);

            if (_logger.IsWarn)
            {
                _logger.Warn($"NDM instantly verified deposit with id '{depositId}'.");
            }

            return(depositId);
        }
        public async Task <Keccak> MakeAsync(Keccak assetId, uint units, UInt256 value, Address address,
                                             UInt256?gasPrice = null)
        {
            var depositId = await _depositManager.MakeAsync(assetId, units, value, address, gasPrice);

            if (_logger.IsWarn)
            {
                _logger.Warn($"NDM instantly verifying deposit with id: '{depositId}'...");
            }
            var deposit = await _depositDetailsRepository.GetAsync(depositId);

            deposit.Transaction.SetIncluded();
            deposit.SetConfirmations(_requiredBlockConfirmations);
            deposit.SetConfirmationTimestamp((uint)_timestamper.EpochSeconds);
            await _depositDetailsRepository.UpdateAsync(deposit);

            if (_logger.IsWarn)
            {
                _logger.Warn($"NDM instantly verified deposit with id '{depositId}'.");
            }

            return(depositId);
        }
Example #3
0
 public Task <Keccak> MakeDepositAsync(Keccak assetId, uint units, UInt256 value, UInt256?gasPrice = null)
 => _depositManager.MakeAsync(assetId, units, value, _accountService.GetAddress(), gasPrice);