Comment on page
Collateral & Borrowing
Once the rule is chosen, the user can deposit an asset that was registered by the market owner. If the borrowing is enabled for the asset then the user is earning the proportional part of interest paid by borrowers.
If the asset is specified by the user-chosen rule as collateral, the user can mark it as collateral by calling set as collateral.
If a user has deposited some assets and marked at least one as a collateral then the user can borrow, by calling borrow, any asset that is allowed for borrowing by the user-chosen rule. The users' debt is increasing with time as interest is accumulating.
At any time user can repay any debt the user has taken by calling repay.
If at any time, due to accumulation of interests or assets price oscillations, the user position coefficient Health Factor becomes equal or smaller than 1, anyone can liquidate the user's position by calling liquidate. The liquidator pays part of the user's debt and gets the right part of the user's collateral. The value of the revived collateral by the liquidator is higher than the value of the debt he is repaying. In this way, liquidators are rewarded and users who have managed their position wrongly are punished. The penalty/reward is proportional to the amount of the liquidated debt and the penalty parameter specified for each asset by market rules.