Exemple #1
0
        public async Task <string> StartCashinAsync(IHotWalletOperation operation)
        {
            await SaveOperationAsync(operation);

            var transactionHash = await _erc20DepositContractService.RecievePaymentFromDepositContract(operation.FromAddress,
                                                                                                       operation.TokenAddress,
                                                                                                       operation.ToAddress);

            await RetryPolicy.ExecuteUnlimitedAsync(async() =>
            {
                await _hotWalletCashoutTransactionRepository.SaveAsync(new HotWalletCashoutTransaction()
                {
                    OperationId     = operation.OperationId,
                    TransactionHash = transactionHash
                });
            }, TimeSpan.FromMinutes(1).Milliseconds, _log);

            CoinTransactionMessage message = new CoinTransactionMessage()
            {
                OperationId     = operation.OperationId,
                TransactionHash = transactionHash
            };

            return(transactionHash);
        }
        public async Task <IActionResult> TransferAsync([FromBody] TransferFromDepositRequest request)
        {
            if (!ModelState.IsValid)
            {
                throw new ClientSideException(ExceptionType.WrongParams, JsonConvert.SerializeObject(ModelState.Errors()));
            }

            string opId = await _contractService.RecievePaymentFromDepositContract(request.DepositContractAddress?.ToLower(),
                                                                                   request.TokenAddress?.ToLower(),
                                                                                   request.DestinationAddress?.ToLower());

            return(Ok(new OperationIdResponse()
            {
                OperationId = opId
            }));
        }
        public async Task <string> StartCashinAsync(IHotWalletOperation operation)
        {
            await SaveOperationAsync(operation);

            var transactionHash = await _erc20DepositContractService.RecievePaymentFromDepositContract(operation.FromAddress,
                                                                                                       operation.TokenAddress,
                                                                                                       operation.ToAddress);

            await _hotWalletCashoutTransactionRepository.SaveAsync(new HotWalletCashoutTransaction()
            {
                OperationId     = operation.OperationId,
                TransactionHash = transactionHash
            });

            CoinTransactionMessage message = new CoinTransactionMessage()
            {
                OperationId     = operation.OperationId,
                TransactionHash = transactionHash
            };

            return(transactionHash);
        }