Collateral
Collateral is an asset that a borrower pledges as security for a loan. SRWA Lending Protocol is overcollateralized, which means that the user has to have more collateral then the loan value.
Collateralization is calculated using Loan-To-Value ratio. LTV Ratio is set by the admins on every pool and represents the assessment of lending risk for that pool.
User can deposit one asset and take out a loan in another, so the collateral is calculated like a sum of all deposits multiplied with LTV Ratio minus sum of all loans.
SUM(i) { user_deposit_balance[i] * pool_ltv_ratio[i] }