Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

docs: Expand readme for investments #33

wants to merge 4 commits into from

Conversation

onnovisser
Copy link
Collaborator

Description

This pull request...

#

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Retrieve a vault by querying it from the Pool:

```js
const pool = await centrifuge.pool('1')
Copy link
Contributor

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

Copy link
Collaborator Author

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 do useTranche(Number(poolId), trancheId)

Copy link
Contributor

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

Invest in a vault:

```js
const result = await vault.increaseInvestOrder(1000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be 1000*10**decimals? I would make that clear by using the relevant type for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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 number*10**decimals in the function. My thinking was that it would be good to not force users to work with the decimals and do conversions. But maybe it's confusing that increaseInvestOrder(1000) and increaseInvestOrder(1_000_000_000n) will invest the same amount.

Copy link
Contributor

Choose a reason for hiding this comment

The 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 CurrencyBalance as an input here. To force the user to clearly specify what the input denomination should be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.


```js
const investment = await vault.investment('0x123...')
// Will return an object containing:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really helpful 🙌

onnovisser and others added 3 commits December 16, 2024 15:07
@onnovisser onnovisser added the alpha Include in alpha release label Dec 16, 2024
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.25%. Comparing base (6ae2d36) to head (611f184).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   88.59%   89.25%   +0.66%     
==========================================
  Files          24       24              
  Lines        3033     3034       +1     
  Branches      266      275       +9     
==========================================
+ Hits         2687     2708      +21     
+ Misses        339      319      -20     
  Partials        7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha Include in alpha release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants