Skip to content

Allow the same investor to invest multiple times in the same project#683

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/research-multiple-investments
Draft

Allow the same investor to invest multiple times in the same project#683
Copilot wants to merge 2 commits intomainfrom
copilot/research-multiple-investments

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

The investor key was derived deterministically from wallet + project with no index component (m/5'/0'/{upi}'/3'), making it impossible for the same wallet to hold more than one investment in a given project. Portfolio storage compounded this by enforcing a single record per project.

Key changes

HD key derivation

  • DeriveInvestorKey / DeriveInvestorPrivateKey gain an investmentIndex parameter (default 0, fully backward-compatible)
  • New path: m/5'/0'/{upi}'/3'/{investmentIndex}' — each investment produces a distinct key pair

Investment creation (BuildInvestmentDraft)

  • Injects IPortfolioService and counts existing records for the project to auto-determine the next index
  • Index is carried through InvestmentDraft.InvestmentIndex → stored in InvestmentRecord.InvestmentIndex

Portfolio storage (PortfolioService)

  • AddOrUpdate / RemoveInvestmentRecordAsync now key on InvestorPubKey (globally unique per investment) instead of ProjectIdentifier, allowing multiple records per project

Recovery & claim operations

BuildRecoveryTransaction, BuildEndOfProjectClaim, BuildUnfundedReleaseTransaction, BuildPenaltyReleaseTransaction, GetRecoveryStatus, CheckForReleaseSignatures all gain an optional InvestmentTransactionHash parameter to disambiguate which investment to act on; the matched record's InvestmentIndex is used to derive the correct private key.

Investment listing (GetInvestments)

Returns one InvestedProjectDto per investment record rather than one per project, using deduplicated project IDs for the upstream project service query.

UI layer

FundedBase, FundInvestorData, and InvestmentInvestorData forward InvestmentId to all recovery/status requests so each UI item targets its specific investment.

// Second investment from the same wallet now derives a distinct key
var key0 = derivation.DeriveInvestorKey(words, founderKey, 0); // existing
var key1 = derivation.DeriveInvestorKey(words, founderKey, 1); // new investment
Assert.NotEqual(key0, key1);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll ACCEPT (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: dangershony <7487930+dangershony@users.noreply.github.com>
Copilot AI changed the title [WIP] Research allowing multiple investments from same investor Allow the same investor to invest multiple times in the same project Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants