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

Runtime API: Extend InvestmentPortfolio with pending swaps #1635

Open
wischli opened this issue Nov 30, 2023 · 0 comments
Open

Runtime API: Extend InvestmentPortfolio with pending swaps #1635

wischli opened this issue Nov 30, 2023 · 0 comments
Assignees
Labels
I8-enhancement An additional feature. P5-soon Issue should be addressed soon. Q3-medium Can be done with good experience in the language, but little knowledge of the codebase.

Comments

@wischli
Copy link
Contributor

wischli commented Nov 30, 2023

Description

Proposal

struct InvestmentPortfolio {
    ...
    /// Investment currency locked and awaiting a swap to the pool currency to be invested
    pending_invest_swaps: BTreeMap<Currency, Balance>,
    /// Pool currency locked and awaiting a swap to the investment currency to be claimed
    pending_redeem_swaps: BTreeMap<Currency, Balance>,
}

For now, this design is a bit overkill as there can be at most one swap per (investment_id, account_id) pair such that at most one of the maps would have exactly one entry. However, in the future we want to open up multiple investments for the same (investment_id, account_id) pair (project name MultiCurrency) which will benefit from the above design.

Research/based on

Conversation in k-f slack with @hieronx: https://kflabs.slack.com/archives/C05JM3VBD9V/p1701342364508009?thread_ts=1701340658.313919&cid=C05JM3VBD9V

How will this affect the code base

Improves UX

What are foreseen obstacles or hurdles to overcome?

Bump InvestmentsApi from V1 to V2

@wischli wischli added Q3-medium Can be done with good experience in the language, but little knowledge of the codebase. P5-soon Issue should be addressed soon. I8-enhancement An additional feature. labels Nov 30, 2023
@wischli wischli self-assigned this Nov 30, 2023
@wischli wischli added this to the Centrifuge 1025 milestone Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I8-enhancement An additional feature. P5-soon Issue should be addressed soon. Q3-medium Can be done with good experience in the language, but little knowledge of the codebase.
Projects
None yet
Development

No branches or pull requests

2 participants