We need to add one query to the Credit Agency: (open question... use the same name - CreditLine?)
enum QueryMsg {
TotalCreditLine{ account: String }
}
/// all results normalised with the price oracle to values in common_token
struct CreditLineResponse {
// sum of collateral from all markets
pub collateral: Uint128,
// sum of credit_line from all markets
pub credit_line: Uint128,
// sum of debt from all markets
pub debt: Uint128,
}
The simplest implementation iterates over all Markets making QueryMsg::CreditLine { account } on each and summing the results. We can optimize this later by limiting accounts.
The Credit Agency keeps track of all markets #19 and each market can report on the credit line of any account #21
This allows the credit agency now to compute a global credit line for each account, as per this section https://confio.slab.com/posts/credit-agency-ujs0yrvj#hx9za-calculating-credit-line
We need to add one query to the Credit Agency: (open question... use the same name - CreditLine?)
The simplest implementation iterates over all Markets making
QueryMsg::CreditLine { account }
on each and summing the results. We can optimize this later by limiting accounts.