Skip to main content
Create a lending account by supplying collateral through the controller. For the lending app, use the getting started guide. For a wallet or portfolio integration, use the wallet integration guide for SDK transaction preparation, signing, API positions, prices, and token metadata.

Prepare the inputs

Use the Stellar CLI and a funded signing account. Select the network and check its contract addresses. The example requires: A market key is { hub_id, asset }. The same token in two hubs represents two independent markets. See Markets for the model.

Supply collateral

Set CONTROLLER to the selected controller address. Set IDENTITY to your configured CLI signing identity and CALLER_ADDRESS to its Stellar G... address. Replace the token and amount placeholders. Pass account_id = 0 to create a lending account.
The call returns the account id. Store it for subsequent actions. Creation mints a position NFT to the caller; transferring that NFT transfers control of its collateral and debt together. The caller authorizes the controller invocation and the nested token transfer to the pool. The CLI simulates the invocation before submission. In a wallet integration, build the transaction, prepare it through Soroban RPC, sign the prepared transaction, then submit it. Preparation supplies the footprint, authorization entries, and resource fees. For contract callers, use the vault supply authorization recipe.

Verify the position

Set ACCOUNT_ID to the returned lending account id. Read its supplied amount without sending a transaction:
The result is in token base units and includes accrued interest. The account has no debt until a borrow succeeds.
Health factor uses WAD (1e18); values below 1e18 permit liquidation. i128::MAX can mean no debt, a saturated ratio, or a missing account. Check account_exists and debt positions before displaying it as debt-free. Continue with Supply for supply constraints, Borrow to add debt, or System architecture for contract responsibilities.