Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions csharp/src/Data.Npgsql/EFSwapMetricRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ internal class EFSwapMetricRepository(SolverDbContext dbContext) : ISwapMetricRe
{
Date = g.Key,
Value = g.Sum(x => x.VolumeInUsd)
}).ToListAsync();
})
.OrderBy(x => x.Date)
.ToListAsync();

return result.Select(x => (x.Date, x.Value)).ToList();
}
Expand All @@ -47,7 +49,9 @@ internal class EFSwapMetricRepository(SolverDbContext dbContext) : ISwapMetricRe
{
Date = g.Key,
Value = g.Sum(x => x.ProfitInUsd)
}).ToListAsync();
})
.OrderBy(x => x.Date)
.ToListAsync();

return result.Select(x => (x.Date, x.Value)).ToList();
}
Expand Down
43 changes: 25 additions & 18 deletions csharp/src/Workflow.Swap/Workflows/SwapWorkflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,30 @@ await ExecuteTransactionAsync(new TransactionRequest()
return;
}

// Redeem user funds
var redeemInDestinationTask = ExecuteTransactionAsync(new TransactionRequest()
var tasks = new List<Task>();

if (_destinationNetwork.Type != NetworkType.Aztec)
{
PrepareArgs = new HTLCRedeemTransactionPrepareRequest
// Redeem user funds
var redeemInDestinationTask = ExecuteTransactionAsync(new TransactionRequest()
{
CommitId = _htlcCommitMessage!.CommitId,
Asset = _htlcCommitMessage.DestinationAsset,
Secret = hashlock.Secret,
DestinationAddress = _htlcCommitMessage.DestinationAddress,
SenderAddress = _destinationWalletAddress
}.ToJson(),
Type = TransactionType.HTLCRedeem,
Network = _destinationNetwork,
FromAddress = _destinationWalletAddress!,
SignerAgentUrl = _sourceWalletAgentUrl!,
SwapId = _swapId
});
PrepareArgs = new HTLCRedeemTransactionPrepareRequest
{
CommitId = _htlcCommitMessage!.CommitId,
Asset = _htlcCommitMessage.DestinationAsset,
Secret = hashlock.Secret,
DestinationAddress = _htlcCommitMessage.DestinationAddress,
SenderAddress = _destinationWalletAddress
}.ToJson(),
Type = TransactionType.HTLCRedeem,
Network = _destinationNetwork,
FromAddress = _destinationWalletAddress!,
SignerAgentUrl = _sourceWalletAgentUrl!,
SwapId = _swapId
});

tasks.Add(redeemInDestinationTask);
}

// Redeem LP funds
var redeemInSourceTask = ExecuteTransactionAsync(new TransactionRequest()
Expand All @@ -268,9 +275,9 @@ await ExecuteTransactionAsync(new TransactionRequest()
SwapId = _swapId
});

await Task.WhenAll(
redeemInDestinationTask,
redeemInSourceTask);
tasks.Add(redeemInSourceTask);

await Task.WhenAll(tasks);

}
catch (Exception e) when (TemporalException.IsCanceledException(e))
Expand Down