centrifuge / apps

Monorepo for Centrifuge frontends, including Centrifuge App, onboarding api, and Fabric design system.
GNU Lesser General Public License v3.0
27 stars 16 forks source link

Add cashflow section to asset detail page #2241

Open mustermeiszer opened 5 months ago

mustermeiszer commented 5 months ago

Goal

Query the Centrifuge chain to know what kind of cash flows the chain is expecting on a certain asset and when it is expecting them. Then visualize these cashflows in a bar graph

Design

Design: https://www.figma.com/design/cn5CiQsuVDOmieszqcneX2/Pool-management?node-id=2408-14869&t=5FOUxemgdNB7UiqR-4

image

Open Questions

Technical

How to query the chain

NOTE: If the given PoolId or LoanId DOES NOT exist the chain will return a success but containing null.

Datastructures

expectedCashflows

The call to the chain will return an Array of the following type

class CashflowPayment {
   when: number,
   principal: BigInt,
   interest: BigInt,
}

portfolio

The call to the chain will return an Array of the following type [LoanId, ActiveLoanInfo]

class ActiveLoanInfo {
   active_loan: ActiveLoan,
   /// Present value of the loan
   present_value: BigInt,
   /// Current outstanding principal of this loan
   outstanding_principal: BigInt,
   /// Current outstanding interest of this loan
   outstanding_interest: BigInt,
   /// Current price for external loans
   /// - If oracle set, then the price is the one coming from the oracle,
   /// - If not set, then the price is a linear accrual using the latest
   ///   settlement price.
   current_price: Option<Price>, 
}
mustermeiszer commented 5 months ago

Superseeds https://github.com/centrifuge/apps/issues/2225

mustermeiszer commented 5 months ago

@onnovisser is the return behaviour of the runtime api calls correctly described - i.e. does it return null?