Select the coins you want in your index
(optional) Weight them by market cap
When someone wants to buy in they send their purchasing asset and it is used to buy the indexed assets.
When someone wants to cash out they return the token to issuer and the indexed assets are either sent or those assets are sold via path payment to allow cash out in any currency
There are many types of index products, and many potential way to organize an index token.
1 INDEXTOKEN could represent a set amount of each indexed asset:
1 BSINDEX7 = .0001BTC+10XLM+.25SLT+500RMT+.002ETH+385TERN+3.5XRP
This was arbitrarily chosen as BSINDEX7 = ~$5(current value) each of the following tokens – BTC, XLM, SLT, RMT, ETH, TERN, XRP
In this case, if someone wants to buy in with $100 USDC then the issuing software needs to calculate the current asset price ratios, buy the equivalent amount of assets, and send the correct amount of BSINDEX7 to the buyer. You could use path payment strict send to let Stellar do some of the math for you.
Cash out is simple – send the amount of each asset that corresponds to the amount of BSINDEX7 upon receiving the BSINDEX7 token. You can even use path payment to cash them out to their preferred currency.
Or it could be a dynamic index offering.
Perhaps you want the fund to try to maintain the asset valuation ratios as they start to change:
Every time someone buys from the issuer their money is pooled evenly (or weighted by market cap) regardless of token price ratio (for BSINDEX7 that would be buy-in_amount/7) and then trade for the indexed tokens. Path payment would also work for this operation.
Then when someone sells back to the issuer it simply gives them the equivalent share of each held asset based on (amount of the indexed asset)*%circulating_supplyBSINDEX7. Also optionally using path payment to their preferred asset.
I intend to make a personal index token using this methodology both for testing and as an easier way to exit multiple positions when the whole market is plummeting.