Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4c33d1d
Put a limit to founder if amount was not reached
dangershony Dec 18, 2024
0d8e68d
merge main
dangershony Dec 23, 2024
98d87a5
Prepare the methods that will be used to release funds (WIP)
dangershony Dec 23, 2024
4aaecaf
merge master
dangershony Jan 7, 2025
370aaf0
mrege master fixes
dangershony Jan 7, 2025
ddbd786
move the box inside the spinner section
dangershony Jan 9, 2025
7e20013
create a release page
dangershony Jan 9, 2025
10ce92f
lookup release sigs
dangershony Jan 10, 2025
4765868
Add the code so sign and validate the release trx and also add a test…
dangershony Jan 13, 2025
cc31c27
Filter events by subject
dangershony Jan 14, 2025
118c85a
Write the code to sign the release sigs
dangershony Jan 15, 2025
da0d7d0
Sending a json type as encrypted data for the recovery request to fou…
dangershony Jan 16, 2025
322d717
show investor they have a pending release
dangershony Jan 17, 2025
8883765
Create the release page and implement investor release funds
dangershony Jan 20, 2025
24a5e7e
All code is done ready to be test
dangershony Jan 23, 2025
c6f4d7a
Add handling of nostr events in an async event
dangershony Jan 29, 2025
487131e
check if a message was already decrypted
dangershony Jan 29, 2025
3fb58a1
flow now works end to end
dangershony Jan 31, 2025
7145346
Merge branch 'main' into limit-if-target-was-not-reached
dangershony Feb 3, 2025
7dd1df5
add missing braces
dangershony Feb 3, 2025
bcdfea9
Act on review
dangershony Feb 5, 2025
7a4f9ae
Delete the extra `SignatureReleaseItem` class
dangershony Feb 5, 2025
f22d320
merge master
dangershony Feb 6, 2025
494f1a5
Act on review
dangershony Feb 6, 2025
bc1da68
Fix some tests that incorrectly used TargetAmount as coins instead of…
dangershony Feb 6, 2025
f699da1
Some more fixes to the amount param in various places
dangershony Feb 7, 2025
4cf8d6c
Removing the TargetInvestmentReached param
dangershony Feb 11, 2025
3026a3f
act on review
dangershony Feb 12, 2025
8c6af84
Rename to UnfundedReleaseAddress
dangershony Feb 12, 2025
ebee0a1
Write test to call a relay subscription
dangershony Feb 12, 2025
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
40 changes: 20 additions & 20 deletions src/Angor.Test/InvestmentOperationsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void SpendFounderStage_Test()
var funderReceiveCoinsKey = new Key();

var projectInvestmentInfo = new ProjectInfo();
projectInvestmentInfo.TargetAmount = 3;
projectInvestmentInfo.TargetAmount = Money.Coins(3).Satoshi;
projectInvestmentInfo.StartDate = DateTime.UtcNow;
projectInvestmentInfo.ExpiryDate = DateTime.UtcNow.AddDays(5);
projectInvestmentInfo.Stages = new List<Stage>
Expand Down Expand Up @@ -157,7 +157,7 @@ public void SpendFounderStage_Test()
// create seeder1 investment transaction

var seeder1InvTrx = operations.CreateInvestmentTransaction(network, seeder1Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

seeder1Context.TransactionHex = operations.SignInvestmentTransaction(network, seeder1Context.ChangeAddress,
seeder1InvTrx, null, new List<UtxoDataWithPath>(), _expectedFeeEstimation)
Expand All @@ -168,7 +168,7 @@ public void SpendFounderStage_Test()
// create seeder2 investment transaction

var seeder2InvTrx = operations.CreateInvestmentTransaction(network, seeder2Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

seeder2Context.TransactionHex = operations.SignInvestmentTransaction(network, seeder2Context.ChangeAddress,
seeder2InvTrx, null, new List<UtxoDataWithPath>(), _expectedFeeEstimation)
Expand All @@ -179,7 +179,7 @@ public void SpendFounderStage_Test()
// create seeder3 investment transaction

var seeder3InvTrx = operations.CreateInvestmentTransaction(network, seeder3Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

seeder3Context.TransactionHex = operations.SignInvestmentTransaction(network, seeder3Context.ChangeAddress,
seeder3InvTrx, null, new List<UtxoDataWithPath>(), _expectedFeeEstimation)
Expand All @@ -190,7 +190,7 @@ public void SpendFounderStage_Test()
// create investor 1 investment transaction

var investor1InvTrx = operations.CreateInvestmentTransaction(network, investor1Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

investor1Context.TransactionHex = operations.SignInvestmentTransaction(network,
investor1Context.ChangeAddress, investor1InvTrx, null, new List<UtxoDataWithPath>(),
Expand All @@ -202,7 +202,7 @@ public void SpendFounderStage_Test()
// create investor 2 investment transaction

var investor2InvTrx = operations.CreateInvestmentTransaction(network, investor2Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

investor2Context.TransactionHex = operations.SignInvestmentTransaction(network,
investor2Context.ChangeAddress, investor2InvTrx, null, new List<UtxoDataWithPath>(),
Expand Down Expand Up @@ -231,7 +231,7 @@ public void SeederTransaction_EndOfProject_Test()
var words = new WalletWords { Words = new Mnemonic(Wordlist.English, WordCount.Twelve).ToString() };

var projectInvestmentInfo = new ProjectInfo();
projectInvestmentInfo.TargetAmount = 3;
projectInvestmentInfo.TargetAmount = Money.Coins(3).Satoshi;
projectInvestmentInfo.StartDate = DateTime.UtcNow;
projectInvestmentInfo.ExpiryDate = DateTime.UtcNow.AddDays(5);
projectInvestmentInfo.Stages = new List<Stage>
Expand Down Expand Up @@ -260,7 +260,7 @@ public void SeederTransaction_EndOfProject_Test()
// create the investment transaction

var seeder1InvTrx = operations.CreateInvestmentTransaction(network, seeder1Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

seeder1Context.TransactionHex = operations.SignInvestmentTransaction(network, seeder1Context.ChangeAddress,
seeder1InvTrx, null, new List<UtxoDataWithPath>(), _expectedFeeEstimation)
Expand All @@ -284,7 +284,7 @@ public void InvestorTransaction_EndOfProject_Test()
var words = new WalletWords { Words = new Mnemonic(Wordlist.English, WordCount.Twelve).ToString() };

var projectInvestmentInfo = new ProjectInfo();
projectInvestmentInfo.TargetAmount = 3;
projectInvestmentInfo.TargetAmount = Money.Coins(3).Satoshi;
projectInvestmentInfo.StartDate = DateTime.UtcNow;
projectInvestmentInfo.ExpiryDate = DateTime.UtcNow.AddDays(5);
projectInvestmentInfo.Stages = new List<Stage>
Expand Down Expand Up @@ -312,7 +312,7 @@ public void InvestorTransaction_EndOfProject_Test()
// create the investment transaction

var seeder1InvTrx = operations.CreateInvestmentTransaction(network, seeder1Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

seeder1Context.TransactionHex = operations.SignInvestmentTransaction(network, seeder1Context.ChangeAddress,
seeder1InvTrx, null, new List<UtxoDataWithPath>(),
Expand All @@ -337,7 +337,7 @@ public void InvestorTransaction_WithSeederHashes_EndOfProject_Test()
var words = new WalletWords { Words = new Mnemonic(Wordlist.English, WordCount.Twelve).ToString() };

var projectInvestmentInfo = new ProjectInfo();
projectInvestmentInfo.TargetAmount = 3;
projectInvestmentInfo.TargetAmount = Money.Coins(3).Satoshi;
projectInvestmentInfo.StartDate = DateTime.UtcNow;
projectInvestmentInfo.ExpiryDate = DateTime.UtcNow.AddDays(5);
projectInvestmentInfo.Stages = new List<Stage>
Expand Down Expand Up @@ -371,7 +371,7 @@ public void InvestorTransaction_WithSeederHashes_EndOfProject_Test()
// create the investment transaction

var seeder1InvTrx = operations.CreateInvestmentTransaction(network, seeder1Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

seeder1Context.TransactionHex = operations.SignInvestmentTransaction(network, seeder1Context.ChangeAddress,
seeder1InvTrx, null, new List<UtxoDataWithPath>(), _expectedFeeEstimation)
Expand Down Expand Up @@ -408,7 +408,7 @@ public void SpendInvestorRecoveryTest()
{
ProjectInfo = new ProjectInfo
{
TargetAmount = 3,
TargetAmount = Money.Coins(3).Satoshi,
StartDate = DateTime.UtcNow,
ExpiryDate = DateTime.UtcNow.AddDays(5),
Stages = new List<Stage>
Expand All @@ -430,7 +430,7 @@ public void SpendInvestorRecoveryTest()
// create the investment transaction

var investmentTransaction = operations.CreateInvestmentTransaction(network, investorContext,
Money.Coins(investorContext.ProjectInfo.TargetAmount).Satoshi);
investorContext.ProjectInfo.TargetAmount);

investorContext.TransactionHex = investmentTransaction.ToHex();

Expand Down Expand Up @@ -508,7 +508,7 @@ public void SpendInvestorConsolidatedRecoveryTest()
{
ProjectInfo = new ProjectInfo
{
TargetAmount = 3,
TargetAmount = Money.Coins(3).Satoshi,
StartDate = DateTime.UtcNow,
ExpiryDate = DateTime.UtcNow.AddDays(5),
Stages = new List<Stage>
Expand Down Expand Up @@ -539,7 +539,7 @@ public void SpendInvestorConsolidatedRecoveryTest()
// create the investment transaction

var investmentTransaction = operations.CreateInvestmentTransaction(network, investorContext,
Money.Coins(investorContext.ProjectInfo.TargetAmount).Satoshi);
investorContext.ProjectInfo.TargetAmount);

investorContext.TransactionHex = investmentTransaction.ToHex();

Expand Down Expand Up @@ -621,7 +621,7 @@ public void SpendSeederConsolidatedRecoveryTest()
{
ProjectInfo = new ProjectInfo
{
TargetAmount = 3,
TargetAmount = Money.Coins(3).Satoshi,
StartDate = DateTime.UtcNow,
ExpiryDate = DateTime.UtcNow.AddDays(5),
Stages = new List<Stage>
Expand All @@ -644,7 +644,7 @@ public void SpendSeederConsolidatedRecoveryTest()
// create the investment transaction

var investmentTransaction = operations.CreateInvestmentTransaction(network, seederContext,
Money.Coins(seederContext.ProjectInfo.TargetAmount).Satoshi);
seederContext.ProjectInfo.TargetAmount);

seederContext.TransactionHex = investmentTransaction.ToHex();

Expand Down Expand Up @@ -711,7 +711,7 @@ public void InvestorTransaction_NoPenalty_Test()
var words = new WalletWords { Words = new Mnemonic(Wordlist.English, WordCount.Twelve).ToString() };

var projectInvestmentInfo = new ProjectInfo();
projectInvestmentInfo.TargetAmount = 3;
projectInvestmentInfo.TargetAmount = Money.Coins(3).Satoshi;
projectInvestmentInfo.StartDate = DateTime.UtcNow;
projectInvestmentInfo.ExpiryDate = DateTime.UtcNow.AddDays(5);
projectInvestmentInfo.Stages = new List<Stage>
Expand Down Expand Up @@ -750,7 +750,7 @@ public void InvestorTransaction_NoPenalty_Test()
// create the investment transaction

var seeder1InvTrx = operations.CreateInvestmentTransaction(network, seeder1Context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);

seeder1Context.TransactionHex = operations.SignInvestmentTransaction(network, seeder1Context.ChangeAddress,
seeder1InvTrx, null, new List<UtxoDataWithPath>(), _expectedFeeEstimation)
Expand Down
3 changes: 2 additions & 1 deletion src/Angor.Test/ProtocolNew/AngorTestData.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Angor.Shared;
using Angor.Shared.Models;
using Angor.Shared.Networks;
using Blockcore.NBitcoin;
using Blockcore.NBitcoin.BIP39;
using Microsoft.Extensions.Logging.Abstractions;
using Moq;
Expand Down Expand Up @@ -35,7 +36,7 @@ protected ProjectInfo GivenValidProjectInvestmentInfo( WalletWords? words = null
startDate ??= DateTime.UtcNow;

var projectInvestmentInfo = new ProjectInfo();
projectInvestmentInfo.TargetAmount = 3;
projectInvestmentInfo.TargetAmount = Money.Coins(3).Satoshi;
projectInvestmentInfo.StartDate = startDate.Value;
projectInvestmentInfo.ExpiryDate = startDate.Value.AddDays(5);
projectInvestmentInfo.PenaltyDays = 10;
Expand Down
5 changes: 2 additions & 3 deletions src/Angor.Test/ProtocolNew/FounderTransactionActionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private Transaction GivenASeederTransaction(ProjectInfo projectInvestmentInfo)
projectInvestmentInfo.ProjectSeeders.SecretHashes.Add(seederContext.InvestorSecretHash);

return operations.CreateInvestmentTransaction(network, seederContext,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
projectInvestmentInfo.TargetAmount);
}

private Transaction GivenAnInvestorTransaction(ProjectInfo projectInvestmentInfo)
Expand All @@ -88,8 +88,7 @@ private Transaction GivenAnInvestorTransaction(ProjectInfo projectInvestmentInfo
context.InvestorKey = Encoders.Hex.EncodeData(seederKey.PubKey.ToBytes());
context.ChangeAddress = seederChangeKey.PubKey.GetSegwitAddress(network).ToString();

return operations.CreateInvestmentTransaction(network, context,
Money.Coins(projectInvestmentInfo.TargetAmount).Satoshi);
return operations.CreateInvestmentTransaction(network, context, projectInvestmentInfo.TargetAmount);
}

/// <summary>
Expand Down
Loading