Skip to main content
This guide documents every argument involved in deploying a DeFindex vault — whether you call the factory smart contract directly or use the DeFindex REST API. Read the Vault Creation Requirements section first before proceeding.

Quick Reference: Contract Addresses

Testnet

Stellar wipes the testnet periodically, and these addresses stop working when it does. The next scheduled reset is December 16, 2026. If an address no longer works, let us know via Discord so we can update the docs.

Mainnet

For the complete list of mainnet strategies, see Contract Deployments.

POST /factory/create-vault

Builds an unsigned XDR to deploy a vault. You must sign the XDR and submit it via POST /send.

Request Body

Field Reference

Response

Sign the returned xdr with the caller’s key and submit via POST /send?network=testnet.

POST /factory/create-vault-deposit

Creates a vault and performs the initial deposit atomically. This is the recommended approach since it handles Steps 3 and 4 in a single transaction.

Request Body

Additional Field

All other fields are identical to create-vault above.
Decimal reference: 1 USDC = 10_000_000 stroops (7 decimals). 1 XLM = 10_000_000 stroops. The minimum 1001 stroops equals 0.0001001 units.

Response

Same shape as create-vault:

POST /factory/create-vault-auto-invest

Creates a vault, makes the initial deposit, and immediately rebalances (invests) into strategies — all in one batched transaction. At the end it also transfers the Manager role to the final address. This is the most convenient option for fully automated deployments.

Request Body

Field Reference

Strategy amounts must sum to the asset amount. If assets[0].amount = 10000000, then all strategies[].amount values for that asset must add up to 10000000.

Response

The predictedVaultAddress is derived from simulation and is accurate in most cases, but treat it as advisory until the transaction confirms on-chain.

Complete Testnet Example (TypeScript)

This example deploys a BlendUSDC vault on testnet using the create-vault-deposit endpoint.
Before running: Make sure you have BlendUSDC in your wallet. Go to testnet.blend.capital, connect your Freighter wallet (on Testnet), and use the faucet to receive BlendUSDC.

Complete Mainnet Example (TypeScript)


After Deployment: First Rebalance

After the vault is deployed and the first deposit is made, call the rebalance function to invest funds into your chosen strategies. Without this step, all deposited funds remain idle (uninvested) in the vault. See the Rebalance section in the main Create a Vault guide for how to do this via the API or stellar-cli.
If you used create-vault-auto-invest, the initial rebalance is already done for you as part of the deployment transaction.

Testnet vs Mainnet Differences at a Glance


Troubleshooting

StrategyDoesNotSupportAsset (error 102)
The strategy address you provided does not support the asset token you specified. Double-check that the strategy address matches the asset and the strategy/asset/network relation is correct. For example, the USDC strategy cannot be used with the XLM token address or, the USDC strategy on testnet cannot be used with the USDC token address from mainnet.
Transaction fails with simulation error on testnet
You may not have a BlendUSDC trustline. Visit testnet.blend.capital, connect your wallet, and add the BlendUSDC asset before trying again.
RolesIncomplete (error 104)
All four roles (0–3) must be provided. If you leave any out, the factory will reject the transaction.
FeeTooHigh (factory error 406)
The vaultFeeBps value exceeds the maximum allowed. Keep it at or below 9,000 (90% of yield).
AmountNotAllowed (error 110)
The initial deposit amount is zero or negative. Provide at least 1001 stroops per asset.
For additional errors, see the Troubleshooting Guide.