Users can borrow funds from the funding pool. Collateral is the amount of tokens a user deposits in addition to the amount he is borrowing from the pool. In addition to collateral, users must also post maintenance margin - This can be thought of as insurance on the borrowed amount.
The amount a user borrows relative to the amount of collateral he posts is called his leverage. Each market has limits on the amount a user can borrow and the amount of leverage he can use.
As time goes on, a given user pays interest on the amount he has borrowed - The amount of interest he pays is dependent on the interest rate and the duration for which his position has been opened.
Liquidation
When a user opens a position he converts his borrowed amount plus his collateral amount into asset tokens. In other words he does this:
If the amount of asset tokens he has is worth less than the collateral amount he has borrowed then he can be liquidated:
swap(asset tokens) < collateral amount = can be liquidated
If this is the case then a seperate user can attempt to liquidate the position. In the case of a liquidation, the following swap function is carried out: