bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 15쪽 중 4쪽
mum amount required to invest in strategies
For function signatures, parameters, and data structures, see the [Fractional Reserve Contract Reference](/developers/contracts/fractional-reserve).
## Assets and corresponding strategies
Currently, USDC is supported with the [Aave V3 lending strategy](https://github.com/cap-labs-dev/tokenized-aave-v3). More assets and strategies coming soon!
# Minter
The [Minter](https://github.com/cap-labs-dev/cap-contracts/blob/main/contracts/vault/Minter.sol) contract handles fee calculation for the minting, burning and redeeming of cUSD, where dynamic fees are used to maintain the exposure of each backing asset to its optimal level. A balanced reserve composition reduces centralization of a particular asset, ensuring that the protocol is resilient to black swan events. Fees accrue to the treasury used for protocol safety.
## Mechanics
### Dynamic Mint/Burn Fees
Fees are dynamically adjusted according to the exposure of assets in the system. For each asset, there are two predefined piecewise linear functions that determine the mint/burn fees. Fees increase as they deviate from the optimal ratio, increasingly sharply beyond the kink ratio.
#### **Process Flow for Mint/Burn**:
1. **Pre-fee Calculation**: Calls `_amountOutBeforeFee` to get base amount and new ratio
2. **Whitelist Check**: Bypasses fees if user is whitelisted
3. **Fee Application**: Applies dynamic fees using `_applyFeeSlopes` if not whitelisted
#### Fee Calculations
<figure><img src="https://315632032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkRZQBMptsoesj7n1mr8a%2Fuploads%2Fgit-blob-994d13ae3bf90c96dbc2a430abd22fa846b00378%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
The fee system operates across three distinct zones based on where the current ratio is:
1. `current ratio <= optimal ratio`: Minimum mint fee to mint, 0 fees for burn
2. `optimal ratio < current ratio < kinkRatio`: Linear fee increase using the first slope
3. `current ratio > kinkRatio`: Steep fee increase using the second slope
Price Oracles are used for fee calculations and amount determination. A minimum mint fee is placed to prevent manipulation around price oracles.
The current minimum mint fee is set to 10bps, capped to 5% maximum.
#### Fee Parameters
| Parameter | Description | Validation |
| --------------- | ------------------------ | ---------------- |
| `minMintFee` | Base fee for minting | ≤ 0.05e27 (5%) |
| `optimalRatio` | Target allocation ratio | 0 < ratio < 1e27 |
| `mintKinkRatio` | Mint fee kink point | 0 < ratio < 1e27 |
| `burnKinkRatio` | Burn fee kink point | 0 < ratio < 1e27 |
| `slope0` | First slope coefficient | |
| `slope1` | Second slope coefficient | |
### Redeem Fees
Redeem fees in Cap Protocol are simple percentage-based fees applied to proportional redemption operations. Same fees apply to all assets proportional to their asset allocation. Whitelisted users pay 0% redeem fee
**Process Flow for Redeem**:
1. **Fee Determination**: Sets redeem fee (0 if whitelisted)
2. **Share Calculation**: Calculates user's share of total supply
3. **Amount Calculation**: Calculates proportional amount for each asset
4. **Fee Application**: Applies redeem fee to each asset amount
### Whitelisting
Whitelisted users can bypass fees for larger scale operations. Whitelist management is restricted to authorized admins.
For function signatures, parameters, and data structures, see the [Minter Contract Reference](/developers/contracts/minter).
# Lender
The Lender module manages the borrowing, repayment, and liquidation processes for Borrowers.
## Overview of Operations
1. [**Borrow/Repay**](/concepts/lender/borrow): Borrowers can borrow reserve assets against their delegated collateral
2. [**Liquidation**](/concepts/lender/liquidation): Multi-stage liquidation with grace periods and bonus incentives
3. [**Interest Rate Calculation**](/concepts/lender/interest-rates)**:** Dynamic protocol rates and fixed Borrower-specific rates
## Key Loan Parameters
* **Total Delegation:** Total amount of a Borrower's received collateral from Underwriters
* **Total Liquidatable Collateral:** Total amount of collateral that can be liquidated from an Underwriter
* **Total Debt:** A Borrower's total debt denominated in USD. Interest accrues to Total Debt
* **Initial Loan-to-Value (LTV):** The maximum amount a Borrower can borrow relative to the Total Liquidatable Collateral. A 50% LTV implies that delegations must be at least 2x the size of the borrow.
* **Current LTV**: A Borrower's current Loan-to-Value ratio, calculated as
* (Total Debt / Total Delegation) \* 100%
* **Liquidation Threshold**: Threshold that determines when a Borrower's position becomes liquidatable in LTV ratio. By default, the threshold is set to 80%.
* **Health Factor**: Represents a Borrower's loan health
* Calculated as (Total Delegation \* Liquidation Threshold) / Total Debt
* Liquidations are triggered when health factor is below 1
* **Grace Period**: Period for Borrowers to recover health before liquidation can occur. Set to 12 hours
* **Expiry Period:** Period after which liquidation rights expire. Set to 3 days
* **Target health:** Target health factor that Liquidators aim to achieve when liquidating a Borrower. Set to 125%
* **Bonus Cap:** Maximum bonus for Liquidators, set to 10%.
## Debt Management
The protocol has two distinct types of interest:
1. **Vault Interest**: Interest paid to the Vault (stcUSD holders)
2. **Underwriting Premium**: Premium paid to Underwriters who provide collateral coverage
Debt in Cap is managed via Debt tokens. Debt tokens are non-transferrable ERC-20 tokens that track a Borrower's debt. Debt tokens are minted when a Borrower borrows, and burned when the debt is repaid.
Interest automatically accrues to the debt token per asset, where the interest rate is calculated based on the [interest rate mechanism](/concepts/lender/interest-rates). Accrued interest is handled automatically via index-based scaling, inherited from the ScaledToken base class.
For function signatures, parameters, and data structures, see the [Lender Contract Reference](/developers/contracts/lender).
# Borrow
Whitelisted Borrowers in Cap can borrow and repay the underlying Vault assets, provided they have secured sufficient collateral from an Underwriter.
## Mechanics
### Borrow
The borrow process flow is as follows:
1. Borrower calls the <kbd>borrow</kbd> function on the Lender contract
2. Underwriter interest is realized first to prevent charging for compounded interest
3. If eligible to borrow\*, assets are lent out from the Vault to the Borrower
4. Debt tokens are minted to track the loan
**Key Validations\***:
* Borrower must have sufficient collateral and health factor
* Borrower must be whitelisted and not paused
* Asset being borrowed should not be paused
* Borrow amount must meet minimum requirements, and may not exceed maximum borrows
* Minimum: set by Admin via the setMinBorrow function
* Maximum: The smaller value of the Borrower's remaining borrow capacity, and the remaining available amount to be borrowed from the Vault
### Repay
The repay process flow is as follows:
1. Borrower calls the <kbd>repay</kbd> function on the Lender contract
2. Underwriter interest is realized first to ensure all interest is accounted for
3. The repayment is processed in the following order:
1. Unrealized underwriting premium (if any)
2. Vault principal debt
3. Vault interest
4. Debt tokens corresponding to the total amount repaid are burned
{% hint style="info" %}
If the repayment is not in full, the system will maintain a minimum borrow amount for the Borrower.
{% endhint %}
#### Interest Distribution
The repaid assets are distributed back to the shareholders:
1. **Vault Principal**: Sent to [Vault](/concepts/vault) contract's reserves
2. **Vault Interest**: Sent to `interestReceiver` (set to [Fee Auction](/concepts/fee-auction)). Any excess interest will go to the interest receiver
3. **Underwriting Premium**: Sent to [Delegation](/concepts/delegation) contract for distribution to Underwriters
4. **Unrealized Interest**: Added to Borrower's debt balance for future repayment
### Realizing Interest
Interest in Cap is **accrued continuously** but **realized discretely**:
* **Accrued Interest**: Calculated in real-time based on elapsed time and rates
* **Realized Interest**: Actually borrowed from vault and distributed to recipients
* **Unrealized Interest**: Accrued but not yet realized due to vault liquidity constraints
As can be seen, interest can be realized prior to repayment in Cap. Both stcUSD holders and Underwriters may permissionlessly realize interest by borrowing from the vault and distributing to interest receivers.
There are two functions to realize interest: <kbd>realizeInterest</kbd> and <kbd>realizeRestakerInterest</kbd>
RealizeInterest:
* Realizes vault interest (interest paid to the stcUSD holders)
* Interest is borrowed from the Vault and paid to the interest receiver
RealizeRestakerInterest:
* Realizes underwriting premium (premium paid to Underwriters)
* Interest is borrowed from the Vault and paid to the Delegation contract
For both functions, the process flow is as follows:
1. Determine available interest to realize
2. Increase reserve debt
3. Borrow interest amount from Vault
4. Transfer assets to recipient
For function signatures, parameters, and data structures, see the [Lender Contract Reference](/developers/contracts/lender).
# Liquidation
When a Borrower's health factor drops below 1, Liquidators can purchase the Borrower's delegated collateral by repaying their outstanding debt via a Dutch auction.
## Mechanics
The liquidation process is as follows:
1. The liquidation process kicks off with a Liquidator calling the <kbd>openLiquidation</kbd> function
2. After the liquidation has been initiated, the Borrower has a grace period of 12 hours to improve the health of the loan
1. If the current Loan-to-Value exceeds the emergency liquidation threshold, the grace period is overridden, opening the liquidation window immediately.
3. At the end of the grace period, Liquidators can call the <kbd>liquidate</kbd> function until the expiry of the liquidation period. Liquidations will expire in 3 days after the end of the grace period.
4. A successful liquidation will execute a repayment of the borrowed asset, reducing the debt by the liquidation amount
5. The liquidated amount and the liquidation bonus is taken from the Underwriter's collateral via the Shared Security Network, transferring the collateral to the Liquidator
6. The liquidation window will close once the Borrower's health is recovered, i.e. health factor over 1
#### Liquidation Threshold
By default, the liquidation threshold is set to 80% LTV. If the current LTV exceeds the liquidation threshold, then a liquidation may be opened. An emergency liquidation mechanism is used to override the grace period if the health factor drops significantly. The emergency liquidation threshold is set to 90% LTV.
#### Liquidation Expiry
All liquidations have an expiry window. The window ensures that once the position becomes healthy again, the Borrower will no longer be liquidatable. Hence, if the Borrower were to be liquidatable again, the Borrower will be ensured another grace period. If the Borrower's health factor is below 1 after the expiry, any Liquidator can initiate the liquidation process again.
#### Target Health and Maximum Liquidatable Amount
Target health is a health factor threshold that defines the desired health level that liquidations should restore a Borrower's position to, currently set at 1.25. It acts as a "safety buffer" that liquidations aim to achieve.
The target health defines the maximum liquidatable amount. The maximum liquidatable amount is calculated as:
<kbd>((Target Health \* Total Debt) - (Total Delegation \* Liquidation Threshold)) / ((Target Health - Liquidation Threshold) \* Asset Price)</kbd>
In other words, the goal is for the health factor, i.e.
<kbd>Total Delegation \* Liquidation Threshold / (TotalDebt - Liquidated Amount)</kbd>
to be equal to the target health factor.
#### Liquidation Bonus (Dutch Auction)
The protocol implements a dynamic liquidation bonus system via a descending-price Dutch auction that provides incentives for Liquidators. The liquidation bonus rises linearly with time from the grace period until the maximum amount reaches the bonus cap. At expiry, Liquidators earn the maximum bonus which is set to 10%. If an emergency liquidation is triggered, Liquidators bypass the grace period, immediately earning the maximum bonus.
Note that the bonus is only available when the total delegation exceeds total debt. The protocol prevents over-liquidating beyond available collateral.
For function signatures, parameters, and data structures, see the [Lender Contract Reference](/developers/contracts/lender).
# Interest Rates
Cap's interest rate mechanism consists of benchmark rates, market rates, utilization rates, and underwriting premiums to ensure sustainable lending operations and proper compensation for risk-takers.
## Mechanics
The total interest that Borrowers pay can be summarized as:
* Minimum Rate + Utilization Rate + Underwriting Premium
where Minimum Rate is the maximum of the Benchmark Rate and the Market Rate
Each rate is defined as below:
1. **Benchmark Rate**: Minimum interest rates set by protocol, in fixed yearly rates
2. **Market Rate**: Dynamic rates fetched from external lending markets and oracles
3. **Utilization Rate**: Dynamic rates based on asset utilization. Calculated via a piecewise linear function and a rate multiplier
4. **Underwriting Premium**: Fixed annual rate paid by the Borrower to the Underwriter backing them
<figure><img src="https://315632032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkRZQBMptsoesj7n1mr8a%2Fuploads%2Fgit-blob-92741992a30f264ef60c40a440e17b0a0c70222d%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
Let us breakdown the interest formula:
#### 1. Minimum rate
The minimum rate represents a lower bound on the interest rates, and is determined by the greater value of the preconfigured benchmark rate and the market rate. The rationale for the minimum rate stems from the Fractional Reserves. Because Cap earns base yield from the underlying idle assets, Borrowers must be able to provide more than the base yield in order to borrow from Cap.
For instance, if the benchmark yield set by Cap is set at 5%, and the current strategy for the Fractional Reserve of USDC is AAVE v3 earning rate is 4.5%, the minimum rate would be 5%. The minimum rate ensures that Cap's interest rates are greater than the base yield at all times.
#### 2. Utilization Rate
The utilization rate is a function of a piecewise linear-kink model and a rate multiplier.
The piecewise function allows interest rates to rise linearly along the first slope up to the "kink", or target utilization rate, set at 90%, after which rates increase rapidly along the second slope. This allows short term modulation of the rate where borrowing is disincentivized beyond the kink.
The rate multiplier is determined by the deviation of the current utilization rate from the target rate. If the current rate is far below the target rate, and remains there for a long period, then it must be the case that the current target rate is too high to incentivize borrowing. Based on the elapsed duration of the deviation and the degree of the difference between the current utilization rate and target, the multiplier will decrease the current rate, effectively shifting the piecewise function down. This control allows for a longer term modulation, optimizing Cap's interest rates in an autonomous way.
#### 3. Underwriting Premium
The underwriting premium is the fixed yearly rate that Borrowers pay to the Underwriters that back them. The rate is determined as a bilateral agreement between the Borrower and Underwriter, and is unique per each pair.
Putting the pieces together, when calculating the interest rate, the system does the following:
1. Fetch market rate from oracle
2. Compare with benchmark rate (minimum floor)
3. Use higher of market or benchmark rate
4. Add utilization rate on top
For function signatures, parameters, and data structures, see the [Lender Contract Reference](/developers/contracts/lender) and [Oracle Contract Reference](/developers/contracts/oracle).
# Fee Auction
The [Fee Auction](https://github.com/cap-labs-dev/cap-contracts/blob/main/contracts/feeAuction/FeeAuction.sol) facilitates permissionless Dutch auctions where collected protocol fees are sold to the winning bidder. The proceeds are sent to the [Fee Receiver](https://github.com/cap-labs-dev/cap-contracts/blob/main/contracts/feeReceiver/FeeReceiver.sol) to convert to cUSD and distribute to stcUSD holders. The Fee Auction module provides an efficient and transparent way to distribute accumulated fees to participants while ensuring fair price discovery through time-based price decay.
## Mechanics
### Overview of Operations
1. **Interest Harvesting**: Interest Harvester realizes accumulated interest and sends it to Fee Auction
2. **Dutch Auction**: Fee Auction sells accumulated assets via a Dutch auction mechanism
3. **Fee Distribution**: Fee Receiver collects cUSD from auction sales and distributes to stcUSD token holders
<figure><img src="https://315632032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkRZQBMptsoesj7n1mr8a%2Fuploads%2Fgit-blob-0cb0bc8c4b06edf932883fb8aa26456a43c8b621%2Fimage.png?alt=media" alt=""><figcaption><p>Flow of Funds: Fee Auction</p></figcaption></figure>
### Dutch Auction Mechanics
* Admin sets a starting price (in cUSD) and the duration of auctions.
* The price decays linearly over time (up to 90% or until minimum price is reached) until a winning bidder makes a purchase. All accumulated fees are distributed to the buyer.
* The purchase triggers the start of the next auction, where the starting price is set to be double the settled price.
### Key Auction Parameters
* **Starting Price**: Initial price set by admin for each auction (in cUSD)
* **Duration**: Auction duration set to 24 hours by default
* **Minimum Start Price**: Minimum starting price set to 100 cUSD
* **Payment Token**: cUSD is used as the payment token for all auctions
* **Recipient**: Fee Receiver contract receives all auction proceeds
* **Price Multiplier**: New auction starts at 2x the settled price of the previous auction
For function signatures, parameters, and data structures, see the [Fee Auction Contract Reference](/developers/contracts/fee-auction).
# Delegation
The Delegation module serves as a middleware between Shared Security Networks and the credit marketplace, enabling:
* **Borrower Management:** Register SSN Borrowers to Cap, setting their LTV/liquidation ratio and underwriting premiums
* **Collateral Provision**: Underwriters can collateralize Borrowers for borrow capacity
* **Liquidation:** Execute liquidation of delegated collateral during liquidation events
* **Reward Distribution**: Distribute rewards to Underwriters proportionally to their coverage
Cap supports multiple SSNs. Currently integrated SSNs include:
* [Symbiotic](/concepts/delegation/symbiotic)
* EigenLayer
## Overview of Cap SSN Requirements
### Isolated Coverage
Delegation coverage is isolated both on a Network level and a Borrower level. Each Borrower is uniquely mapped to a SSN and an Underwriter. Each Borrower receives unique, isolated stake from a single Underwriter such that liquidation risk is not shared.
Network level isolation means that delegations cannot be "restaked" across multiple slashable restaking protocols — because delegations are used as collateral in Cap, a liquidation event in a different Network other than Ca프로젝트로 돌아가기