# Interest Fees

### How Interest Fees Work

Interest in Baker DAO works differently from traditional loans. Here's a comprehensive explanation of how the interest fee mechanism functions:

#### Basic Interest Calculation

The standard interest calculation follows this formula:

```
Interest Fee = Borrowed Amount × (INTEREST_APR_BPS / BPS_DENOMINATOR) × (Loan Duration in Days / 365)
```

Where:

* `INTEREST_APR_BPS` is the annual interest rate in basis points (690 BPS = 6.9%)
* `BPS_DENOMINATOR` is 10,000 (standard basis point denominator)
* `Loan Duration in Days` is your selected loan term

For example, if you borrow 100 BERA for 30 days:

```
Interest Fee = 100 × (690 / 10,000) × (30 / 365) = 100 × 0.069 × 0.0822 = 0.567 BERA
```

#### The Minimum Interest Fee Mechanism

Baker DAO implements a minimum interest fee to ensure that the borrowing system cannot be exploited to bypass the burn fee. This is based on the smart contract function:

```solidity
function getInterestFee(uint256 borrowed, uint256 numberOfDays) public view returns (uint256) {
    uint256 interestFee = borrowed * INTEREST_APR_BPS * numberOfDays * 1e18 / 365 / BPS_DENOMINATOR / 1e18;
    uint256 overCollateralizationAmount = borrowed * (BPS_DENOMINATOR - COLLATERAL_RATIO) / COLLATERAL_RATIO;
    uint256 burnFee = (borrowed + overCollateralizationAmount) * burnFeeBps / BPS_DENOMINATOR;

    if(burnFee <= overCollateralizationAmount) {
        return interestFee;
    } else if(interestFee >= burnFee - overCollateralizationAmount) {
        return interestFee;
    } else {
        return burnFee - overCollateralizationAmount;
    }
}
```

Let's break down what this means:

1. The function first calculates a standard interest fee based on APR and duration
2. It then calculates the over-collateralization amount (the 1% buffer between the loan and collateral)
3. It determines what the burn fee would be if the user burned both the borrowed amount and the over-collateralization
4. Finally, it compares these values to determine the appropriate interest fee

```
 // Assume you have 100 BERA worth of BREAD
 // Borrow 99 BERA
 // If I sold my BREAD, I would get 100 BERA - 2.69% burn fee = 97.31 BERA
 // If I borrow BERA against that same BREAD, I should receive no more than 97.31 BERA
 // If I borrow 99 BERA, that means there is 1 BERA overCollateralizationAmount
 // Interest Fee should be at least (99 - 97.31) = 1.69 BERA
 // Ensure that borrowing + letting yourself get liquidated isn't cheaper than burning
```

#### How the Minimum Fee Works in Practice

The protocol ensures that taking a short-term loan and defaulting isn't cheaper than simply burning BREAD tokens. Here's how:

1. **Standard Case**: If the regular interest calculation (6.9% APR pro-rated for your loan duration) results in an interest fee higher than the minimum threshold, this standard interest is applied.
2. **Minimum Fee Case**: If the regular interest calculation would result in a fee lower than the minimum threshold, the fee is increased to the minimum.

The minimum fee is calculated as:

```
Minimum Fee = Burn Fee - Over-collateralization Amount
```

Where:

* `Burn Fee` is the cost of burning the equivalent amount of BREAD (2.69% of value)
* `Over-collateralization Amount` is the 1% buffer between borrowed amount and collateral

#### Fee Comparison Examples

**Example 1: 1-Day Loan**

* Borrow Amount: 100 BERA
* Duration: 1 day
* Standard Interest Calculation: 0.019 BERA (0.019%)
* Minimum Fee Check: Applies&#x20;
* Actual Fee: Minimum fee of 1.69% (1.69 BERA)

**Example 2: 365-Day Loan**

* Borrow Amount: 100 BERA
* Duration: 365 days
* Standard Interest Calculation: 6.9 BERA
* Minimum Fee Check: Standard interest exceeds minimum
* Actual Fee: 6.9 BERA


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.bakerdao.io/mechanics/interest-fees.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
