Credit Manager
Last updated
Last updated
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.
function registerUser(address user) external
Initializes credit information for a new user.
Sets the user's initial credit score to the baseline (500).
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.
function withdraw(address tokenAddress, uint256 amount) external
Enables admins to withdraw assets from the credit facility.
Redeems assets from CreditFacility and transfers them to the admin.
function borrow(address tokenAddress, uint256 amount) external
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.
function repay(address tokenAddress, uint256 repaymentAmount) external
Enables users to repay borrowed assets.
Calculates and deducts interest fees from the repayment amount.
function repayWithFees(address tokenAddress, uint256 amount) external
Allows admins to make repayments using accumulated repayment fees.
function setCreditScore(address user, uint256 scoreStep, bool increase, uint256 newBoostFactor) external
Allows admins to adjust a user's credit score and boost factor.
Can increase or decrease the score based on the increase
parameter.
function updateGlobalMaxCreditLimit(address cTokenAddress) external
Updates the global maximum credit limit based on the valuation of non-stablecoin assets.
function withdrawFees(address tokenAddress, uint256 amount, address to) external
Allows admins to withdraw accumulated repayment fees.
function setInterestDeltaBP(uint256 _delta) external
Sets the interest delta in basis points.
function setGlobalMaxCreditLimit(uint256 newLimit) external
Sets or updates the maximum global credit limit.
function setBorrowingMultiplierBP(uint256 newMultiplier) external
Sets or updates the borrowing multiplier used to determine max borrowable amount.
function setScoreSteps(uint256 _borrowScoreStep, uint256 _repayScoreStep) external
Sets the score steps used for increasing/decreasing credit scores.
function setBlocksPassedThreshold(uint256 _blocksPassedThreshold) external
Sets the threshold of blocks passed, used in credit scoring.
function getCreditInfo(address user) external view
Retrieves a user's credit score, credit balance used, and borrowing capacity.
Credit Score: A numeric representation of a user's creditworthiness, ranging from 250 - 500 to 850.
Borrowing Capacity: The maximum amount a user can borrow, calculated based on their credit score and boost factor.
Global Credit Limit: The maximum total credit that can be issued across all users.
Interest Delta: An additional interest rate applied on top of the base rate from the CreditFacility.
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.