migrate_from_blend moves selected parts of a Blend V2 position into XOXNO in
one transaction. It repays selected Blend debt, withdraws selected collateral
and supply, and supplies the received assets as XOXNO collateral. Any failed
step reverts both protocols’ changes.
Prepare the migration
The caller owns the Blend position and authorizes its migration. The XOXNO protocol must be unpaused, and the Blend pool must be governance-approved; checkis_blend_pool_approved(blend_pool) before building the call.
Pass account_id = 0 to create a XOXNO account on spoke_id. For an existing
account, the caller must be its owner or active delegate and the stored spoke
must match. Existing XOXNO positions remain part of the resulting account.
Check that each asset is eligible on the selected XOXNO hub and spoke. Selected
Blend non-collateral supply also becomes XOXNO collateral. Final account
valuation requires valid prices. While debt remains, the account must pass
LTV coverage, health factor, and the configured USD collateral floor. Each
collateral position with fewer than three decimals must also retain at least
two base units after floor conversion.
Select assets and debt caps
At least one of these lists must be nonempty. A debt asset cannot repeat in
debt_caps. The same token can appear in a withdrawal list and in debt_caps,
including a looped Blend position with collateral and debt in one token.
For a full migration, size each cap slightly above that token’s accrued Blend
debt. The margin covers interest before execution. Blend returns unused funds;
the controller measures that refund and repays it into XOXNO. This reduces the
new debt, subject to share rounding. Existing XOXNO debt remains.
Understand transaction settlement
Migration borrows strategy debt at zero fee. The debt remains on the XOXNO account after measured refunds are repaid; no receiver contract or swap route is required. When both repayment and withdrawals are selected, the controller makes two Blend submissions within the same transaction:- Repay debt and measure unused-fund refunds.
- Take a separate balance snapshot, then withdraw collateral and supply.
i128::MAX). The controller supplies measured withdrawal receipts and
checks the resulting XOXNO account.
Build and authorize the call
caller must resolve to the G… wallet passed as --caller.
CLI invocation can submit the transaction. For a wallet application, this
complete function returns prepared, unsigned XDR with the published
@xoxno/sdk-js 1.0.228 builder:
migrate_from_blend and each Blend submit(from=caller)
in the transaction’s authorization tree. The controller authorizes its own
token transfers to the Blend pool.
Blend calls run under FlashLoanOngoing. Guarded financial controller
operations reject reentry with #400 FlashLoanOngoing. See the
security model.
Simulate and verify
Read accrued Blend debt, the target account’s existing positions, and XOXNO borrowing headroom before simulating the entire transaction. Check the prepared authorization tree against your locally built invocation, then sign its required authorizations. Follow Wallet integration to persist the original network, signed XDR, and hash before submission. An unknown submission outcome requires a lookup of that hash on the same network; do not repeat or replace the migration automatically. Persist the returned XOXNO account id. Check its collateral and debt balances and health factor, then read the Blend position to confirm that the selected assets moved and any intended liabilities are cleared. The controller emitsBlendMigrationEvent at ["strategy", "blend_migration"]
with account_id, blend_pool, collateral_count, supply_count, and
debt_count. Use position and pool-market events plus balance reads to
reconcile actual amounts; the migration event contains counts.
Common errors
See governance operations for Blend-pool
approval and Strategies for adjusting the
resulting XOXNO position.

