Credit Manager

https://github.com/Paracosm-Labs/mintdeals-contracts/blob/main/contracts/CreditManager.sol

The CreditManager contract is another crucial component of the MintDeals platform, managing user credit scores, borrowing capacities, and interactions with the CreditFacility contract for lending and borrowing operations.

Key Functions

User Management

1. Register User

function registerUser(address user) external
  • Initializes credit information for a new user.

  • Sets the user's initial credit score to the baseline (500).

Asset Management

2. Supply

function supply(address tokenAddress, uint256 amount) external
  • Allows users to supply assets to the credit facility.

  • Transfers tokens from the user to the contract and then to the CreditFacility.

3. Withdraw

  • Enables admins to withdraw assets from the credit facility.

  • Redeems assets from CreditFacility and transfers them to the admin.

Borrowing and Repayment

4. Borrow

  • Allows users to borrow assets based on their credit score and borrowing capacity.

  • Ensures the borrowed amount doesn't exceed user limits or global credit limits.

5. Repay

  • Enables users to repay borrowed assets.

  • Calculates and deducts interest fees from the repayment amount.

6. Repay With Fees

  • Allows admins to make repayments using accumulated repayment fees.

Credit Score Management

7. Set Credit Score

  • Allows admins to adjust a user's credit score and boost factor.

  • Can increase or decrease the score based on the increase parameter.

Global Credit Limit Management

8. Update Global Max Credit Limit

  • Updates the global maximum credit limit based on the valuation of non-stablecoin assets.

Fee Management

9. Withdraw Fees

  • Allows admins to withdraw accumulated repayment fees.

Configuration

10. Set Interest Delta

  • Sets the interest delta in basis points.

11. Set Global Max Credit Limit

  • Sets or updates the maximum global credit limit.

12. Set Borrowing Multiplier

  • Sets or updates the borrowing multiplier used to determine max borrowable amount.

13. Set Score Steps

  • Sets the score steps used for increasing/decreasing credit scores.

14. Set Blocks Passed Threshold

  • Sets the threshold of blocks passed, used in credit scoring.

View Functions

15. Get Credit Info

  • Retrieves a user's credit score, credit balance used, and borrowing capacity.

Key Concepts

  1. Credit Score: A numeric representation of a user's creditworthiness, ranging from 250 - 500 to 850.

  2. Borrowing Capacity: The maximum amount a user can borrow, calculated based on their credit score and boost factor.

  3. Global Credit Limit: The maximum total credit that can be issued across all users.

  4. Interest Delta: An additional interest rate applied on top of the base rate from the CreditFacility.

  5. Boost Factor: A multiplier that can increase a user's borrowing capacity.

This contract is central to MintDeals' credit system, managing user credit scores, facilitating borrowing and repayment, and ensuring the overall health of the credit facility. It interacts closely with the CreditFacility contract to manage asset supply, borrowing, and repayment operations.

Last updated