# Integrating IBTs and wrappers



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 [#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 [#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:

```text
backing position >= outstanding wrapper shares
```

## Blend adapter [#blend-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 [#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_redeem` should 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.

<Callout type="warn">
  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.
</Callout>
