# ♾️2.3 Fees

## 2.3.1 Protocol Fee (swapFeeAPR)

The protocol fees are defined as 0.5% per year on the exchange of credit for cash operations, namely, BuyCreditMarket and SellCreditMarket. The cash recipient always pays for the swap fee.

### 2.3.1.1 BuyCreditMarket

**Numeric examples**

**Example 1 (exactAmountIn)**

Bob borrows $100 from Alice due 1 year

Alice wants to sell her credit at 10% yearly

Candy pays $80 to buy a part of Alice's credit

Final result:

The fee recipient gets $5 in fragmentation fees plus ($80 - $5) * 0.005 = $0.375 in swap fees

Candy pays exactly $80 in cash and gets $82.5 = ($80 - $5) * 1.1 in credit

Alice gets $74.625 = $80 - $5 - $0.375 in cash

**Example 1 (exactAmountOut)**

Bob borrows $100 from Alice due 1 year

Alice wants to sell her credit at 10% yearly

Candy wants to purchase $88 worth of credit from Alice

Final result:

The fee recipient gets $5 in fragmentation fees plus ($88/1.1) * 0.005 = $0.4 in swap fees

Candy pays $85 = ($88/1.1) + $5 in cash and gets $88 in credit

Alice gets $79.6 = $88/1.1 - $0.4 in cash

### 2.3.1.1 SellCreditMarket

**Numeric examples**

**Example 1 (exactAmountIn)**

Assume the swap fee is 1% yearly

Alice borrows $100 from Bob to be repaid with 20% interest in 1 year

Candy wants to buy credit and is willing to pay 50% yearly

Bob sells his credit to Candy

Final result:

The fee recipient gets $0.8 = ($120/1.5) * 0.01

Bob gets $79.2 = ($120/1.5) - $0.8

Candy now owns $120 in credit

**Example 2 (exactAmountOut)**

Assume the swap fee is 1% yearly

Alice borrows $100 from Bob to be repaid with 20% interest in 1 year

Candy wants to buy credit and is willing to pay 50% yearly

Bob sells credit to Candy and wants to get exactly $50 in cash

Final result:

The fee recipient gets $5 in fragmentation fees plus $0.5 = $50 * 0.01 in swap fee

Bob gets exactly $50 in cash

Candy pays $55.5 = $50 + $5 + $0.5 and now owns $83.33 = ($50+$5)*1.5/(1-0.01) in credit

## 2.3.2 Fragmentation Fee

When a lender sells his credit to a new lender, for example, or uses it as future cash flow to borrow, a new CreditPosition is created in the process.

Eventually, the new CreditPosition will become liquidity at the due date. However, this new CreditPosition will also have to be claimed (see the claim chapter for more details), which means one additional transaction to be sent on-chain, for each credit fractionalization.

The Size team intends to run keeper bots to streamline the claim process and aggregate liquidity. However, this operation has some fixed costs in terms of gas, which is why a fixed fee is charged to the user causing the credit split.

Last updated