Closed djudjuu closed 4 years ago
with this we should be able to
[1] with different interest rates (even different ones for lenders & guarantors, although that would be represented only indirectly)
e.g.
this is fairly complex already, but at least it allows to create and settle loans with all outcomes. the guarantor only required minimal extra complexity, so I put that in as well. lots of the logic is in the payables table, which kind of keeps track where the individual money of all people went. e.g. by filtering for all
Query1: payables where status=open & p_type=lent
-> we would get the corpus
query2: payables where status=open & p_type=share_guarantee & payToUser=lender_A
-> we would get all the shares in the corpus that lender_A has uses as guarantee
query3: payables where status=open & p_type=cash_guarantee & payToUser=lender_A
-> would be all the cash that from lender_A that has been moved to escrow to guarantee the loan and will be returned to them if the loan is paid back
From https://github.com/ArboreumDev/high-level-planning/issues/11
DB Schema:
users
:enum
)balances
central_risk
data provided from the central source on the individual default risk
recommendation_risk
each agent keeps a list of recommendation risks of their neighbours
edges
weight
loan_requests
loans
loan_participants
payables
enum
['guarantee',lent
, `cash_guarantee']