Kresko Documentation
GitHubWhitepaperTwitterDiscord
  • ℹ️Kresko 101
  • fundamentals
    • CDPs
      • ICDP
        • Deposit
        • Withdraw
        • Burn / Repay
        • Minting / Borrowing
        • Liquidations
      • SCDP
        • Deposits
        • Swaps
        • Liquidations
    • Collateral Assets
    • Kresko Assets
    • KISS
    • Synth Wrap
    • Liquidations
    • Oracles
    • Glossary
    • Litepaper
  • Developers
    • Contracts Overview
    • Liquidations
    • Errors
  • contracts
    • Deployment Addresses
  • Security
    • Audits
    • Bug Bounty
  • Brand Kit
    • Design Resources
  • Events
    • Closed Beta
    • Quest for Kresk: Season 0
      • Scoring Methodology
      • FAQs
Powered by GitBook
On this page
  • CDPs Act As Cross Positions In Kresko
  • CDP Example
  • Overcollateralization
  • Collateral/Deposit Value
  • Total Deposit Value
  • Debt Value
  • Total Debt Value
  • Collateralization Ratio
  • Minimum Collateralization Ratio
  • Liquidation Threshold
  • Health Factor
  1. fundamentals

CDPs

Collateralized Debt Position

PreviousKresko 101NextICDP

Last updated 1 year ago

This documentation is a work in progress!

A collateralized debt position (CDP) is a system introduced by MakerDAO team with their decentralized stablecoin DAI.

Generally speaking it is a overcollateralized lending contract where borrowers collateral and assets against the deposited collateral. The contract itself acts as a counterparty when borrowers open a debt position.

Borrowers using these CDP's cannot their collateral if it takes the CDP below the set in the contract.

CDPs Act As Cross Positions In Kresko

One or more collaterals back each CDP and borrowers can take multiple debt positions on a single CDP. They effectively act as cross-margined positions with many-to-many collateralization as opposed to 1-to-1 positions also known as isolated margin.

CDP Example

Example

  • Collateral DAI has a cFactor of 1. Oracle price $1

  • Collateral wBTC has a cFactor of 0.8. Oracle price $15000

  • krAsset krETH has a krFactor of 1.1. Oracle price $1000

  • krAsset krQQQ has a krFactor of 1. Oracle price $200

  • Protocol MCR is 140%

Bob deposits 1500 DAI and 0.1 wBTC as collateral

Calculating the

  1. DAI: $1500 * 1 = $1500

  2. wBTC: $150 * 0.8 = $120

Bob's total collateral value is $1620

Bob sends a transaction to mint 1 krETH

Calculating the

  1. krETH: $1000 * 1.1 = $1100

Total collateral Bob needs to cover this mint:

$1100 * 140% = $1540

As $1540 is less than $1620. Bob is a able to mint 1 krETH

Bob wants to mint 1 krQQQ

Calculating the debt value

  1. krQQQ: $200 * 1 = $200

Total collateral value Bob needs to cover this mint:

($1100 + $200) * 140% = $1820

We can see that Bob has insufficient collateral ($1620) to cover the mint so the transaction would fail.

Overcollateralization

Collateral/Deposit Value

The quantity, price, and the asset's collateral factor are used to determine the deposit value (v) of an individual collateral deposit. Deposit value enables the protocol to properly weight different collaterals and calculate the total deposit value of the assets in real-time.

Example

If Alice has deposited 1,000 USDC, oracle price of 1 USDC = $1.01, CF for USDC = 0.99, then the deposit value can be calculated as follows:

Total Deposit Value

For multiple collaterals, the total deposit value (V) is calculated by adding the deposit values of all the individual assets deposited.

Given n collaterals, a user’s total deposit value V is calculated as follows:

Example

If Alice has deposited 1,000 USDC (v = $990), 1 ETH (v = $2,734.01), and 600 OP (v = $1,072.55), then the total deposit value is:

Debt Value

The quantity, price, and kFactor are used to determine the debt value (d) incurred by borrowing a Kresko Asset.

Example

Alice wants to borrow 1 krTSLA, Oracle price of 1 TSLA = $1,000, kFactor for TSLA = 1.05, then the debt is:

Total Debt Value

For multiple Kresko Assets borrowed, the total debt value (D) is calculated by combining the debt values of each asset.

Given n krAssets, total debt D is:

Example

if Alice has borrowed 1 krTSLA (d = $1,050), 1 krAAPL (d = $180), and 1.2 krIAU (d = $48), then the total debt is:

Example

If Alice has borrowed 1 krTSLA (d = $1,050), 1 krAAPL (d = $180), and 1.2 krIAU (d = $48), then the total debt is:

Collateralization Ratio

Collateralization Ratio (CR) for an account is obtained by dividing the combined collateral value V with outstanding combined debt value D.

If Alice’s total deposit value is $4,806.46 and her total debt is $1,278, then her collateral ratio is

Minimum Collateralization Ratio

Core risk mitigation of a CDP is the minimum collateralization ratio (MCR). It is the minimum collateralization ratio that allows taking on new debt.

If a CDP's collateralization ratio is under the MCR It does not mean it can be liquidated.

Minimum collateral value required

Liquidation Threshold

Health Factor

In simple terms this means that for any amount of to exist it must be backed by a deposit of equal or greater value.

The protocol needs to stay solvent, avoiding scenario where any CDP has a less than its . Protocol ensures this by only allows borrows up to a portion of the collateral provided, enforced by , and . As asset valuations change over time, the final backstop for solvency is .

Given a user’s collateral a, oracle price PaP_aPa​, quantity QaQ_aQa​, and collateral factor CFaCF_aCFa​, the deposit value vav_ava​ can be represented as follows:

va=Qa∗Pa∗CFav_a = Q_a*P_a*CF_ava​=Qa​∗Pa​∗CFa​
vUSDC=1,000∗$1.01∗0.99=$990v_{USDC} = 1,000 * \$1.01 * 0.99 = \$990vUSDC​=1,000∗$1.01∗0.99=$990
V=∑i=invi=∑i=1nQi∗Pi∗CFiV = \sum_{i=i}^n v_i = \sum_{i=1}^n Q_i * P_i * CF_iV=i=i∑n​vi​=i=1∑n​Qi​∗Pi​∗CFi​
V=$990+$2,734.01+$1,072.55=$4,796.56V = \$990 + \$2,734.01 + \$1,072.55 = \$4,796.56V=$990+$2,734.01+$1,072.55=$4,796.56

Given a borrower’s krAsset b, oracle price PbP_bPb​, quantity QbQ_bQb​, and krFactor krFactorbkrFactor_bkrFactorb​, the debt value dbd_bdb​ is calculated as follows:

db=Qb∗Pb∗kFactorbd_b = Q_b * P_b * kFactor_bdb​=Qb​∗Pb​∗kFactorb​
dkrTSLA=1∗$1,000∗1.05=$1,050d_{krTSLA} = 1 * \$1,000 * 1.05 = \$1,050dkrTSLA​=1∗$1,000∗1.05=$1,050
D=∑i=indi=Qi∗Pi∗kFactoriD = \sum_{i=i}^n d_i = Q_i * P_i * kFactor_i D=i=i∑n​di​=Qi​∗Pi​∗kFactori​
D=$1,050+$180+$48=$1,278D = \$1,050 + \$180 + \$48 = \$1,278D=$1,050+$180+$48=$1,278
D=$1,050+$180+$48=$1,278D = \$1,050 + \$180 + \$48 = \$1,278D=$1,050+$180+$48=$1,278
CR=VDCR = \frac{V}{D}CR=DV​
CR=$4,806.46$1,278=3.7609=376.09%CR = \frac{\$4,806.46} {\$1,278} = 3.7609 = 376.09\%CR=$1,278$4,806.46​=3.7609=376.09%

This is decided by the instead.

The MCR is used to calculate a minimum for that a CDP needs to back up it's total debt value.

(cValue0+...+cValuen)∗MCR(cValue_0 + ...+ cValue_n) * MCR(cValue0​+...+cValuen​)∗MCR

Liquidation Threshold (LT) is a protocol parameter which holds the value for absolute minimum collateralization ratio. If the of an account is lower than the Liquidation Threshold, it can be liquidated by the liquidation functions in the protocol.

The liquidation threshold is always lower or equal to the . These two values are separate to allow creation of a safety window before accounts are in danger of being liquidated.

converted to a percentage.

Kresko Asset
Collateral Asset

How borrowing works in Kresko

How repayments work in Kresko

How Withdrawals work in Kresko

Collateralization Ratio
MCR
Collateralization Ratio
deposit
borrow
withdraw
minimum collateralization ratio
liquidations
Deposit Value
Debt Value
MCR
debt value
kFactor
Liquidation Threshold
deposit values
cFactor
collateral value