# Liquidation Manual

## Liquidation Overview

The Teller protocol works with both secured (ie. collateralized) and unsecured (ie. non-collateralized) loans. When a loan is borrowed, the collateral ratio is calculated as the combination of a liquidation buffer plus a liquidation reward. The current values are set as 15% and 5% respectively. Additionally, each loan has a unique expiration date. This is determined by a user’s loan request.

## Liquidation Scenarios

There are two scenarios when a loan can be liquidated:

1. Collateral value is less than `[Total Owed * (1 + Reward %)]`
2. Loan is overdue. The `current date > loan expiration` date

`Total Owed: Value of the loan borrowed and the interest owed`\
`Reward: Fee given to liquidator, initially set to 5%`

## Loan Types

Teller allows for several collateral types:

**Over-collateralized.** \
Collateral of 135% or above. Funds will be transferred from the lending pool directly to the borrower's wallet.&#x20;

If the value of the `collateral deposited` falls below the value of `[Total Owed * (1 + Reward %)]`, the loan is available for liquidation. Likewise, if the current date is greater than the loan expiration date, the loan is available for liquidation.

**Secured.** \
Collateral between 20%-134.99%. Funds are transferred from the lending pool to an escrow contract specific to the loan.&#x20;

If the value of the `collateral deposited plus the funds in escrow` falls below the value of `[Total Owed * (1 + Reward %)]`, the loan is available for liquidation. Likewise, if the current date is greater than the loan expiration date, the loan is available for liquidation.

**Unsecured.** \
No-collateral needed. Funds are transferred from the lending pool to an escrow contract specific to the loan.&#x20;

Liquidation can only occur if the loan is overdue.&#x20;

## How to Become a Teller Liquidator

Head to the open-source solidity repository of the Teller V1 Protocol [here](https://github.com/teller-protocol/teller-protocol-v1).

1. check out the `develop` branch
2. run `git pull`
3. run `yarn`
4. make sure your `.env` file has the proper mnemonic you want to use
5. make sure your address for the mnemonic has funds to liquidate the loan
6. run `truffle exec --network rinkeby ./scripts/loans/liquidate.js --tokenName {DAI} --collTokenName {ETH} --senderIndex 0`

The liquidation script will automatically attempt to liquidate any available loans.
