-
-
Project Statistics
-
-
Total Invested Amount (Spent + Unspent): @(totalAvailableInvestedAmount + totalSpentAmount) @network.CoinTicker
-
Total Unspent Invested Amount: @totalAvailableInvestedAmount @network.CoinTicker
-
Total Withdrawable Amount: @currentWithdrawableAmount @network.CoinTicker
-
Total Transactions: @totalInvestedTransactions
-
Total Unspent Transactions: @(totalInvestedTransactions - totalSpentTransactions)
-
Total Spent Amount: @totalSpentAmount @network.CoinTicker
-
Total Spent Transactions: @totalSpentTransactions
-
Total Stages: @totalStages
- @if (timeUntilNextStage.HasValue)
- {
-
Time until next stage: @timeUntilNextStage.Value.Days days, @timeUntilNextStage.Value.Hours hours, @timeUntilNextStage.Value.Minutes minutes
- }
- else
- {
-
No upcoming stages.
- }
+
+
+
+
Project Statistics
+
Total Invested Amount (Spent + Unspent): @(totalAvailableInvestedAmount + totalSpentAmount) @network.CoinTicker
+
Total Unspent Invested Amount: @totalAvailableInvestedAmount @network.CoinTicker
+
Total Withdrawable Amount: @currentWithdrawableAmount @network.CoinTicker
+
Total Transactions: @totalInvestedTransactions
+
Total Unspent Transactions: @(totalInvestedTransactions - totalSpentTransactions)
+
Total Spent Amount: @totalSpentAmount @network.CoinTicker
+
Total Spent Transactions: @totalSpentTransactions
+
Total Stages: @totalStages
+ @if (timeUntilNextStage.HasValue)
+ {
+
Time until next stage: @timeUntilNextStage.Value.Days days, @timeUntilNextStage.Value.Hours hours, @timeUntilNextStage.Value.Minutes minutes
+ }
+ else
+ {
+
No upcoming stages.
+ }
+
@code {
@@ -250,7 +257,7 @@
private int? expandedStageId;
private bool showCreateModal;
-
+
private bool showRawTransactionModal = false;
private string rawTransactionJson;
@@ -259,6 +266,8 @@
private bool spendSpinner = false;
decimal totalAvailableInvestedAmount = 0.0m;
+ bool targetInvestmentReached = false;
+ bool projectDateStarted = false;
int totalInvestedTransactions = 0;
decimal totalSpentAmount = 0.0m;
int totalSpentTransactions = 0;
@@ -299,8 +308,6 @@
protected override async Task OnInitializedAsync()
{
-
-
project = storage.GetFounderProjects().FirstOrDefault(p => p.ProjectInfo.ProjectIdentifier == ProjectId)?.ProjectInfo;
firstTimeRefreshSpinner = true;
@@ -342,6 +349,9 @@
currentWithdrawableAmount += availableInvestedAmount;
}
}
+
+ targetInvestmentReached = totalAvailableInvestedAmount >= project.TargetAmount;
+ projectDateStarted = DateTime.UtcNow > project.StartDate;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
@@ -501,6 +511,11 @@
private async Task ClaimCoins(int stageId)
{
+ if (!targetInvestmentReached)
+ {
+ throw new InvalidOperationException("Target investment amount has not been reached, you can only release the funds back to the investors.");
+ }
+
var stage = stageDatas.First(s => s.StageIndex == stageId);
stage.StageSpinner = true;
@@ -548,14 +563,14 @@
finally
{
CalculateTotalValues();
-
+
if (selectedUtxos.Keys.Any(utxoKey => GetStageIndexForUtxo(utxoKey) == selectedStageId))
{
selectedUtxos.Clear();
}
stage.StageSpinner = false;
}
-
+
StateHasChanged();
}
@@ -664,7 +679,7 @@
selectedUtxos[key] = true;
}
}
-
+
private bool IsUtxoSelected(string trxId, int outputIndex)
{
return selectedUtxos.ContainsKey(new UtxoKey(trxId, outputIndex));
@@ -692,7 +707,7 @@
await _clipboardService.WriteTextAsync(trxData);
StateHasChanged();
}
-
+
public struct UtxoKey
{
public string Trxid { get; set; }
@@ -749,4 +764,9 @@
{
showRawTransactionModal = isVisible;
}
+
+ private void ReleaseFundsToInvestors(MouseEventArgs e)
+ {
+ throw new NotImplementedException();
+ }
}
\ No newline at end of file
diff --git a/src/Angor/Client/Pages/View.razor b/src/Angor/Client/Pages/View.razor
index a61c9780..17995d03 100644
--- a/src/Angor/Client/Pages/View.razor
+++ b/src/Angor/Client/Pages/View.razor
@@ -492,7 +492,7 @@ else
{
founder = true;
projectStats.Loading = false;
- SetProjectLinksAndRefreshBalance();
+ SetProjectLinksAndRefreshBalance(); // dont block let it update the ui later
return;
}
@@ -502,14 +502,15 @@ else
invested = investorProject.InvestedInProject();
myProjectExplorerLink = _NetworkConfiguration.GetExplorerUrl().Url + $"/transaction/{investorProject.TransactionId}";
projectStats.Loading = false;
+ SetProjectLinksAndRefreshBalance(); // dont block let it update the ui later
return;
}
project = SessionStorage.GetProjectById(ProjectId);
if (project != null)
{
- await SetProjectLinksAndRefreshBalance();
projectStats.Loading = false;
+ SetProjectLinksAndRefreshBalance(); // dont block let it update the ui later
StateHasChanged();
return;
}