public async Task RemoveCashinLockAsync(string erc20TokenAddress, string contractAddress) { string userAddress = await _erc20DepositContractService.GetUserAddress(contractAddress); await UpdateUserTransferWallet(contractAddress, erc20TokenAddress, userAddress); }
//return whether we have sent to rabbit or not private async Task <bool> SendCompleteEvent(string transactionHash, string operationId, bool success, QueueTriggeringContext context, CoinTransactionMessage transaction) { try { var operation = await GetOperationAsync(transactionHash, operationId); if (operation == null) { return(false); } (BigInteger? amount, string blockHash, ulong blockNumber)transferedInfo = (null, null, 0); string amount = operation.Amount.ToString(); switch (operation.OperationType) { case HotWalletOperationType.Cashout: break; case HotWalletOperationType.Cashin: string userAddress = await _erc20DepositContractService.GetUserAddress(operation.FromAddress); await TransferWalletSharedService.UpdateUserTransferWalletAsync(_userTransferWalletRepository, operation.FromAddress, operation.TokenAddress, userAddress, ""); //There will be nothing to index in failed event if (success) { transferedInfo = await _transactionEventsService.IndexCashinEventsForErc20TransactionHashAsync( transactionHash); if (transferedInfo.amount == null || transferedInfo.amount == 0) { //Not yet indexed SendMessageToTheQueueEnd(context, transaction, 10000); return(false); } amount = transferedInfo.amount.ToString(); } break; default: return(false); } EventType eventType = success ? EventType.Completed : EventType.Failed; TransferEvent @event = new TransferEvent(operation.OperationId, transactionHash, amount, operation.TokenAddress, operation.FromAddress, operation.ToAddress, transferedInfo.blockHash, transferedInfo.blockNumber, SenderType.EthereumCore, eventType, WorkflowType.LykkePay, DateTime.UtcNow); await _rabbitQueuePublisher.PublshEvent(@event); return(true); } catch (Exception e) { await _log.WriteErrorAsync(nameof(HotWalletMonitoringTransactionJob), "SendCompletedCoinEvent", $"trHash: {transactionHash}", e, DateTime.UtcNow); SendMessageToTheQueueEnd(context, transaction, 100); return(false); } }