EomiXBbg94Smu4ipDoJtuguazcd1KjLFDFJt2fCabvJ8
x0-wrapper provides a 1:1 USDC-backed stablecoin (x0-USD) that integrates with the protocol’s transfer hook and confidential transfer infrastructure. Users deposit USDC to mint x0-USD, and burn x0-USD to redeem USDC (minus a redemption fee).
Core Invariant
The protocol enforces a strict reserve invariant at all times: This ensures every x0-USD token is backed by at least 1 USDC in the reserve. TheWrapperStats.reserve_ratio_scaled() method reports the ratio as a scaled integer (10,000 = 1.0x, 10,100 = 1.01x).
Instructions
Minting & Redemption
deposit_and_mint
Deposit USDC → mint x0-USD at a 1:1 ratio. No fee on deposits.
- Minimum deposit:
MIN_DEPOSIT_AMOUNT = 1,000,000(1 USDC) - Transfers USDC from user to reserve account
- Mints equivalent x0-USD to user’s token account
- Updates
WrapperStatscounters
burn_and_redeem
Burn x0-USD → redeem USDC at 1:1 minus redemption fee.
- Minimum redemption:
MIN_REDEMPTION_AMOUNT = 1,000,000(1 USDC) - Maximum per-transaction:
MAX_REDEMPTION_PER_TX = 100,000,000,000(100K USDC) - Daily cap:
MAX_DAILY_REDEMPTIONS = 1,000,000,000,000(1M USDC) - Redemption fee:
WRAPPER_REDEMPTION_FEE_BPS = 80(0.8%)
Governance (Timelocked)
All governance actions require a 48-hour timelock (ADMIN_TIMELOCK_SECONDS = 172,800). The flow is:
Wait
48 hours must pass. The action cannot be executed before
scheduled_timestamp + ADMIN_TIMELOCK_SECONDS.schedule_fee_change / execute_fee_change
Changes the redemption fee. New fee must be within MIN_WRAPPER_FEE_BPS = 10 (0.1%) to MAX_WRAPPER_FEE_BPS = 500 (5%).
schedule_pause / execute_pause
Pauses or unpauses the wrapper. When paused, deposits and redemptions are disabled.
emergency_pause
Immediate pause — bypasses the 48-hour timelock. Used for critical security incidents.
schedule_emergency_withdraw / execute_emergency_withdraw
Withdraws reserve funds to a specified destination. Subject to the 48-hour timelock.
cancel_admin_action
Cancels any pending (not yet executed) admin action.
Admin Transfer
initiate_admin_transfer
Initiates a two-step admin transfer to a new admin pubkey.
accept_admin_transfer
The new admin accepts the transfer. Until accepted, the original admin retains control.
State Accounts
WrapperConfig
["wrapper_config"]
WrapperStats
["wrapper_stats"]
Key methods:
reserve_ratio_scaled()— Returnsreserve * 10000 / supply(10,000 = 1.0x backing)is_healthy()—ratio >= MIN_RESERVE_RATIO_SCALED(10,000)is_warning()—ratio < RESERVE_WARNING_THRESHOLD(10,100)maybe_reset_daily_counter()— Resets daily redemption volume at midnight
AdminAction
["admin_action", action_type]
Reserve Monitoring
The protocol emitsReserveAlert events when the reserve ratio drops below warning thresholds:
| Level | Condition | Meaning |
|---|---|---|
Warning | Ratio < 1.01x | Reserve approaching 1:1 — redemptions may deplete it |
Critical | Ratio < 1.0x | Undercollateralized — should not be possible under normal operation |
Events Emitted
| Event | When |
|---|---|
WrapperInitialized | Config and mint created |
DepositMinted | USDC deposited, x0-USD minted |
RedemptionCompleted | x0-USD burned, USDC redeemed |
ReserveAlert | Reserve ratio below threshold |
WrapperPausedEvent | Wrapper paused/unpaused |
FeeRateUpdated | Redemption fee changed |
AdminActionScheduled | Timelock action created |
AdminActionExecuted | Timelock action applied |
AdminActionCancelled | Pending action cancelled |
EmergencyWithdrawal | Reserve funds withdrawn |
AdminTransferred | Admin key changed |