Skip to main content

Sable Citadel

The Citadel vault combines Endur liquid staking with Vesu lending to generate dual yield streams on deposited WBTC.
Risk Level: 2 (Low-Medium)
Strategy: Stake WBTC → xWBTC → Supply to Vesu as collateral

Strategy Overview

WBTC → Endur Vault → xWBTC (liquid staking token)

                   Vesu Re7 xBTC Pool (collateral)

         Dual Yield: Staking APY + Lending APY + STRK Rewards

Yield Sources

SourceTypeDescription
Endur Staking APYBase yieldValidator rewards from BTC staking via Endur
Vesu Lending APYAdditional yieldInterest from xWBTC lending on Vesu
BTCFi STRK RewardsIncentive100M STRK distribution
xWBTC AppreciationCapital gainxWBTC/WBTC ratio increases over time

Risk Profile

  • No leverage: No borrowed positions or liquidation risk
  • Endur protocol risk: Smart contract and liquid staking risks
  • 7-day withdrawal queue: Endur unstaking takes 7 days (mitigated by AVNU swap)
  • xWBTC/WBTC depeg risk: Minimal due to Endur’s backing mechanism

Contract Architecture

File: citadel.cairo (~600 LOC)
Deployed: 0x077ad8d0fe4b946cedc02eb8eb61a64e85bcde802a83e879e8c68fed8b9b130e

Core Components

Citadel manages two distinct positions:
  1. Endur xWBTC: Liquid staking shares (ERC-4626)
  2. Vesu Collateral: xWBTC supplied to Vesu Re7 xBTC pool
struct Storage {
    // ...
    endur_vault: ContractAddress,     // Endur xWBTC ERC-4626 vault
    vesu_singleton: ContractAddress,
    vesu_pool_id: felt252,
    // Strategy state
    xwbtc_staked: u256,               // Total xWBTC shares held
    vesu_collateral: u256,            // xWBTC supplied to Vesu
    is_paused: bool,
}

Key Functions

User Functions

deposit
function
Deposit WBTC and receive yvBTC-CIT sharesParameters:
  • assets (u256): Amount of WBTC to deposit (8 decimals)
  • receiver (ContractAddress): Address to receive vault shares
Returns: u256 — Number of shares mintedAuto-deploys to: WBTC → Endur → xWBTC → Vesu collateral
withdraw
function
Burn shares and withdraw WBTCParameters:
  • assets (u256): Amount of WBTC to withdraw
  • receiver (ContractAddress): Address to receive WBTC
  • owner (ContractAddress): Share owner
Returns: u256 — Number of shares burned
Auto-unwind: Withdrawals trigger:
  1. Withdraw xWBTC from Vesu
  2. Swap xWBTC → WBTC via AVNU (Ekubo pool)
  3. Transfer WBTC to receiver

Curator Functions

stake_to_endur
function
Stake idle WBTC into Endur vaultParameters:
  • amount (u256): WBTC to stake
fn stake_to_endur(ref self: ContractState, amount: u256)
Implementation at citadel.cairo:327
deploy_xwbtc_to_vesu
function
Supply xWBTC to Vesu Re7 xBTC poolParameters:
  • amount (u256): xWBTC shares to supply
fn deploy_xwbtc_to_vesu(ref self: ContractState, amount: u256)
Implementation at citadel.cairo:347
withdraw_from_vesu
function
Withdraw xWBTC collateral from VesuParameters:
  • amount (u256): xWBTC shares to withdraw
fn withdraw_from_vesu(ref self: ContractState, amount: u256)
Implementation at citadel.cairo:382
unwind_xwbtc
function
Emergency unwind: withdraw all xWBTC from Vesu + swap to WBTC via AVNUParameters:
  • min_amount_out (u256): Minimum WBTC output (slippage protection)
  • routes (Array<Route>): AVNU swap routes
fn unwind_xwbtc(ref self: ContractState, min_amount_out: u256, routes: Array<Route>)
Implementation at citadel.cairo:429
Uses AVNU to bypass Endur’s 7-day withdrawal queue.

Integration with External Protocols

Endur Liquid Staking

Vault Address: endur_vault (constructor parameter) Citadel uses Endur’s ERC-4626 vault to stake WBTC:
let endur = IERC4626Dispatcher { contract_address: endur_addr };
let xwbtc_shares = endur.deposit(wbtc_amount, vault_address);
xWBTC Share Price: Increases over time as staking rewards accrue

Vesu Re7 xBTC Pool

Pool ID: 0x03a8416bf20d036df5b1cf3447630a2e1cb04685f6b0c3a70ed7fb1473548ecf Citadel supplies xWBTC as collateral (no debt) to earn BTCFi rewards:
let params = ModifyPositionParams {
    collateral_asset: endur_addr,  // xWBTC token
    debt_asset: wbtc_addr,         // Valid asset (zero debt)
    user: vault_address,
    collateral: Amount { /* xWBTC shares */ },
    debt: Amount { /* zero */ },
};
vesu.modify_position(params);

AVNU xWBTC/WBTC Swap

For withdrawals, Citadel swaps xWBTC → WBTC via Ekubo xWBTC/WBTC pool (fee: 0.01%, tick_spacing: 200):
let swap_params: Array<felt252> = array![
    wbtc_felt,    // token0 (WBTC < xWBTC by address)
    endur_felt,   // token1
    0x68db8bac710cb4000000000000000, // fee
    0xc8,         // tick_spacing = 200
    0x0,          // extension
    0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, // sqrt_ratio_limit (max)
];
From citadel.cairo:697

Example Usage

Depositing WBTC

import { Contract } from 'starknet'

const citadelVault = new Contract(citadelABI, citadelAddress, account)
const wbtc = new Contract(erc20ABI, wbtcAddress, account)

// 1. Approve vault
const amount = 50_000_000n // 0.5 WBTC
await wbtc.approve(citadelAddress, amount)

// 2. Deposit (auto-stakes to Endur + supplies to Vesu)
await citadelVault.deposit(amount, account.address)

// 3. Check yvBTC-CIT balance
const shares = await citadelVault.balance_of(account.address)

Withdrawing WBTC

// Get withdrawable assets
const maxWithdraw = await citadelVault.max_withdraw(account.address)

// Withdraw all (auto-unwinds xWBTC → WBTC swap)
await citadelVault.withdraw(maxWithdraw, account.address, account.address)

Checking Strategy State

// Total xWBTC staked (shares)
const xwbtcStaked = await citadelVault.get_endur_staked()

// xWBTC supplied to Vesu
const [vesuCollateral, debt, loops, paused] = await citadelVault.get_strategy_info()

// Convert xWBTC shares to WBTC value
const endurVault = new Contract(erc4626ABI, endurAddress, provider)
const wbtcValue = await endurVault.convert_to_assets(xwbtcStaked)

Security Considerations

Risks

  1. Endur Protocol Risk: Smart contract vulnerabilities in Endur’s staking mechanism
  2. xWBTC Depeg Risk: If Endur’s backing mechanism fails, xWBTC could trade below WBTC
  3. Vesu Pool Risk: Smart contract risk in Vesu Re7 xBTC pool
  4. Swap Liquidity Risk: Low liquidity in xWBTC/WBTC Ekubo pool could cause slippage on large withdrawals

Risk Mitigation

  • 7-day queue bypass: AVNU swap allows instant withdrawals without waiting
  • No liquidation risk: Citadel never borrows, so no liquidations
  • Pause mechanism: Owner can halt deposits if issues arise
  • Upgradeable: Contract can be upgraded to fix bugs

Additional Resources

Build docs developers (and LLMs) love