Integrating IBTs and wrappers
Connect vault-compatible yield sources and Blend positions to Stellar Core.
Core v2 expects its IBT to implement a FungibleVault-style surface. A compatible vault can be used directly; incompatible yield sources require a wrapper.
Expected behavior
The PT relies on the IBT for:
- Underlying and share token identity and decimals.
- Deposit, redeem, and exact-output withdrawal operations.
- Preview functions and maximum serviceable amounts.
- A consistent share-to-underlying conversion rate.
- Transferable SEP-41 shares and allowances.
The IBT must already have positive total assets before a PT market can initialize.
Wrapper framework
The abstract Spectra wrapper provides shared vault logic, conversion previews, slippage-aware variants, pause and upgrade controls, and optional reward-proxy hooks. It is a Rust library and does not produce a deployable contract by itself.
A concrete wrapper supplies the yield-source operations and rate model while preserving the wrapper solvency invariant:
backing position >= outstanding wrapper sharesBlend adapter
Blend bTokens are lending-pool positions rather than transferable token contracts. The Blend wrapper holds the position and issues transferable shares representing bTokens one-for-one.
| Operation | Blend wrapper support |
|---|---|
| Deposit underlying | Supported |
| Redeem shares | Supported |
| Withdraw exact underlying | Supported |
| Mint exact shares | Not supported |
| Generic wrap or unwrap | Not supported |
The adapter uses Blend's 12-decimal b_rate and limits exits to available pool liquidity. Core refreshes the rate before withdrawal-sensitive calculations to handle rate decreases caused by bad-debt socialization.
Review checklist
- Confirm the vault surface and SEP-41 authorization behavior.
- The IBT should closely follow the FungibleVault/ERC-4626 model.
- Check whether the IBT charges fees;
preview_redeemshould account for them. - Round deposits and redemptions conservatively and enforce minimum outputs.
- Make
max_*views reflect serviceable liquidity, not only accounting value. - Define pause, upgrade, reward, and emergency-withdrawal authorities.
- Wrapper conversion and preview functions should reproduce the exact rate behavior used by the IBT's deposit and redemption flows.
- Test rate decreases, loss recovery, reward claims, and same-ledger state changes.
Reward-proxy hooks can execute with the wrapper or PT as the invoking contract. Restrict proxy configuration and harvester permissions as high-impact operational roles.