# Introduction

K2 is a decentralized borrowing and lending protocol deployed on Stellar's Soroban smart contract platform. It allows anyone to supply assets to earn interest, borrow against collateral, swap collateral positions, and execute flash loans, all in a transparent, non-custodial environment.

## What K2 Does

| For Suppliers                                                 | For Borrowers                                    | For the Ecosystem                                     |
| ------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------------------------- |
| Supply assets to earn variable interest (receive aTokens)     | Borrow against collateral at market-driven rates | First institutional-grade lending protocol on Stellar |
| Withdraw your supplied assets plus all accrued interest       | Flexible repayment with no lock-up periods       | Composable with Stellar DEXes (Soroswap, Aquarius)    |
| Swap collateral from one asset to another without withdrawing | Flash loans for capital-efficient operations     | Audited smart contracts with multi-layer security     |

## Why Stellar and Soroban?

**Fast, deterministic finality.** Stellar's consensus protocol closes a ledger every 3 to 5 seconds with immediate, irreversible finality. No re-orgs, no confirmation waiting. Without a public mempool, the window for transaction-ordering exploitation is dramatically smaller than on EVM chains, making classic front-running and sandwich attacks impractical in practice.

**Low and predictable fees.** Stellar's base fee is 0.00001 XLM, a fraction of a cent. Fees can rise slightly during congestion via surge pricing but remain negligible regardless, making it practical to interact with K2 as often as needed without cost becoming a barrier.

**Purpose-built asset infrastructure.** Soroban uses the SEP-41 token standard for fungible assets, analogous to ERC-20. K2 works directly with Stellar-native tokens including XLM and Circle-issued USDC without requiring bridges for core assets. Other supported assets may be bridged from other chains and carry the associated bridge risks.

**Soroban: a safer smart contract environment.** Soroban processes contract calls sequentially, preventing classic re-entrancy attacks by design. Re-entrancy is responsible for hundreds of millions in losses across EVM lending protocols. This is a structural guarantee, not a coding convention. Smart contract risk is never zero, but a significant attack surface present on other platforms is absent here.

**Oracle integration.** K2 uses Chainlink as its primary on-chain price oracle for collateral valuation, with RedStone serving as the secondary source. For assets that do not have a Chainlink feed, RedStone acts as the primary source and Reflector serves as the secondary. Using multiple independent providers gives K2 redundancy in price feeds rather than relying on a single source.

## Protocol at a Glance

| Metric           | Detail                                                                                                                                        |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Architecture     | Modular router pattern (Aave V3-inspired)                                                                                                     |
| Supported Assets | USDC, XLM, PYUSD, SolvBTC                                                                                                                     |
| Interest Rates   | Variable, algorithmically determined by utilization                                                                                           |
| Oracle System    | Multi-source (Primary: Chainlink, Secondary: RedStone, with Reflector as secondary for assets without a Chainlink feed) with circuit breakers |
| Liquidation      | Permissionless (the live liquidation whitelist is currently empty)                                                                            |
| Security         | Audited by Halborn, WatchPug, a Code4rena public contest and finishing soon a full audit with Runtime                                         |
| Network          | Stellar                                                                                                                                       |


# Supplying Assets

Supplying is the simplest way to participate in K2. Deposit a supported asset into a reserve, receive aTokens in return, and your balance grows automatically as borrowers pay interest.

## How It Works

1. Deposit a supported asset (for example, USDC or XLM) into K2.
2. Receive aTokens in return. These represent your deposit and will grow to include any interest earned over time.
3. Withdraw your assets at any time.

## What Are aTokens?

When you deposit USDC into K2, you receive aUSDC as your receipt token at a 1:1 ratio. Deposit 100 USDC and 100 aUSDC appears in your wallet. Your balance then grows automatically as interest accrues, with no claiming or manual compounding required.

The protocol tracks a liquidity index internally that records cumulative interest over time. When you check your balance, the contract multiplies your position by the current index and returns the full USDC-equivalent amount. This happens automatically; you will always see your real withdrawable balance, not a scaled internal figure.

**Key things to know:**

* Your aUSDC balance increases over time. If you deposit 100 USDC and the APY is 5%, after one year your balance will show approximately 105 aUSDC, redeemable for 105 USDC.
* You do not need to claim or manually compound interest.
* aTokens can be transferred to other addresses.
* Your supply balance can be used as collateral to borrow other assets.

## Supply Step by Step

### 1. Choose an asset to supply

Pick from the supported assets listed in the K2 interface. Each asset shows its current supply APY, which is the annualized rate that a supplier will earn.

### 2. Approve and deposit

Approve K2 to access the tokens, then confirm the supply transaction. The assets move from your wallet to the protocol.

### 3. Receive aTokens

Your wallet will now show aTokens (for example, aUSDC) representing your position. These grow in value as interest accrues.

### 4. Optionally enable as collateral

If you want to borrow against your supply, make sure collateral is enabled for the asset.

## What Affects Your Supply APY?

Your earnings depend on:

* **Utilization rate.** The percentage of the pool that is being borrowed. Higher utilization means a higher APY.
* **Reserve factor.** The protocol receives a small portion of interest earned. The rest goes to suppliers.
* **Market conditions.** As borrowing demand changes, so does your rate.

## Interest Compounding

K2 compounds interest automatically through its liquidity index. Each time the index updates, it multiplies against your full position including previously accrued interest. You do not need to claim, reinvest, or take any action to benefit from compounding.


# Borrowing

K2 enables users to borrow assets by supplying collateral. Borrowed assets are transferred to your wallet immediately. Interest accrues on your outstanding debt at a variable rate. Users benefit by keeping exposure to their collateral asset while accessing a different asset.

## How It Works

1. Supply an asset to K2 and make sure it is enabled as collateral.
2. Choose an asset to borrow from the available pools.
3. Borrow up to a percentage of your collateral value, determined by each asset's LTV ratio.
4. Interest accrues on your loan at a variable rate.
5. Repay whenever you like. There are no fixed terms or lock-up periods.

> **Example:** You supply $10,000 worth of XLM (LTV = 50%). You can borrow up to $5,000 worth of USDC. If you borrow $3,000, you still have $2,000 of remaining borrowing power.

## Loan-to-Value (LTV)

LTV is the maximum percentage of your deposited asset's value that you are allowed to borrow against. LTV varies by asset depending on how volatile and liquid it is.

| Asset          | LTV | You deposit $10,000 and can borrow up to |
| -------------- | --- | ---------------------------------------- |
| USDC           | 80% | $8,000                                   |
| PYUSD          | 80% | $8,000                                   |
| SolvBTC / wBTC | 70% | $7,000                                   |
| XLM            | 65% | $6,500                                   |

## Borrowing Power

If you supply multiple assets as collateral, your total borrowing power is the sum of each collateral's value multiplied by its LTV:

* **Total Borrowing Power** = sum of (Collateral Value x LTV)
* **Available to Borrow** = Total Borrowing Power minus Current Debt

> **Example:** $1,000 USDC at 80% LTV gives $800 borrowing power. $2,000 XLM at 50% LTV gives $1,000. Total borrowing power: $1,800. With $500 existing debt, you can borrow up to a maximum of $1,300 more.

## Health Factor

Once you borrow, your position has a health factor. This value measures how safe your position is. If your health factor drops below 1.0, your position is eligible to be liquidated.

> **Health Factor = (Collateral Value x Liquidation Threshold) / Total Debt Value**

The higher your health factor, the more cushion you have. The closer it gets to 1.0, the closer you are to liquidation.

## What Happens at 1.0?

When your health factor drops below 1.0, liquidators can repay a portion of your debt and seize a corresponding amount of your collateral plus a bonus. This can happen if:

* The price of your collateral assets falls
* The price of your borrowed asset rises
* Interest accrual gradually increases your debt over time

## Tips for Safe Borrowing

* Borrow well below your maximum capacity to leave room for price movements
* Monitor your health factor regularly, especially during volatile market conditions
* Keep additional assets ready to supply as collateral quickly if needed
* Repay debt proactively when the market moves against your position
* Be aware of how borrow interest accumulates over time, adding to your debt
* Aim for a health factor of 1.5 or higher as a comfortable buffer

## Step by Step

### 1. Supply collateral

You need to have assets supplied to K2 before you can borrow.

### 2. Check your borrowing power

The K2 interface shows how much you can borrow based on your collateral.

### 3. Choose an asset and amount

Select the asset you want to borrow and enter an amount within your available borrowing power.

### 4. Confirm the transaction

Once confirmed, the borrowed asset is transferred to your wallet. A debt position is created and interest starts accruing immediately.

## Things to Know

**Interest is variable.** Your borrow rate changes based on pool utilization. When many users are borrowing, rates go up. When borrowing drops, rates come down.

**There are no fixed terms.** You can hold your loan for as long as you want, as long as your health factor stays above 1.0.

**Borrow caps exist.** Each asset has a maximum total amount that can be borrowed from the protocol. If the cap is reached, no new borrows are possible.

**Interest compounds.** Your debt grows over time. The actual amount you owe is always your original borrow plus accumulated interest.


# Repaying

Repaying reduces or eliminates your outstanding debt in K2. You can repay any amount at any time. There are no penalties, lock-ups, or fixed schedules.

## How It Works

1. Send the borrowed asset back to the protocol.
2. The protocol burns an equivalent amount of your debt tokens.
3. Your debt balance decreases and your health factor improves.
4. If you repay everything, your borrowing position is fully closed.

## Partial vs. Full Repayment

**Partial Repayment.** Repay any portion of your outstanding debt without closing your position. Each repayment reduces your borrow balance and improves your health factor.

**Full Repayment.** Repay your entire outstanding debt, including all accrued interest, in a single transaction. To avoid leaving a residual balance caused by interest accruing between quote and execution, use the Max or Repay All option rather than entering the amount manually.

> **Tip:** Interest accrues continuously. If you manually enter your exact debt balance, you may still owe a small amount by the time the transaction processes. Always use the Repay All option for full repayment.

## Step by Step

### 1. Navigate to your borrow position

Find the asset you borrowed in the K2 interface. It will show your current debt balance including accrued interest.

### 2. Choose an amount

Enter the amount you would like to repay. Select Max to repay everything.

### 3. Approve and confirm

Approve K2 to access the repayment tokens, then confirm the transaction.

### 4. Verify

After confirmation, your debt balance should decrease and your health factor should improve.


# Withdrawing

Withdrawing lets you redeem your aTokens for the underlying asset, including any interest you have earned.

## How It Works

1. Request a withdrawal of a supplied asset.
2. K2 burns your aTokens and transfers the underlying tokens back to your wallet.
3. The amount you receive includes your original deposit plus any accrued interest.

> **Example:** You supplied 1,000 USDC six months ago. The pool has earned 3% APY. You withdraw and receive approximately 1,015 USDC.

## Things to Know

**You can withdraw to a different address.** The tokens do not have to go back to the same wallet that supplied them. However, the original supplier must authorize the transaction, and the recipient address must pass the same access controls as the supplier.

**Your health factor must stay above 1.0.** If your supply is being used as collateral, K2 will check that withdrawing does not push your health factor below 1.0. If it would, the withdrawal is rejected.

## Step by Step

### 1. Choose the asset to withdraw

Select the supplied asset in the K2 interface. You will see your current balance, which includes your original deposit plus interest earned.

### 2. Enter an amount

Enter a specific amount, or select Max to withdraw everything.

### 3. Confirm the transaction

Your aTokens are burned and the underlying asset is sent to your wallet.


# Liquidation

Liquidation is the protocol's safety mechanism. It protects suppliers by ensuring that borrowed positions always remain adequately collateralized. If your health factor drops below 1.0, part of your collateral can be seized to repay your debt.

## When Does Liquidation Happen?

Liquidation becomes possible the moment your health factor falls below 1.0. This typically happens when:

* The value of your collateral drops significantly
* The value of your borrowed asset rises
* Enough interest accrues on your debt to tip the balance

There is no grace period. Once the health factor falls below 1.0, a liquidator can act immediately.

## What Happens During Liquidation?

A liquidator repays up to 50% of your outstanding debt. In return, they receive an equivalent value of your collateral plus a liquidation bonus. The bonus depends on which asset is used as collateral and is set per-reserve:

| Asset          | Liquidation Bonus |
| -------------- | ----------------- |
| USDC           | 5%                |
| PYUSD          | 5%                |
| XLM            | 10%               |
| SolvBTC / wBTC | 10%               |

Your debt is reduced and your health factor improves.

## When Can 100% Be Liquidated?

The full outstanding debt can be liquidated in a single call if any of the following are true:

* Your health factor falls below 0.5
* Your individual debt position is worth less than $2,000
* Your individual collateral position is worth less than $2,000

These conditions allow full liquidation to keep the protocol solvent and avoid dust positions.

> **Example:** You owe 1,000 USDC and have $1,500 worth of XLM as collateral. XLM carries a 10% liquidation bonus. A liquidator repays 500 USDC of your debt and receives approximately 550 USDC worth of your XLM (500 plus 10% bonus). Your remaining debt is 500 USDC and your collateral is now approximately $950 worth of XLM. Your health factor has improved.

## How Much Do You Lose?

The liquidation bonus is the effective cost of being liquidated. It is taken from your collateral and given to the liquidator as incentive. A small portion of that bonus may also be retained by the protocol as a fee (0.3% by default). In the example above, you effectively lost approximately $50 worth of XLM collateral compared to repaying the debt yourself.

The best strategy is to avoid liquidation entirely by monitoring your health factor and acting before it reaches 1.0.

## Can You Be Fully Liquidated?

Usually not. The close factor limits liquidation to 50% of your debt per transaction. This gives you a chance to recover your position. The exception is if your health factor drops below 0.5, or your position value falls below $2,000, in which case liquidators can close 100% of your debt in one call.

## How to Avoid Liquidation

* Keep your health factor well above 1.0. Aim for 1.5 or higher.
* Do not borrow the maximum allowed by your LTV.
* Monitor your position during volatile market conditions.
* Repay debt or add collateral when your health factor starts declining.
* Diversify collateral across assets to reduce single-asset risk.
* Use stablecoins as collateral for more predictable health factor behavior.

## Who Can Liquidate?

Liquidation is designed to be permissionless. Anyone can act as a liquidator, which ensures there is always economic incentive for someone to close out risky positions and keep the protocol healthy.

In practice, K2 typically operates with a whitelisted set of trusted liquidators during its early period after launch. This gives the team time to verify that liquidation mechanics are working correctly in production before opening it up fully. As the protocol matures and stability is established, the whitelist is removed and liquidation becomes open to all.

The protocol also supports a blacklist to permanently block specific addresses from acting as liquidators regardless of other settings.


# Flash Loans

Flash loans let you borrow assets without any collateral, as long as you return the borrowed amount plus a small fee within the same transaction. If you do not repay, the entire transaction is reversed as if it never happened. No funds are at risk.

## How It Works

1. Borrow any available asset from K2 with no collateral needed.
2. Execute your logic (arbitrage, liquidation, collateral swap, etc.).
3. Repay the borrowed amount plus a premium (default: 0.09%).
4. If repayment does not happen, the entire transaction is rolled back.

> **Example:** You flash borrow 100,000 USDC, use it to perform an arbitrage trade that nets 500 USDC profit, then repay 100,090 USDC (the 100,000 principal plus 90 USDC premium). You keep 410 USDC profit.

## Who Are Flash Loans For?

Flash loans are primarily a tool for developers and sophisticated users running automated strategies. Common use cases:

* **Arbitrage.** Exploit price differences across DEXes.
* **Liquidation.** Borrow the debt asset to liquidate an undercollateralized position without having capital upfront.
* **Collateral swaps.** Change your collateral type in a single transaction.

## Flash Loan Availability

Flash loans are not available for every asset. Each reserve has flash loans independently enabled or disabled. The protocol also has a global switch that can disable all flash loans at once. Currently all configured reserves have flash loans enabled.


# Reserves and Interest Rates

## What is a Reserve?

A reserve is a liquidity pool for a single asset. When users supply USDC, it goes into the USDC reserve. When someone borrows USDC, it comes from that same reserve. Each reserve independently tracks its supply, debt, interest rates, and configuration. K2 supports up to 64 reserves simultaneously.

## How Interest Rates Work

K2 uses a variable rate model where rates change automatically based on supply and demand. There are no fixed-rate loans.

The core mechanism is simple: the more an asset is borrowed, the higher the rates go. This is driven by the utilization rate, which is the percentage of the reserve that is currently lent out.

> **Utilization Rate = Total Borrowed / Total Supplied**

## The Rate Curve

Interest rates follow a two-slope curve with a kink point at the optimal utilization (typically 80%):

**Below optimal utilization.** Rates rise gently. The protocol encourages borrowing to improve capital efficiency.

**Above optimal utilization.** Rates rise steeply. The protocol discourages excess borrowing and encourages repayment to maintain liquidity for withdrawals.

## Supply Rate vs. Borrow Rate

Borrowers pay the variable borrow rate on their debt.

Suppliers earn a fraction of what borrowers pay. The supply rate is calculated as:

> **Supply Rate = Borrow Rate x Utilization x (1 minus Reserve Factor)**

> **Example:** Borrow rate is 10%, utilization is 80%, reserve factor is 20%. Supply rate = 10% x 80% x 80% = 6.4% APY for suppliers.

## How Interest Accrues

Interest does not update every second. Instead, K2 uses an index-based system:

* Each reserve has a liquidity index (for suppliers) and a borrow index (for borrowers). Both indices grow over time and produce a compounding effect. The difference is in the math used per update: the liquidity index applies a linear approximation per interval, while the borrow index uses the full compound formula. In practice the difference is negligible for most users over typical holding periods. What matters is that both your supply balance and your debt grow over time, and neither requires any manual action.
* When you check your balance, it is calculated as your scaled balance multiplied by the current index.
* The index is updated on the first interaction with a reserve in any given ledger. If multiple transactions hit the same reserve in the same ledger, only the first one triggers an index update. Subsequent ones use the already-current index.

This is more efficient than updating every user's balance individually. One index update effectively updates everyone's balance at once.


# Oracle and Pricing

K2 uses a layered oracle system to resolve asset prices. For each asset, the protocol works through the following priority order until a valid price is found:

1. **Manual override.** If an admin has set an active override price for an asset, it takes priority over all other sources.
2. **Cached price.** Valid cached price data within the staleness threshold is used before querying external sources.
3. **Chainlink.** The primary data source for any asset with a Chainlink price feed.
4. **RedStone.**&#x54;he secondary source for assets covered by Chainlink, and the primary source for assets that Chainlink does not cover. RedStone delivers frequently updated feeds, including yield-bearing assets such as LSTs, LRTs, Bitcoin LSTs, and yield-accruing stablecoins.
5. **Custom oracle.** A per-asset custom oracle, such as the composite oracles used for SolvBTC, xSolvBTC, and earnUSDC, where configured.
6. **Reflector.** The secondary source for assets that do not have a Chainlink feed.
7. **Fallback oracle.** A configured fallback source, used if the sources above fail to return a valid price.

All price data is subject to staleness thresholds. If a price exceeds its allowed age, the protocol rejects it and automatically moves to the next source in the priority order. This ensures that lending decisions are always based on current, reliable market data.

## Protections Against Bad Data

Price feeds can fail, get stale, or be manipulated. K2 has three layers of protection:

**Staleness Check.** Every price has a timestamp. If the price is older than the configured maximum age (default: 1 hour), the query fails. The staleness threshold can also be configured per-asset, overriding the global default. This prevents the protocol from acting on outdated information.

**Circuit Breaker.** If a new price arrives that is more than 20% above the last recorded price, K2 rejects it and the price query returns an error rather than falling back to the last known good price. Downward price moves are not limited by the circuit breaker. This protects against sudden upward oracle spikes and price feed manipulation. If a legitimate large upward movement occurs, such as a major market event, an admin can reset the circuit breaker to allow the new price through.

**Zero Price Rejection.** The protocol never accepts a price of zero. If an oracle returns zero, the query fails immediately. There is also a global oracle pause switch. If the entire oracle contract is paused by an admin, all price queries fail regardless of the data.

## How Prices Affect You

* **Collateral value.** Determines how much you can borrow and your health factor.
* **Debt value.** Changes in the borrowed asset's price affect your health factor.
* **Liquidation.** Prices determine when positions become liquidatable.


# Risk Parameters

Each asset in K2 has a set of risk parameters that control how it can be used as collateral and borrowed. These are configured per-asset by the protocol admin.

## Core Parameters

**Loan-to-Value (LTV).** The maximum percentage of your collateral value you can borrow. LTV varies by asset depending on how volatile and liquid it is. Stablecoins like USDC carry higher LTVs (up to 80%) while more volatile assets like XLM sit lower (65%). The full range across supported assets is 65 to 80%.

**Liquidation Threshold.** The point at which your position becomes liquidatable. Always higher than LTV, creating a safety buffer. The gap between your LTV and the liquidation threshold is your breathing room. Stablecoins have tighter thresholds (85%) while volatile assets are set lower (75%) to account for larger price swings. The full range across supported assets is 75 to 85%.

**Liquidation Bonus.** The premium a liquidator receives, paid from your seized collateral. The bonus is higher for more volatile assets, reflecting the greater risk a liquidator takes on when seizing them:

* Stablecoins (USDC, PYUSD): 5%
* XLM, SolvBTC: 10%

**Reserve Factor.** The percentage of interest earnings that go to the protocol treasury instead of suppliers. K2 uses two tiers: stablecoins are set at 10% and all other assets are between 15-20%.

**Borrow Cap.** The maximum total amount of an asset that can be borrowed across the entire protocol at any one time. Once the cap is reached, no further borrowing of that asset is possible until existing loans are repaid. Borrow caps exist to limit the protocol's exposure to any single asset, particularly important for less liquid or more volatile assets where a large concentrated borrow position could destabilize the reserve. Each asset has its own cap set independently, and caps are always lower than the corresponding supply cap to ensure there is always a buffer of unborrowed liquidity available for withdrawals.


# Fees

## Reserve Factor (Interest Fee)

A percentage of all interest earned by suppliers is directed to the protocol treasury.

* **Typical value:** 10 to 20%
* **Who pays:** Effectively shared between borrowers and suppliers. Borrowers pay the full rate; suppliers receive the rate minus the reserve factor.
* **When charged:** Continuously, as interest accrues.

> **Example:** Borrow rate is 10%, reserve factor is 10%. Suppliers receive 9% APY and 1% goes to the protocol.

## Flash Loan Premium

A flat fee charged on every flash loan.

* **Default:** 30 basis points (0.30%)
* **Who pays:** The flash loan borrower.
* **When charged:** At repayment, added to the required repayment amount.

> **Example:** Flash borrow 1,000,000 USDC. Premium = 3,000 USDC. You must repay 1,003,000 USDC.

## Liquidation Protocol Fee

A portion of the liquidation bonus is claimed by the protocol.

* **Default:** 0% (currently no protocol fee is charged on liquidations)
* **Who pays:** Deducted from the collateral before transfer to the liquidator.
* **When charged:** During each liquidation event.

### Collateral Swap Fee

A protocol fee applied when collateral is swapped from one asset to another.

* Default: 50 basis points (0.50%) on the main market. No collateral swap fee is charged on the isolated (xSolv) and Earn markets.
* Who pays: The user performing the collateral swap.
* When charged: At execution of the collateral swap.

## What K2 Does Not Charge

* No deposit fees. Supplying assets is free.
* No withdrawal fees. Withdrawing your assets costs nothing beyond the standard Stellar transaction fee.
* No repayment fees. Repaying debt has no additional charge.
* No lock-up penalties. No fees for early repayment or withdrawal.

## Stellar Network Fees

Every transaction on Stellar requires a small fee paid to the network, not to K2. These fees cover the computational cost of processing your transaction on-chain, similar to gas fees on other blockchains. In practice they are tiny, typically fractions of a cent, and are paid automatically from your wallet when you initiate any action such as supplying, borrowing, repaying, or withdrawing.

## Where Do Fees Go?

All protocol fees are collected in the Treasury contract. The treasury address is configured by the pool admin and can be a multisig account for added security. Treasury funds can be used for protocol development, security, and maintenance.


# Third Party Markets

Some markets on K2 are deployed on K2's contracts but curated and operated by outside groups. Each one is run by a named organisation, identified in the market title, and grouped in the **Third-Party Markets** section of the app, separate from the markets K2 lists and configures itself.

Access is not open. An operator must be approved by K2 before it can deploy a market on the protocol, and must meet defined requirements covering how the market will be run: how parameters are published, how the oracle is sourced, how liquidation is resourced, and what is disclosed to users. Approval covers the operator and its operating commitments. It is not a review of the market's parameters or a view on the asset.

Every third-party market is an isolated market. Isolation is enforced at the contract level: collateral and debt in a third-party market cannot be combined with positions in K2's primary market, and a shortfall in one of these markets cannot reach primary market suppliers. Each market has its own reserve, its own caps, and its own oracle configuration.

### What Makes Them Different

The distinction is not the isolation, K2 lists isolated markets of its own. The distinction is who sets the terms.

**K2 does not set the parameters in a third-party market.** The operator selects the collateral, sets the LTV, liquidation threshold, liquidation bonus, supply and borrow caps, and chooses the oracle. K2 provides the contracts and the interface.

This exists because not every asset fits the framework K2 applies to its own listings. An asset may be priced off a NAV feed rather than a market feed, redeem through an issuer rather than trade on a DEX, carry a term structure that does not map cleanly onto a pooled variable-rate reserve, or simply be too new to have the liquidity history K2 requires. None of that makes an asset unsound, it means the asset sits outside the criteria K2 uses when it sets parameters itself. Rather than decline assets on that basis alone, K2 makes the infrastructure available and lets the party closest to the asset publish its own parameters and its own reasoning.

K2 makes no assessment of these markets in either direction. That an operator has been approved to build on K2, and that its market appears in the app, should not be read as a review, an endorsement, or a judgement that the asset or its parameters are appropriate for you.

|                                  | K2-listed markets   | Third-party markets                 |
| -------------------------------- | ------------------- | ----------------------------------- |
| Operator                         | K2                  | Named outside group, approved by K2 |
| Risk parameters                  | Set by K2           | Set by the operator                 |
| Oracle                           | Selected by K2      | Selected by the operator            |
| Risk analysis                    | Conducted by K2     | Conducted by the operator           |
| Isolation                        | Pooled or isolated  | Always isolated                     |
| Cross-margin with primary market | Pooled markets only | Never                               |

### Liquidation

Liquidation in a third-party market may not follow the mechanics described on the [Liquidation](https://docs.k2lend.com/liquidation.md) page.

The health factor works the same way at the contract level, but the thresholds, the close factor, the bonus, and the set of addresses permitted to liquidate are all configured per market by the operator. Some of these markets hold collateral with no reliable on-chain venue, so settlement may run through an issuer redemption or a committed liquidator facility rather than a DEX. That path, and who is responsible for it, is defined by the operator and disclosed on the market itself.

If you are supplying to or borrowing from a third-party market, read its liquidation terms specifically. Do not assume they match the primary market.

### Where to Find the Details

Full details for each third-party market live in the **Third-Party Markets** section of the app: the operator, the current parameter set, the oracle and its contract address, the liquidation path, the caps, and the operator's published risk analysis.

Those details are maintained by the operator and can change, so they are not duplicated here. The app is the source of truth for anything specific to an individual market.

> Before you supply or borrow in a third-party market, check who operates it, read the operator's risk analysis, and confirm you understand how liquidation and withdrawal work in that market. These are materially different products from K2's pooled markets.


# Contract Addresses

Contract addresses for the K2 Earn Market (earnUSDC/USDC) on mainnet.

### Earn Market Contracts

Contracts deployed for the earn market only.

| Name                        | Address                                                    |
| --------------------------- | ---------------------------------------------------------- |
| `router`                    | `CDWPVHKB2O4D2SX42EQMX7YFHZHOART4LZUNNE5XZE72L7BUKTPF6TZE` |
| `configurator`              | `CDAZUO5AHUSP7ENGHBNXIQFLTDSF4CJN2V3AOOB2LVED43QF3FHVQXW6` |
| `incentives`                | `CCRDMPUFJPXYPR24JN6DRAP4FICYDUNI74V6N4P62ZXJX35WQG4ZDXH6` |
| `interest_rate`             | `CCMYQHC3IMROZKFD2KSW6XRQVST7OAI3OW7IQLTUFHMNTORUOKDFHEZO` |
| `earnusdc_composite_oracle` | `CD5HZWK6UQEVRKXKYYTWGT3ADIYVSZ4ZJNK6EFMNT2FADGCVTEZZHS2Y` |

The `earnusdc_composite_oracle` prices earnUSDC/USD as RedStone USDC/USD multiplied by the vault NAV (`convert_to_assets`).

### Reserve Token Contracts

| Market     | Underlying                                                 | aToken                                                     | Debt Ledger                                                |
| ---------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
| `USDC`     | `CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75` | `CBUXPT7VJO2NABYDL5Q5NSHG2KNAVS5OCZQS7PXNSVTDXO5JSYB5IS7X` | `CDVYJRIAHEZWYOQUG4FDU7HZ7UU3RGRLPZ7NXQ54UBAURYXFC72KA44F` |
| `earnUSDC` | `CCL3WITWFFXIHV2I52ECV5DPIEOFSTU3PBPR53ILPLF2IP5KHECXRUTY` | CCOPG2ZQ3PRTKSBYZADZYLGE4EVXV3Q5ZEMV2PZ4ZRDV43XIESAMTM4J   | CBO4TOFTCHSZA6MR4T3W6P2JZL2RPSHECXYSKW6DTSH2DNLRYL3CJKZT   |

The keEarnUSDC aToken and its debt ledger are deployed; their addresses are listed above.

### Shared Contracts

These are the same instances used by the main and isolated markets.

| Name                     | Address                                                    |
| ------------------------ | ---------------------------------------------------------- |
| `price_oracle`           | `CCHRZE2K5TCERZLDO5IXDUWUKLRPVE72DI3TDF2RP6EQKEW6BNOMQRMU` |
| `redstone_batch_adapter` | `CA526Y2NQWGWVVQ7RFFPGAZMU66PSYJ3UC2MTVAV4ZU7OM5BOPHDXUSG` |
| `treasury`               | `CCQ4J5VLQHM2ORP4K7GBVAJJPK5SGG23DH4RD7QEHAZDHTN7JNESNXKZ` |
| `soroswap_router`        | `CAG5LRYQ5JVEUI5TEID72EYOVX44TTUJT5BQR2J6J77FH65PCCFAJDDH` |
| `soroswap_factory`       | `CA4HEQTL2WPEUYKYKCDOHCDNIV4QHNJ7EL4J4NQ6VADP7SYHVRYZ7AW2` |
| `volta_vault`            | `CC4UQND4XSP5MBHYOKGGJZQRONSTSJ3OF2EPEGA5QMCDCCZFLAE43BWJ` |
| `emergency_admin`        | `GBHSESA2MPRDVJ5UMGU2Q4SQKBMEQKIGABRMA2ARWNKTUAQRVZCUH7L2` |

### External Contracts

The earnUSDC vault is operated by Gami/Upshift, a third party. It serves as both the token contract and the NAV source, with 13 decimals.

| Name             | Address                                                    |
| ---------------- | ---------------------------------------------------------- |
| `earnusdc_vault` | `CCL3WITWFFXIHV2I52ECV5DPIEOFSTU3PBPR53ILPLF2IP5KHECXRUTY` |


# DEX Integration

K2 connects to Stellar's decentralized exchanges to power two features: collateral swaps and flash liquidations. You do not need to interact with any DEX directly. K2 handles it automatically as part of the transaction.

## Collateral Swap

A collateral swap lets you switch your collateral from one asset to another in a single transaction, without needing to manually withdraw, swap, and re-supply. For example, swapping your XLM collateral to USDC collateral happens in one step. Either the whole thing succeeds or nothing changes and your position is left untouched.

Things to know:

* You set a minimum amount you are willing to receive from the swap. If the DEX cannot meet that minimum due to price movement or low liquidity, the transaction fails and your position is unchanged. This protects you from unexpected losses on the swap.
* A small protocol fee is taken from the swap output before the new collateral is supplied on your behalf.
* Your health factor is checked after the swap. If the new collateral would leave your position at risk of liquidation, the transaction is rejected before anything changes.
* Both assets must be supported reserves in the protocol.

## Flash Liquidation

Flash liquidations are a tool for liquidators, not regular users. They allow a liquidator to repay your debt, seize your collateral, and swap it back to settle everything, all in one transaction with no upfront capital required on their part. From your perspective the outcome is the same as a standard liquidation: your debt is reduced and an equivalent value of collateral is taken, plus the liquidation bonus.

## Supported DEXes

K2 supports Soroswap, Sushi and Aquarius. Both are limited to direct asset pairs. There is no multi-hop routing. If a direct trading pair between your two assets does not exist on the chosen DEX, the swap will fail.


# Security and Audits

Security is foundational to K2. Before any code reaches mainnet, it goes through multiple independent layers of review. Once live, the protocol is actively monitored around the clock.

## Audits

K2's smart contracts have been reviewed by two independent security firms:

* **Halborn.** A leading blockchain security firm specializing in smart contract audits.
* **WatchPug.** A security research team with deep expertise in DeFi protocol vulnerabilities.
* **Code4rena.** A competitive audit platform where hundreds of independent security researchers ("wardens") raced to find vulnerabilities in K2's codebase during a public audit contest.

In addition to external audits, K2 undergoes internal security reviews that combine manual code analysis with automated AI-assisted tooling to catch issues across every iteration of the codebase, not just at major milestones.

## Ongoing Monitoring

Audits assess code at a point in time. Monitoring protects the protocol while it is live. K2 uses Hypernative for 24/7 on-chain monitoring. Hypernative watches for unusual activity, suspicious transaction patterns, and emerging threats in real-time, enabling the team to respond immediately if something looks wrong.

## Our Position on Risk

No smart contract protocol can guarantee it is completely free of risk. Audits, monitoring, and reviews significantly reduce the likelihood of an exploit, but they do not eliminate it entirely. We encourage users to only supply funds they are comfortable with, stay informed about their positions, and monitor their health factor regularly.


# Glossary

### Annual Percentage Yield (APY)

The effective yearly return on your supplied assets, accounting for interest compounding over time. Supply APY is what you earn as a lender. Borrow APY is what you pay as a borrower. Both rates are variable and change based on how much of a reserve is currently being borrowed.

### Basis Points (bps)

A unit used to express percentages precisely. 1 basis point equals 0.01%. So 500 basis points equals 5%, and 10,000 basis points equals 100%. You will see this used when describing liquidation bonuses, reserve factors, and interest rates.

### Borrow Cap

The maximum total amount of an asset that can be borrowed across the entire protocol at any one time. If the cap is reached, no further borrowing of that asset is possible until existing loans are repaid.

### Circuit Breaker

A safety mechanism on the price oracle. If an asset's price moves by more than 20% from the last recorded value in a single update, the new price is rejected and the last known good price is retained. This protects against oracle failures and price manipulation.

### Close Factor

The maximum percentage of a borrower's debt that can be repaid in a single liquidation. The default is 50%, meaning a liquidator can repay at most half of your outstanding debt in one transaction. This rises to 100% if your health factor falls below 0.5, or if your position is below $2,000 in value.

### Collateral

Assets you supply to K2 that back your borrowing. If your health factor drops below 1.0, your collateral can be seized by a liquidator to repay your debt.

### Collateral Swap

A feature that lets you switch your collateral from one asset to another in a single transaction, without needing to manually withdraw, swap, and re-supply. Your position stays open throughout.

### Debt Token

An internal token that tracks how much you owe. When you borrow an asset, a corresponding debt token is created to record your balance. It cannot be transferred. When you repay, the debt token is burned. You do not interact with debt tokens directly. They exist behind the scenes.

### Flash Liquidation

A type of liquidation where the liquidator uses a flash loan to fund the repayment, seizes the collateral, and swaps it back to repay the flash loan, all within a single transaction. This means liquidators need no upfront capital.

### Flash Loan

A loan that is borrowed and repaid within a single transaction. If the loan is not repaid by the end of the transaction, the whole thing is reversed as if it never happened. Flash loans require no collateral and are primarily used by developers and liquidators.

### Freeze

An asset state where no new supplying or borrowing is allowed, but existing positions can still be repaid and withdrawn. A frozen asset is being wound down rather than immediately shut off.

### Health Factor (HF)

A number that represents how safe your borrowing position is. It is calculated from the value of your collateral, the liquidation thresholds of your collateral assets, and the value of your debt. A health factor above 1.0 means your position is safe. Below 1.0, it becomes eligible for liquidation. The closer to 1.0 you are, the more at risk you are.

### Hypernative

The real-time on-chain monitoring service used by K2. It watches for unusual activity and potential threats 24/7, enabling the team to respond quickly to anything suspicious.

### Interest Rate Strategy

The model that determines how borrow and supply rates change based on utilization. K2 uses a two-slope model: rates rise gradually up to the optimal utilization point, then rise steeply above it to incentivize repayment and protect liquidity.

### kToken

When you supply an asset to K2, you receive a corresponding kToken at a 1:1 ratio. Your kToken balance increases automatically over time as interest accrues. When you withdraw, your kTokens are burned and you receive the underlying asset plus all earned interest.

### Liquidation

The process by which a third party (a liquidator) repays part of your debt in exchange for a portion of your collateral at a discount, when your health factor drops below 1.0. Liquidation exists to keep the protocol solvent.

### Liquidation Bonus

The premium a liquidator receives on your collateral as an incentive for performing a liquidation. The bonus varies by asset. Stablecoins carry a 5% bonus, while more volatile assets carry higher bonuses of 10 to 15%.

### Liquidation Threshold

The collateral-to-debt ratio at which your position becomes eligible for liquidation. Always higher than the LTV, creating a buffer between when you can borrow and when you can be liquidated.

### Loan-to-Value (LTV)

The maximum percentage of your collateral's value that you can borrow. For example, an 80% LTV means you can borrow up to $800 against $1,000 of collateral. LTV varies by asset.

### Oracle

A service that provides real-time asset prices to the protocol. K2 uses price oracles to calculate health factors, determine liquidation amounts, and value collateral. K2 supports Chainlink, RedStone, and Reflector oracles, with staleness checks and a circuit breaker to protect against bad data.

### Pause

An emergency state where all operations on the protocol or a specific asset are halted. The emergency admin can pause; only the pool admin can unpause. Used in response to potential security incidents.

### Reserve

The pool of liquidity for a single asset. Each asset supported by K2 has its own reserve, which tracks available liquidity, total debt, interest rates, and configuration parameters.

### Reserve Factor

The percentage of interest earnings that go to the protocol treasury rather than to suppliers. K2 uses a 10% reserve factor for stablecoins and 20% for other assets.

### Supply Cap

The maximum total amount of an asset that can be supplied to the protocol. Once reached, no further deposits are accepted until existing suppliers withdraw.

### Utilization Rate

The percentage of a reserve's liquidity that is currently borrowed. Higher utilization means less liquidity available for withdrawals, and results in higher interest rates to encourage repayment and attract new supply.

### Variable Rate

An interest rate that changes over time based on utilization. Both supply and borrow rates in K2 are variable. They go up when a reserve is heavily borrowed and come down when utilization falls. K2 does not offer fixed rates.


# User Guides

Your visual companion to K2

Download a step-by-step guide to supplying assets for yield, borrowing against collateral, and keeping your positions healthy. Each step is illustrated screen-by-screen, taking you from connecting your wallet to managing your first loan.

{% file src="/files/4M34v4tyZLxtffZMjjf1" %}

{% file src="/files/lBc67jeLDmIXX89ilQte" %}

<br>


# Wallet Support

Adding and viewing receipt tokens in your wallet

#### Viewing Receipt Tokens in Your Wallet

Receipt tokens (**aTokens**) are implemented as Soroban token contracts. Your balances are always recorded on-chain, but wallet support for displaying them varies.

**Freighter**

Freighter supports manually adding Soroban token contracts, so you can view your receipt token balances directly in your wallet.

To add a token:

1. Open Freighter.
2. Select **Add Token**.
3. Choose **Soroban Token**.
4. Paste the corresponding contract ID from the table above.
5. Confirm to add the token.

Once added, Freighter will display your balance for that token.

> **Note:** Adding a token to Freighter is a display preference only. It does not create a trustline, submit an on-chain transaction, or cost any XLM fees.

**LOBSTR**

LOBSTR does not currently support manually adding arbitrary Soroban token contracts, so aTokens may not appear in the wallet interface.

This has no effect on the functionality or security of your positions:

* Your balances and positions remain safely recorded on-chain.
* Deposits, borrowing, repayments, withdrawals, and liquidations work exactly the same.
* You can always view your balances in the K2 Lend app or verify them directly on-chain using the contract IDs above.

Current market and token contract addresses are listed at the link below.

{% content-ref url="/pages/db8d3f18aad4093e0fe915b0fa5d94a2219010cf" %}
[Contracts](/contracts)
{% endcontent-ref %}


# Contracts

## K2 Contracts

| Name                             | Address                                                    |
| -------------------------------- | ---------------------------------------------------------- |
| `price_oracle`                   | `CCHRZE2K5TCERZLDO5IXDUWUKLRPVE72DI3TDF2RP6EQKEW6BNOMQRMU` |
| `interest_rate`                  | `CATBSCEN73MFGD4LCCC6SFJHGNEHC2QLSSXFZXFCW3NK45BBPGEYDXOC` |
| `treasury`                       | `CCQ4J5VLQHM2ORP4K7GBVAJJPK5SGG23DH4RD7QEHAZDHTN7JNESNXKZ` |
| `incentives`                     | `CAAMA46SQXQKHZDWAS2CNZVAX67TOMGBVH3DVSZSMDKKVP25VGTDQIRX` |
| `kinetic_router`                 | `CCTUJZLYFAW7ZNQD2SXMUZIHBUUJJICYRKWLZJ6SK6TGNAWNXOJIV6J7` |
| `configurator`                   | `CAYS7DTBBBG6TDT326KYTE72L6Q7NSEI2U2CA7TKCQIWPXB2GNJWU7M4` |
| `flash_liquidation`              | `CACGHPQB2QOKNAPH3PVGKXXSULNGMNZYWVZQVPTHMWHFRXAGASSRNQ7H` |
| `aquarius_swap_adapter`          | `CBJBQMSBXYBOSRK6WLBAEVGF2GXQVPTYVVMVDGZF7ZBJHHFT2IGJNDMN` |
| `soroswap_swap_adapter`          | `CDL35ZAOYVDBMSTIKOF4HJKXA7MWHF5ZJNZKES6EAZAOOHLXURSGSYAJ` |
| `aquarius_multihop_swap_handler` | `CB3EHO42TDWT5EG6X62QTMPQPWIETVFLM7Q7DT62Z6MT5J4HP33XKXWE` |
| `reward_token`                   | `CA4V5C3KWDXBJEPIIKZT2PQWQZB4SY3G3G3S4PYPD5XXGXF5RKQUBE2N` |
| `solvbtc_composite_oracle`       | `CABOR5KOCMIC226J5B63W5MV75VH5ZPAFEXZFET2JDD2H6IGJY5UPWP4` |
| `xSolv composite oracle`         | `CAARHGBS2TYUSYHLUUB3JCRF4URUQ2RHIZCUPLUTFBAIJKIBVHRBZL6L` |

## Reserve Token Contracts

| Market  | Underlying                                                 | aToken                                                     | Debt Ledger                                                |
| ------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
| USDC    | `CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75` | `CDHRPTO3NLGQ2CV75LFV6NF6ZMXIPGPID5GTAZTEICBYLMLKJICOMFZK` | `CBN4GDHRJN7AIARTSTUD3OK7IOCU5V6HTSOTVARFUA5KVE7XSNBZUQG6` |
| XLM     | `CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA` | `CDTHJR27QWKAPCFTZWKP7GTX3RZO7HACVAC2KLCW2RENCMOCI35ORU5K` | `CC3OKG4VDLGFBS7V6UTSJVP3YL3A4OLV63EMTNUU3MQ2AOAU4M65H7QG` |
| PYUSD   | `CCCRWH6Q3FNP3I2I57BDLM5AFAT7O6OF6GKQOC6SSJNDAVRZ57SPHGU2` | `CA7ELGRS4FNCYJPRZSNLF7NDD6VVOFZKFKMY56VVSG3RMNYTFQNNFUTD` | `CAVFE34MWBIXT4AOFXPTI7U7JTLPHKG4YWDDMRXVJOIZKG6HFJW3IHXV` |
| SolvBTC | `CBIJBDNZNF4X35BJ4FFZWCDBSCKOP5NB4PLG4SNENRMLAPYG4P5FM6VN` | `CDDTJ7OZU2WZAEZNTUZWIRAE4EMP5CF63M3INFQWTLX4ENMYUFK6RCTX` | `CADGKVZKBNLPKFIWDWTRSQAPBWH77H2OPJIF3WGVL7VADVLCXDZ5CSNH` |

## xSolvBTC - SolvBTC Isolated Market

| Market   | Underlying                                                 | aToken                                                     | Debt Ledger                                                |
| -------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
| SolvBTC  | `CBIJBDNZNF4X35BJ4FFZWCDBSCKOP5NB4PLG4SNENRMLAPYG4P5FM6VN` | `CBMGL7ZLI66YDKSINNOQ4RAAXZNWMWPOZCVLGCJKGSER2YHGYJ6JALVY` | `CDAGGZ5Z44CBXVAB3J55WC7UAUAHCIBBVMJVK2YJJOUEB6RKMDEN5YWX` |
| xSolvBTC | `CAUP7NFABXE5TJRL3FKTPMWRLC7IAXYDCTHQRFSCLR5TMGKHOOQO772J` | `CCBAWC23LBBXMZJRSCWKYX2GRGOUSYJ4W6Z2Y3DLWOFH3LRT27NSD436` | `CDG7CPVF564LXRWVIBVWOSUAIXJQJVGTAGLMRJHEE4JGPZWBMQIXEGXM` |

## External Integrated Contracts

| Name                                  | Address                                                    |
| ------------------------------------- | ---------------------------------------------------------- |
| Volta vault                           | `CC4UQND4XSP5MBHYOKGGJZQRONSTSJ3OF2EPEGA5QMCDCCZFLAE43BWJ` |
| DEX router                            | `CAG5LRYQ5JVEUI5TEID72EYOVX44TTUJT5BQR2J6J77FH65PCCFAJDDH` |
| DEX factory                           | `CA4HEQTL2WPEUYKYKCDOHCDNIV4QHNJ7EL4J4NQ6VADP7SYHVRYZ7AW2` |
| USDC/XLM DEX pair                     | `CAM7DY53G63XA4AJRS24Z6VFYAFSSF76C3RZ45BE5YU3FQS5255OOABP` |
| Reflector Stellar Mainnet DEX oracle  | `CALI2BYU2JE6WVRUFYTS6MSBNEHGJ35P4AVCZYF3B6QOE3QKOB2PLE6M` |
| Reflector External CEXs & DEXs oracle | `CAFJZQWSED6YAWZU3GWRTOCNPPCGBN32L7QV43XX5LZLFTK6JLN34DLN` |
| RedStone Batch Adapter                | `CA526Y2NQWGWVVQ7RFFPGAZMU66PSYJ3UC2MTVAV4ZU7OM5BOPHDXUSG` |

## Legacy Manual Reserve Tokens

| Name                 | Address                                                    |
| -------------------- | ---------------------------------------------------------- |
| `legacy_atoken_usdc` | `CA4TA6QZKQ22J3YXII2CUBICSNMQH6WKGPIHBX4YG2DUTI7J7I2R36XG` |
| `legacy_atoken_xlm`  | `CDFJ2WNINWSNKK3VP2L7KIKCBVNMVKCNMSR2YQ7CM74DLCS6XVCI3UNM` |
| `legacy_debt_usdc`   | `CD5KDH7BD7ETQJQ2DZ6OBFIBIMUJSI5IZLM2RMRC6TDV2HKIN6AHS7C7` |
| `legacy_debt_xlm`    | `CBBDWBQANX4X4J2ZWSA4QBNNRJ3L32BEBQTIWKGGKYNBS5UR5AIFEEHP` |

## Published Artifacts Without Fresh Mainnet Instance

| Artifact                | WASM Hash                                                          |
| ----------------------- | ------------------------------------------------------------------ |
| `k2_liquidation_engine` | `3d08eeb6976f73868247ec6e34377345e0934f7948fd5873b33a20f2b107df5a` |
| `k2_local_reflector`    | `ee997a4d405e09b258d44523495279a838aeab55e1c031b8d3016f999e7f6225` |


