feat: secondary market for pool positions and co-funding shares (#1025) - #1030
Merged
sanmipaul merged 2 commits intoJul 30, 2026
Conversation
…ra-hq#1025) - Add Listing, ListingStatus, ListingKind types to pool contract - Add PoolError variants: ListingNotFound, ListingNotOpen, ListingNotSeller, InsufficientListingBalance, TooManyListings - Add Symbol storage keys: LISTING_DATA, LISTING_IDS_INV, LISTING_IDS_SELLER, LISTING_COUNTER (DataKey is at Soroban 50-variant ceiling) - Implement list_position: validates CoFundShare/deployed balance, enforces compliance gate, per-invoice cap (50), allocates listing ID - Implement cancel_listing: seller-only, open listings only - Implement buy_listing: compliance + KYC + concentration-cap checks on buyer, atomically transfers CoFundShare bps or deployed principal slice, debits buyer available and credits seller available - Implement get_listing, list_listings_for_invoice, list_listings_for_investor - Emit lst_open / lst_cncl / lst_buy events under pool EVT topic - Add secondary_market_tests.rs: list, cancel, buy, index query, error paths - SDK: add Listing/ListingStatus/ListingKind types; add listPosition, cancelListing, buyListing, getListing, listListingsForInvoice, listListingsForInvestor to PoolClient - Indexer: register lst_open/lst_cncl/lst_buy event types; extract actor - Docs: add interacting-with-contracts.md documenting the full flow
Contributor
|
Great work @financialcrackerjack-max |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1025
Adds an opt-in secondary market so investors can exit deployed positions before invoice repayment, without relying on the low-liquidity withdrawal queue.
Changes
contracts/pool/src/lib.rsListing,ListingStatus(Open/Filled/Cancelled),ListingKind(CoFunding/SingleFunded)PoolErrorvariants:ListingNotFound,ListingNotOpen,ListingNotSeller,InsufficientListingBalance,TooManyListingsDataKeyis at Soroban 50-variant ceiling):LISTING_DATA,LISTING_IDS_INV,LISTING_IDS_SELLER,LISTING_COUNTERlist_position— seller lists a CoFundShare bps slice or a SingleFunded deployed-principal slice; compliance gate + per-invoice cap (50) enforcedcancel_listing— seller-only cancellation of open listingsbuy_listing— atomic claim transfer + price settlement; compliance, KYC, andmax_single_investor_bpsconcentration cap enforced on buyerget_listing,list_listings_for_invoice,list_listings_for_investor— read-only viewslst_open,lst_cncl,lst_buyunder the existingpoolEVT topiccontracts/pool/tests/secondary_market_tests.rslist_listings_for_invoice,list_listings_for_investor,get_listingfor nonexistent IDpackages/sdk/src/types.ts+packages/sdk/src/clients/pool.ts+sdk/src/client.tsListing,ListingStatus,ListingKindTypeScript typeslistPosition,cancelListing,buyListing,getListing,listListingsForInvoice,listListingsForInvestormethods onPoolClientindexer/src/parser.tslst_open,lst_cncl,lst_buyevent typesdocs/interacting-with-contracts.md