centrifuge / pools-subql

Subquery for Pools on Centrifuge
MIT License
1 stars 4 forks source link

Track cash transfers as asset transaction type #134

Closed filo87 closed 1 month ago

filo87 commented 2 months ago

Extend AssetTransactionType

enum AssetTransactionType {
  CREATED
  BORROWED
  REPAID
  CLOSED
  CASH_DEPOSIT
  CASH_WITHDRAWAL
  CASH_TRANSFER // to/from onchain reserve 
}

Create OnchainCash asset When pool is created, create an asset by default with type = OnchainCash.

If there is a transfer debt from a non-cash asset to an OffchainCash asset

=> this will show up as a principal repayment in the Cashflows chart

If there is a transfer debt from an OffchainCash asset to non-cash asset

=> this will show up as a purchase in the Cashflows chart

If there is a purchase of an OffchainCash asset

=> this won't show up in the Cashflows chart

If there is a repayment of an OffchainCash asset

=> this won't show up in the Cashflows chart

filo87 commented 1 month ago

@hieronx Quick question...

We have these amount in the Debt transfer event repaidAmount and borrowAmount

Which one should we use for:

hieronx commented 1 month ago

@filo87 updated the description above.

the purchase CashTransfer ? the repaid CashTransfer ?

These are not based on transfer debt events (just normal Borrow/Repaid events of the cash asset)