-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Expand readme for investments #33
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,53 @@ const subscription = pool.closeEpoch().subscribe( | |
) | ||
``` | ||
|
||
## Investments | ||
|
||
Investments for a pool are done via [ERC-7540 Tokenized Vaults](https://eips.ethereum.org/EIPS/eip-7540). Vaults can be deployed for a tranche on any supported network, for any supported currency | ||
|
||
Retrieve a vault by querying it from the pool: | ||
|
||
```js | ||
const pool = await centrifuge.pool('1') | ||
const vault = await pool.vault(1, '0xabc...', '0xdef...') // Chain ID, tranche ID, investment currency address | ||
``` | ||
|
||
Query the state of an investment on the vault for an investor: | ||
|
||
```js | ||
const investment = await vault.investment('0x123...') | ||
// Will return an object containing: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is really helpful 🙌 |
||
// isAllowedToInvest - Whether an investor is allowed to invest in the tranche | ||
// investmentCurrency - The ERC20 token that is used to invest in the vault | ||
// investmentCurrencyBalance - The balance of the investor of the investment currency | ||
// investmentCurrencyAllowance - The allowance of the vault | ||
// shareCurrency - The ERC20 token that is issued to investors to account for their share in the tranche | ||
// shareBalance - The number of shares the investor has in the tranche | ||
// claimableInvestShares - The number of shares an investor can claim after their invest order has been processed (partially or not) | ||
// claimableInvestCurrencyEquivalent - The equivalent value of the claimable shares denominated in the invest currency | ||
// claimableRedeemCurrency - The amout of money an investor can claim after their redeem order has been processed (partially or not) | ||
// claimableRedeemSharesEquivalent - The amount of shares that have been redeemed for which the investor can claim money | ||
// pendingInvestCurrency - The amount of money that the investor wants to invest in the tranche that has not been processed yet | ||
// pendingRedeemShares - The amount of shares that the investor wants to redeem from the tranche that has not been processed yet | ||
// claimableCancelInvestCurrency - The amount of money an investor can claim after an invest order cancellation has been processed | ||
// claimableCancelRedeemShares - The amount of shares an investor can claim after a redeem order cancellation has been processed | ||
// hasPendingCancelInvestRequest - Whether the investor has an invest order that is in the process of being cancelled | ||
// hasPendingCancelRedeemRequest - Whether the investor has a redeem order that is in the process of being cancelled | ||
``` | ||
|
||
Invest in a vault: | ||
|
||
```js | ||
const result = await vault.increaseInvestOrder(1000) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this not be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It currently accepts numbers, bigints and CurrencyBalances. If a number is passed, it does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, I understand the perspective. I like the focus on simplifying user input, but do worry here that it will rather create issues with incorrect inputs. I would actually lean towards only allowing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not ideal, but maybe that's the way to go if we want to avoid confusion. |
||
console.log(result.hash) | ||
``` | ||
|
||
Once an order has been processed, `claimableInvestShares` will positive and shares can be claimed with: | ||
|
||
```js | ||
const result = await vault.claim() | ||
``` | ||
|
||
## Reports | ||
|
||
Reports are generated from data from the Centrifuge API and are combined with pool metadata to provide a comprehensive view of the pool's financials. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should input here not be a number rather than string? Since pool IDs are
uint64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should allow both. If we're parsing a URL like
/pools/123/0xabc
to get the pool id and tranche id, it's easiest if the user doesn't have to douseTranche(Number(poolId), trancheId)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's fair! Either way fine for now to keep as is