Collateral
In order to borrow assets, you must first collateralize your supplied position.
After a user has supplied assets into the protocol, they will begin earning interest automatically; however, their tokens won't automatically be usable as collateral. In order to activate an asset to be used as collateral, toggle the collateral slider in the market dashboard and approve the contract. A user can then borrow against their assets based on the amount of principal supplied and the collateral factor. The collateral factor is the maximum amount users can borrow for a given asset they have supplied.
For example:
- When a user supplies 100 USDC with a collateral factor of 85%, they can borrow as much as 85 USDC worth of other assets at a given time. If a user supplies two or more assets, then the amount they can borrow is determined by a weighted average. If a user supplied $50 USDC with a 85% collateral factor and $50 of WBTC with a collateral factor of 75%, then the user could borrow up to $80 USD.
An easy way to obtain your account's total liquidity if you have supplied multiple assets as collateral is to go to Unitroller contract address found in the Deployed Contracts section and enter your address into the
getAccountLiquidity
method. This returns the (error, current liquidity, shortfall). Current liquidity is the maximum USD value that an account can borrow before reaching liquidation. If an account reaches liquidation, then shortfall will return the USD value of abs((USD value of principal x collateral factor) - borrow balance).Last modified 1mo ago