> For the complete documentation index, see [llms.txt](https://docs.ethstrat.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ethstrat.xyz/developers/integration-guide.md).

# Integration Guide

Integrate esETH, STRAT, CDT, and StakedStrat into your protocol, wallet, or application — with opinionated guidance and working code. ESPN-specific mechanics, addresses, and examples describe the lega

This guide is for developers integrating ETH Strategy tokens into smart contracts, wallets, aggregators, dashboards, or any on-chain system. It covers each token's interface, recommended integration patterns, and production caveats that will save you from subtle bugs.

If you're looking for protocol mechanics rather than integration patterns, start with the [Protocol Overview](https://docs.ethstrat.xyz/introduction/protocol-overview.md). For the complete API reference (every function with parameters, return values, access control, and revert conditions), see the [Contract Reference](https://docs.ethstrat.xyz/developers/contract-reference.md).

***

## Quick Reference

| Token          | Standard | Rebasing | Transferable | Permit (ERC-2612) | Key Integration Note                                                             |
| -------------- | -------- | -------- | ------------ | ----------------- | -------------------------------------------------------------------------------- |
| **esETH**      | ERC-20   | No       | Yes          | No                | Non-rebasing. Balances never change except on transfer/mint/burn. Safe to cache. |
| **STRAT**      | ERC-20   | No       | Yes          | Yes               | Only minted through note conversion. No inflation schedule.                      |
| **CDT**        | ERC-20   | No       | Yes          | Yes               | Each token = \~$1 protocol debt. `totalSupply()` = total debt.                   |
| **sSTRAT-v2**  | ERC-20   | No       | **No**       | No                | Non-transferable receipt token. `transfer()` and `approve()` revert.             |
| **NFT Option** | ERC-721  | N/A      | Yes          | N/A               | Conversion rights. Requires CDT to exercise. Partial exercise supported.         |
| **ESPN**       | ERC-4626 | No       | Yes          | No                | Standard vault interface. Deposit USDS, receive shares.                          |

***

## esETH Integration

The deployed esETH contract is a non-rebasing ERC-20 with permissioned minting. It has no ERC-2612 permit, `previewMint()` or `previewRedeem()` interface. See [Contract Reference](https://docs.ethstrat.xyz/developers/contract-reference.md#eseth) for the current functions and [esETH](https://docs.ethstrat.xyz/core-mechanics/eseth.md) for launch configuration.

`redeem(token, tokenAmount, receiver)` takes the desired **underlying token amount** and burns its configured ETH value plus 1 wei. A preflight must check token configuration, balance, attributed `totalMinted` liability and the caller's esETH, then simulate the exact call. `getETHValue()` alone is not a redemption quote or guarantee.

Protocol accounting uses a nominal 1:1 ETH denomination. Integrators must separately assess backing losses, withdrawal availability and market value. Bonding wraps ETH into WETH-backed esETH through the authorized note contract; arbitrary wallets cannot call the mint paths.

***

## STRAT Integration

STRAT is a standard ERC-20 with ERC-2612 permit support. It does not rebase and is only minted through convertible note conversion.

### Key Facts for Integrators

* **No inflation schedule.** STRAT supply only increases when note holders convert. There is no emission schedule or admin mint.
* **Valuation metric:** ETH per STRAT (EPS) = total esETH in treasury / total STRAT supply. This is the fundamental metric — it increases when the treasury grows faster than STRAT dilution.
* **Contract address:** [0x14cF922aa1512Adfc34409b63e18D391e4a86A2f](https://etherscan.io/address/0x14cF922aa1512Adfc34409b63e18D391e4a86A2f)

### Displaying STRAT Value

For dashboards and portfolio trackers, show EPS alongside the market price:

```typescript
import { ethers } from "ethers";

const STRAT = "0x14cF922aa1512Adfc34409b63e18D391e4a86A2f";

async function getStratMetrics(provider: ethers.Provider, esEthContract: ethers.Contract) {
  const strat = new ethers.Contract(STRAT, [
    "function totalSupply() view returns (uint256)"
  ], provider);

  const [stratSupply, treasuryEsEth] = await Promise.all([
    strat.totalSupply(),
    esEthContract.balanceOf(TREASURY_ADDRESS),  // total esETH in treasury (1 esETH = 1 ETH)
  ]);

  // ETH per STRAT (the core valuation metric)
  // Since 1 esETH = 1 ETH, treasuryEsEth directly represents ETH value
  const eps = treasuryEsEth / stratSupply;

  return { stratSupply, eps };
}
```

***

## CDT Integration

CDT is a standard ERC-20 with ERC-2612 permit support. Each CDT represents approximately $1 of protocol debt.

### Key Facts for Integrators

* **`totalSupply()` = total protocol debt.** This is an on-chain transparency guarantee. Display it to users as the protocol's total debt outstanding.
* **CDT does not accrue interest or yield.** Its value comes from: (1) the $1 face-value redemption right after note expiry, and (2) its utility as a "key" required to exercise NFT conversion rights.
* **CDT is required for conversion.** An NFT alone cannot be converted — the holder must also hold and burn CDT. This creates organic demand for CDT beyond its face value.
* **Minting is restricted** to authorized protocol contracts (ConvertibleNote, TreasuryLend). CDT cannot be minted by governance or any external address.

### CDT as a Leverage Indicator

```typescript
// Protocol leverage = total debt / total equity
// In ETH Strategy terms: CDT supply (in ETH) / treasury esETH
async function getProtocolLeverage(
  cdtContract: ethers.Contract,
  esEthContract: ethers.Contract,
  ethUsdOracle: ethers.Contract
) {
  const [cdtSupply, treasuryEth, ethPrice] = await Promise.all([
    cdtContract.totalSupply(),
    esEthContract.balanceOf(TREASURY_ADDRESS),
    ethUsdOracle.latestRoundData().then((r: any) => r.answer)
  ]);

  // CDT is USD-denominated; convert treasury to USD for comparison
  const treasuryUsd = (treasuryEth * ethPrice) / BigInt(1e8);
  const debtToEquity = (cdtSupply * BigInt(1e18)) / treasuryUsd;

  return { cdtSupply, treasuryUsd, debtToEquity };
}
```

***

## StakedStrat (sSTRAT-v2) Integration

**Planned STRAT staking design.** New STRAT staking is not currently available in the app. Live [EARN staking](https://docs.ethstrat.xyz/core-mechanics/earn.md) uses its own deployed address and 28-day USDS streams.

StakedStrat is the on-chain staking contract. It accepts STRAT deposits and streams esETH rewards over 7-day periods.

### Core Interface

```solidity
/// @notice Stake STRAT tokens. Receives sSTRAT-v2 1:1.
/// @param amount Amount of STRAT to stake
/// @dev Caller must have approved StakedStrat to spend `amount` of STRAT.
///      Reverts with `ZeroAmount` if amount is 0.
///      Automatically calls syncRewards() before staking.
function stake(uint256 amount) external;

/// @notice Unstake STRAT tokens. Burns sSTRAT-v2 proportionally.
/// @param amount Amount of STRAT to unstake
/// @dev Automatically claims all pending esETH rewards before unstaking.
///      Reverts with `ZeroAmount` if amount is 0.
///      Reverts with `InsufficientStake` if amount exceeds staked balance.
function unstake(uint256 amount) external;

/// @notice Claim accrued esETH rewards without changing staked position.
/// @dev Returns silently if no rewards are pending.
function claim() external;

/// @notice Detect new esETH in the contract and start/extend the reward stream.
/// @dev Permissionless — anyone can call. Called automatically by stake/unstake/claim.
///      Compares current balance against cumulative accounting to find new rewards.
///      New rewards blend with any active stream using value-weighted average duration.
function syncRewards() external;

/// @notice Move staked position to a new address without unstaking.
/// @param to Destination address
/// @param amount Amount to migrate (0 = full balance)
/// @dev Pays out recipient's pending rewards during migration.
///      Reverts if `to` is zero address, caller, or the contract itself.
function migrateStake(address to, uint256 amount) external;

/// @notice View pending (claimable) esETH rewards for an account.
/// @dev May undercount if new rewards arrived but syncRewards() hasn't been called.
function getPendingRewards(address account) external view returns (uint256);
```

### Production Warnings

**sSTRAT-v2 is non-transferable.** `transfer()`, `transferFrom()`, and `approve()` all revert with `TransferDisabled`. Do not attempt to build markets, pools, or collateral positions with sSTRAT-v2. It is an accounting receipt, not a tradable asset. The only way to move a staked position is `migrateStake()`.

**`getPendingRewards()` may undercount.** The view function projects the current reward stream forward but does not account for newly arrived esETH that hasn't been synced. If you need an accurate reading (e.g., for a dashboard), call `syncRewards()` first in a static call:

```typescript
// Accurate pending rewards reading
const stakedStrat = new ethers.Contract(STAKED_STRAT_ADDRESS, STAKED_STRAT_ABI, provider);

// Static call syncRewards first, then read pending
await stakedStrat.syncRewards.staticCall();
const pending = await stakedStrat.getPendingRewards(userAddress);
```

**Unstaking auto-claims rewards.** When a user unstakes, all pending esETH rewards are automatically claimed and sent to them. This is by design — there is no scenario where unstaking forfeits earned yield. Account for this in your UI: after an unstake transaction, the user will have received both their STRAT and their esETH rewards.

**7-day streaming means delayed reward visibility.** When new rewards arrive at the contract, they stream linearly over 7 days. A large deposit into the reward pool doesn't instantly appear as claimable — it drips over the week. Display this to users as "streaming rewards" rather than a lump sum.

***

## Convertible Note Integration

The convertible note system has two components: the EthStrategyConvertibleNote contract (handles bonding, conversion, and redemption) and the NFT options it mints.

### Bonding

```solidity
/// @notice Purchase a USD-denominated convertible note by sending ETH.
/// @param recipient Address to receive CDT and NFT
/// @param minConversionAmountStrat Minimum STRAT entitlement (slippage protection)
/// @param minConversionAmountEth Minimum esETH entitlement (slippage protection)
/// @param deadline Transaction deadline (block.timestamp must be <= deadline)
/// @return tokenId The minted NFT token ID
/// @dev The note is priced in USD via an ETH/USD oracle. CDT amount = USD notional.
///      Reverts with `NoEthSent` if msg.value is 0.
///      Reverts with `ZeroAddress` if recipient is address(0).
///      Reverts with `TransactionStale` if block.timestamp > deadline.
///      Reverts with `InsufficientOutput` if entitlements < minimums.
function bond(
    address recipient,
    uint256 minConversionAmountStrat,
    uint256 minConversionAmountEth,
    uint256 deadline
) external payable returns (uint256 tokenId);

/// @notice Preview conversion entitlements for a given ETH amount without executing.
/// @param ethAmount Amount of ETH (in wei) to preview
/// @return stratAmount STRAT conversion entitlement
/// @return ethEntitlement esETH conversion entitlement
/// @return settlementUsd USD notional (CDT amount)
function conversionEntitlements(uint256 ethAmount)
    external view returns (uint256 stratAmount, uint256 ethEntitlement, uint256 settlementUsd);
```

### Conversion

```solidity
/// @notice Convert note to STRAT before expiry. Burns CDT, mints STRAT.
/// @param tokenId NFT token ID
/// @param cdtAmount Amount of CDT to burn (partial exercise supported)
/// @dev Caller must be ownerOf(tokenId). NFT approvals are NOT accepted.
///      Reverts with `TimelockActive` if timelock hasn't passed (~6.9 days).
///      Reverts with `OptionExpired` if past expiry (~4.2 years).
///      CDT must be approved or permitted to the contract.
function convertToStrat(uint256 tokenId, uint256 cdtAmount) external;

/// @notice Convert note to esETH before expiry. Burns CDT, transfers esETH.
/// @param tokenId NFT token ID
/// @param cdtAmount Amount of CDT to burn (partial exercise supported)
function convertToEth(uint256 tokenId, uint256 cdtAmount) external;

/// @notice Redeem CDT for USD notional value in esETH after expiry.
/// @param tokenId NFT token ID
/// @param minEthOut Minimum esETH to receive (slippage protection against oracle movement)
/// @dev Single-shot — redeems entire remaining position. Burns both CDT and NFT.
///      Pro-rata if protocol is underwater (treasury < total CDT).
function redeem(uint256 tokenId, uint256 minEthOut) external;

// Permit variants — combine CDT approval and action in one transaction:
function convertToStratWithPermit(uint256 tokenId, uint256 cdtAmount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
function convertToEthWithPermit(uint256 tokenId, uint256 cdtAmount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
function redeemWithPermit(uint256 tokenId, uint256 minEthOut, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
```

### Reading Note State

Each NFT encodes the full position state. Query it to display note details in your UI:

```solidity
/// @notice Returns the full state of a convertible note.
/// @param tokenId NFT token ID
/// @return note Struct containing all position fields
struct Note {
    uint256 conversionEntitlementStrat;  // STRAT claimable via conversion
    uint256 conversionEntitlementEth;    // esETH claimable via conversion
    uint256 settlementEntitlementUsd;    // USD notional for post-expiry redemption
    uint256 amountOwedCdt;              // CDT required for full exercise (decrements)
    uint256 expiry;                      // Timestamp after which conversion closes
    uint256 timelock;                    // Timestamp before which conversion is blocked
}
function notes(uint256 tokenId) external view returns (Note memory);
```

### Production Warnings

**Only `ownerOf(tokenId)` can convert or redeem.** NFT approvals (`approve`, `setApprovalForAll`) are intentionally not accepted for settlement authorization. If your contract holds note NFTs, it must call conversion/redemption functions directly — it cannot delegate this to another address. This is a security design choice to reduce attack surface.

**Timelock prevents immediate conversion.** After bonding, there is a \~6.9-day window where the note exists but cannot be converted or redeemed. The NFT and CDT can be transferred during this period. Build your UI to show the timelock countdown.

**Partial exercise is supported but CDT must match.** To exercise 50% of a note, burn 50% of `amountOwedCdt`. The NFT's entitlement fields decrement proportionally. The NFT is only burned when `amountOwedCdt` reaches zero (full exercise).

**`conversionEntitlements()` preview may show zero ETH.** If the protocol is underwater (total debt > treasury value in USD), the ETH conversion entitlement for new notes is zero. STRAT conversion rights are still granted. Check the preview before presenting note terms to users.

***

## ESPN (ERC-4626 Vault) Integration

**Legacy integration.** These interfaces do not describe EARN.

ESPN follows the standard [ERC-4626 Tokenized Vault](https://eips.ethereum.org/EIPS/eip-4626) interface. If your protocol or aggregator already supports ERC-4626, ESPN requires no custom integration work.

### Key Details

| Property          | Value                                                                                                                 |
| ----------------- | --------------------------------------------------------------------------------------------------------------------- |
| **Deposit asset** | USDS                                                                                                                  |
| **Share token**   | ESPN                                                                                                                  |
| **Contract**      | [0xb250C9E0F7bE4cfF13F94374C993aC445A1385fE](https://etherscan.io/address/0xb250C9E0F7bE4cfF13F94374C993aC445A1385fE) |
| **Deposit cap**   | Governance-configurable                                                                                               |
| **Withdrawals**   | May be disabled by governance; exit via LP redemption when direct withdrawals are disabled                            |

```solidity
// Standard ERC-4626 — use your existing vault integration
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
function convertToShares(uint256 assets) external view returns (uint256);
function convertToAssets(uint256 shares) external view returns (uint256);
function totalAssets() external view returns (uint256);
function maxDeposit(address) external view returns (uint256);
```

{% hint style="warning" %}
**Withdrawals may be disabled.** Check `maxWithdraw(owner)` before presenting a withdraw button. When direct withdrawals are disabled, users exit via the ESPN/USDS LP on secondary markets or the redemption queue.
{% endhint %}

***

## Launch Integration Checklist

Use the verified deployed ABI and [contract addresses](https://docs.ethstrat.xyz/references/contracts.md), preview note entitlements, and simulate the exact transaction with user-selected output minima and deadline. The current app exposes STRAT conversion; esETH conversion is a separate contract path.

Do not append a STRAT staking transaction to a launch bond flow: new STRAT staking is not available in the current app. EARN staking is a separate product.

Core protocol and EARN reports are not publicly linked as of 19 October 2026. See [Audits](https://docs.ethstrat.xyz/security-and-risk/audits.md) for publication status; source verification is separate from audit coverage.

***

## Deployed Contracts

[Contracts](https://docs.ethstrat.xyz/references/contracts.md) lists live STRAT, esETH, CDT, the convertible-note NFT, EARN, sEARN, pool identifiers and launch parameters. Legacy ESPN and legacy STRAT staking addresses are identified separately. Treasury Lending remains planned.

***

## Security Considerations for Integrators

### Access Control

| Contract        | Pattern      | Owner             |
| --------------- | ------------ | ----------------- |
| esETH           | Ownable2Step | Protocol multisig |
| STRAT           | Ownable2Step | Protocol multisig |
| CDT             | Ownable2Step | Protocol multisig |
| StakedStrat     | Ownable2Step | Protocol multisig |
| ConvertibleNote | Ownable2Step | Protocol multisig |

All ownership transfers require a two-step process (propose → accept) to prevent accidental transfers to wrong addresses.

### Reentrancy

All state-changing functions on StakedStrat and ConvertibleNote are guarded by `nonReentrant`. Token transfer callbacks cannot be exploited to corrupt accounting.

### Immutability

ETH Strategy contracts are deployed without proxy-upgrade patterns. Deployed code is immutable. Governance can tune parameters (BCF, NAV floor, debt ceiling, supported LSTs, caps) but cannot change contract logic.

### What Governance Can and Cannot Change

| Can Change (new positions only)           | Cannot Change (ever)          |
| ----------------------------------------- | ----------------------------- |
| BCF / NAV floor / debt ceiling (bonding)  | Existing note entitlements    |
| Supported LST whitelist                   | Existing note timelock/expiry |
| Deposit caps                              | Existing loan terms           |
| Reward distribution addresses             | CDT supply accounting         |
| Borrow rate, loan duration (TreasuryLend) | Contract logic (no upgrades)  |

***

## Getting Help

* **Source code:** [github.com/dangerousfood/ethstrategy](https://github.com/dangerousfood/ethstrategy) (Apache 2.0)
* **Documentation:** [docs.ethstrat.xyz](https://docs.ethstrat.xyz)
* **Telegram:** [t.me/ethstrat](https://t.me/ethstrat)
* **Twitter:** [@eth\_strategy](https://x.com/eth_strategy)
