# Treasury Lending

## The Problem

STRAT holders face a common dilemma: they believe in the protocol's long-term value, but they need ETH liquidity today. In most DeFi protocols, the options are unattractive:

* **Sell STRAT** — gives up future upside and creates sell pressure
* **Borrow on external markets** — price-based liquidation means a flash crash can wipe out your collateral, even if the underlying value hasn't changed
* **No access at all** — protocol treasuries sit idle, generating no yield for holders

Treasury Lending solves all three. It lets STRAT holders borrow esETH directly from the protocol treasury using STRAT and CDT as collateral — at a fixed rate, for a fixed term, with zero liquidation risk during the loan. The interest paid by borrowers flows directly to [STRAT stakers](/core-mechanics/strat-staking.md), creating real yield from real demand.

This also serves as a natural escape valve for the protocol. Any STRAT holder can borrow against their NAV-backed value, meaning the option to exit always exists — no need to petition for redemptions, no "RFV wars." The market finds a fair premium for STRAT because arbitrageurs can loop borrows to buy up any STRAT trading below NAV.

## How It Works

### The Core Flow

1. **Deposit collateral** — Bring STRAT and a proportional amount of [CDT](/core-mechanics/cdt.md). Both are burned at origination.
2. **Receive a loan** — The protocol calculates your ETH backing, deducts reserves for interest and delinquent fee, and transfers the remaining esETH to you as a loan.
3. **Loan position as NFT** — You receive an ERC721 position NFT that encodes all loan terms. This NFT is transferable — you can move it to another wallet or a position-management contract.
4. **Repay before expiry** — Return principal + accrued interest in esETH. Your STRAT and CDT collateral is minted back to you. Early repayment is cheaper because interest accrues linearly. Only the position NFT owner can repay. Repayment is only possible before expiry — after expiry, the transaction reverts with `LoanExpired` and only liquidation remains.
5. **Or default** — If you don't repay by expiry, anyone can liquidate the position. Your collateral is forfeited, and the delinquent fee is distributed as a bonus to all remaining STRAT holders.

### Collateral Requirements

You must deposit both STRAT and CDT in proportion to the protocol's current debt ratio:

```
cdtRequired = stratDeposited × (CDT.totalSupply() / STRAT.totalSupply())
```

If you bring more STRAT than you have CDT for (or vice versa), the protocol adjusts to whichever is the limiting factor. You always deposit the maximum proportional pair possible given your inputs.

Both STRAT and CDT are **burned** when the loan opens — not held in escrow. This is a critical distinction from typical DeFi collateral: your tokens don't sit in a vault waiting to be liquidated. They're destroyed. On successful repayment, equivalent STRAT and CDT are minted back to you.

### ETH Backing Calculation

The amount you can borrow is derived from the ETH backing of your deposited STRAT:

```
totalHoldingsInETH = esETH.balanceOf(unencumberedHoldings) + esETH.balanceOf(encumberedHoldings)
ethBacking = totalHoldingsInETH × stratIn / STRAT.totalSupply()
```

This is the full pro-rata share of the protocol's esETH treasury that your STRAT represents. From this backing, three components are carved out:

```
delinquentFee  = ethBacking × delinquentFeeRate / SCALE
termFactor     = borrowRate × loanDuration / 365 days
borrowAmount   = (ethBacking - delinquentFee) / (1 + termFactor)
maxTermInterest = borrowAmount × termFactor
```

The invariant always holds: **`borrowAmount + maxTermInterest + delinquentFee = ethBacking`**.

The full `ethBacking` is transferred from unencumbered holdings into the TreasuryLend contract. From this reserve, only the `borrowAmount` is forwarded to you as esETH. The remaining `maxTermInterest + delinquentFee` stays in TreasuryLend for the life of your position.

### Loan Parameters

| Parameter               | Default                          | Description                                                     |
| ----------------------- | -------------------------------- | --------------------------------------------------------------- |
| **Loan Duration**       | 6 months (180 days)              | Fixed term; positions expire at `startTime + loanDuration`      |
| **Borrow Rate**         | Set by rate setter (delegatable) | Annual interest rate, snapshotted per position at origination   |
| **Delinquent Fee Rate** | Set by fee setter (delegatable)  | Percentage of ETH backing reserved upfront as a default penalty |

The rate setter and fee setter roles are initialized to the contract owner but can be delegated to automated keepers. All parameters are fixed for the life of your position — changes only affect new borrows and rolls.

## Interest Model

Interest accrues linearly from the moment you borrow until expiry:

```
accruedInterest = maxTermInterest × (currentTime - startTime) / (expiry - startTime)
```

This means:

* **Repay at day 1** — you owe almost zero interest
* **Repay at the halfway point** — you owe half the maximum interest
* **Repay at expiry** — you owe the full `maxTermInterest`
* **After expiry** — interest is capped at `maxTermInterest` (no additional penalty accrues, but you face liquidation)

Early repayment is always cheaper. The unused portion of the interest reserve (`maxTermInterest - accruedInterest`) is returned to the protocol's unencumbered holdings, preserving the `ethPerStrat` invariant.

### Worked Example

> Alice holds 100 STRAT and proportional CDT. The protocol's ethPerStrat is 0.5 esETH (total holdings = 50,000 esETH, STRAT supply = 100,000). The borrow rate is 10% annually, the delinquent fee rate is 5%, and the loan duration is 180 days.
>
> * **ethBacking** = 50,000 × 100 / 100,000 = 50 esETH
> * **delinquentFee** = 50 × 0.05 = 2.5 esETH
> * **termFactor** = 0.10 × 180/365 ≈ 0.04932
> * **borrowAmount** = (50 − 2.5) / (1 + 0.04932) ≈ 45.27 esETH
> * **maxTermInterest** ≈ 2.23 esETH
>
> Alice receives 45.27 esETH. Her 100 STRAT and CDT are burned.
>
> If she repays at day 90 (halfway through the term), she owes 45.27 principal + \~1.12 accrued interest = \~46.39 esETH total. Her 100 STRAT and CDT are minted back. The unused interest reserve (\~1.11 esETH) returns to unencumbered holdings — `ethPerStrat` is unchanged.
>
> If she doesn't repay by day 180, anyone can liquidate. Full-term interest (2.23 esETH) goes to stakers, the delinquent fee (2.5 esETH) goes to unencumbered holdings (boosting ethPerStrat by 2.5/99,900 for all remaining holders — her 100 STRAT were burned at origination), and Alice's collateral is permanently gone.

### Where Interest Goes

All interest — whether from repayment, rolling, or liquidation — flows to the `interestRevenueRecipient`. This address defaults to the contract owner and is configurable — the protocol sets it to the [StakedStrat](/core-mechanics/strat-staking.md) contract so that lending revenue streams to stakers via the 7-day reward mechanism.

## Rolling a Position

Don't want to close your loan and reopen a new one? Roll it. Rolling settles your accrued interest, adjusts your collateral (adding or removing STRAT/CDT), recomputes your borrow amount at current parameters, and resets your term — all in a single transaction, preserving your NFT.

Rolling is useful when:

* **Your loan is approaching expiry** and you want to extend the term
* **STRAT backing has changed** and you want to resize your position
* **You want to add or remove collateral** without full repay/reborrow friction

Rolling must be done **before expiry** — once a position expires, it can only be liquidated, not rolled. Only the position NFT owner can roll.

### How Rolling Works

1. Accrued interest up to the roll timestamp is settled and sent to stakers
2. New loan parameters are computed using current governance settings (`borrowRate`, `delinquentFeeRate`, `loanDuration`)
3. The old and new backing amounts are netted to minimize esETH transfers:
   * If your **new borrow amount < old principal + accrued interest**: you pay the shortfall in esETH, and the net backing reduction returns to unencumbered holdings
   * If your **new borrow amount ≥ old principal + accrued interest**: the protocol pulls additional backing from unencumbered holdings and pays the net surplus to you
4. Collateral (STRAT/CDT) is burned or minted for the delta between old and new covered amounts
5. The position NFT is updated in place — same token ID, new terms

Rolling snapshots a new fixed rate for the rolled term. If governance has changed the rate since your original borrow, your rolled position uses the new rate.

## Liquidation

Treasury Lending uses a time-based liquidation model, not a price-based one. Your position cannot be liquidated before expiry, regardless of market movements.

### Before Expiry

**Your position is safe.** No oracle price, no market crash, no flash loan attack can trigger liquidation during your loan term. This is a fundamental design difference from protocols like Aave or Compound where a sudden price drop can wipe out your collateral.

### After Expiry

If `block.timestamp >= expiry` and you haven't repaid, anyone can call liquidation. It's permissionless — no keeper network or protocol action required.

On liquidation:

1. **Full-term interest** (`maxTermInterest`) is sent to stakers — the protocol collects the maximum possible interest
2. **Delinquent fee** is returned to unencumbered holdings — increasing `ethPerStrat` for all remaining STRAT holders
3. **Collateral is forfeited** — the STRAT and CDT burned at origination are not returned
4. **The position NFT is burned**
5. **The liquidator receives nothing** — liquidation is a public good, not a profit opportunity

The defaulting borrower retains the `borrowAmount` they originally received. Their loss is the collateral (STRAT + CDT) plus the delinquent fee. The protocol's gain is the interest revenue (to stakers) and the delinquent fee (to all STRAT holders via increased backing).

## The ethPerStrat Invariant

A critical property of Treasury Lending: **borrowing, repaying, and rolling do not change the ETH backing per STRAT token.** Your lending activity doesn't dilute or inflate anyone else's STRAT value.

```
ethPerStrat = totalHoldingsInETH / STRAT.totalSupply()
```

This invariant holds because both the numerator (total esETH holdings) and denominator (STRAT supply) decrease proportionally when a loan is opened, and increase proportionally when it's repaid. The math factors cleanly:

```
(H - H×stratIn/S) / (S - stratIn) = H/S
```

The one exception is liquidation, which **increases** `ethPerStrat` by `delinquentFee / STRAT.totalSupply()`. Defaults are compensated — remaining STRAT holders get a bonus from delinquent borrowers.

{% hint style="warning" %}
This invariant requires that `interestRevenueRecipient` is **not** set to a holdings address. If interest were routed to unencumbered or encumbered holdings, it would increase total holdings without a corresponding increase in STRAT supply, breaking the invariant. In practice, the recipient is the StakedStrat contract — a distinct address.
{% endhint %}

## Safety Layers

Treasury Lending stacks multiple protections — each addressing a different risk vector:

1. **Dual collateral** — both STRAT and CDT must be deposited, ensuring borrowers have skin in the game on both equity and debt sides
2. **Burn-at-origination** — collateral is destroyed, not escrowed; no complex liquidation auctions or cascading failures
3. **Delinquent fee reserves** — penalty capital held upfront in the TreasuryLend contract, forfeited on default to compensate remaining holders
4. **Fixed-rate snapshots** — no variable-rate surprises; borrowers know their exact cost for the full term
5. **Time-based liquidation** — no price oracle dependency, no flash-loan manipulation, no cascading liquidations from market volatility
6. **Interest revenue to stakers** — all lending revenue flows to StakedStrat via [7-day streaming](/core-mechanics/strat-staking.md#7-day-reward-streaming), creating sustainable yield without inflation
7. **ethPerStrat invariant** — mathematically guaranteed: borrowing activity cannot dilute other STRAT holders

## Preview and Slippage Protection

Before borrowing, you can call `previewBorrow(maxStratIn, maxCdtIn)` to see exactly what you'd receive:

```
(stratIn, cdtIn, ethBacking, borrowAmount, maxTermInterest, delinquentFee)
```

When executing the actual borrow or roll, you set a `minBorrowAmount` slippage guard and a `deadline` staleness guard. If conditions change between preview and execution (e.g., another user borrows first, changing the backing ratio), the transaction reverts rather than executing at worse terms.

{% hint style="info" %}
**Status: Roadmap — Q2 2026** — Treasury Lending is not yet deployed. The StratETHTreasuryLend contract is under development and will launch after the core protocol (convertible notes, on-chain staking) is live. Audits will be published before deployment.
{% endhint %}

## Failure Modes and Gotchas

**Collateral is burned, not escrowed.** Your STRAT and CDT are destroyed when you borrow — not held in a vault. If you default, there is nothing to "get back." On successful repayment, new STRAT and CDT are minted to you. This is fundamentally different from typical DeFi collateral models and can surprise users expecting to reclaim their exact tokens.

**No liquidation during the term means no early warning.** Because the protocol does not liquidate based on price, there are no health factors, no margin calls, and no partial liquidations. If you forget about your loan and it expires, full liquidation happens instantly when anyone calls it. Set reminders or use automation.

**Delinquent fee is not an additional charge on repayment.** The delinquent fee is carved from your ETH backing at origination and held in reserve. If you repay on time, it's returned to the protocol's unencumbered holdings (not charged to you). You only "pay" the delinquent fee by defaulting — it's forfeited as a penalty. Think of it as a good-behavior deposit.

**Rolling changes your rate.** If governance has increased the borrow rate since your original loan, rolling locks in the new (higher) rate. Check the current rate before rolling — it may be cheaper to repay and re-borrow if you're timing it around a rate change.

**CDT is required alongside STRAT.** You cannot borrow with STRAT alone. The protocol requires proportional CDT to ensure borrowers have exposure to both sides (equity and debt) of the protocol. If you don't hold CDT, you'll need to acquire it before borrowing.

**Interest revenue must not flow to holdings addresses.** This is a protocol configuration constraint, not a user-facing concern, but it's worth noting: if `interestRevenueRecipient` were set to a holdings address, the `ethPerStrat` invariant would break. This is managed through careful configuration — the user stories flag it as a critical constraint, but enforcement is operational rather than on-chain.

**Loan positions are transferable.** The ERC721 NFT representing your loan can be transferred to another address. The new owner gains the right to repay (recovering collateral) or roll the position. If you transfer your loan NFT, you lose all ability to interact with that position. Be cautious with approvals and transfers.

**Zero-amount deposits are rejected.** Attempting to borrow with zero STRAT or zero CDT reverts with `ZeroAmount`. This is a safety check to prevent empty positions.

For a comprehensive view of protocol risks and mitigations, see [Risks](/security-and-risk/risks.md).


---

# 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://docs.ethstrat.xyz/core-mechanics/treasury-lending.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.
