CollateralVault lets you interact with a deployed collateral lending pool: pledge any Ankara Chain RWA token as collateral, borrow the vault’s configured stablecoin up to the configured loan-to-value (LTV) ratio, repay, or liquidate an undercollateralized loan. Token prices are read from an on-chain oracle to calculate live LTV in real time.
Stellar Soroban only in v1.
CollateralVault is backed by a Soroban contract — pass a StellarAdapter. Calling any method with an EVMAdapter will throw. EVM support is planned for a future release.CollateralVault is a singleton per network — one vault instance holds many loans. You do not deploy it via TokenFactory; it is provisioned once per deployment environment by the platform operator. Obtain the vault’s contract address from the Ankara Chain network registry or your platform configuration.Import
Constructor
IAdapter
required
A
StellarAdapter connected to the Stellar network where the vault is deployed. Obtain it from tokenFactory.adapter after constructing TokenFactory with network: "stellar" or "stellar-testnet".string
required
The Soroban contract ID of the deployed
CollateralVault (starts with "C...").Borrower Methods
openLoan
collateralAmount of an RWA token and borrows borrowAmount of the vault’s stablecoin. The oracle price of the collateral token is checked at the time of opening to ensure the borrow amount does not exceed the vault’s LTV.
string
required
Soroban contract ID of the RWA token to pledge as collateral (e.g. the address of a deployed
FarmlandToken).bigint
required
Amount of collateral token to lock, in the token’s native precision (typically 1e7 for Stellar tokens).
bigint
required
Amount of stablecoin to borrow, in the stablecoin’s native precision. Must not exceed
collateralValue × ltvBps / 10000.Promise<{ loanId: number; txHash: string }>
number
Unique integer ID for this loan. Use it with
repayLoan, liquidate, and getLoan.string
Transaction hash of the loan opening.
repayLoan
number
required
The loan ID returned from
openLoan.liquidate
currentLtvBps) has crossed the liquidation threshold — it is not restricted to an admin.
number
required
The ID of the loan to liquidate.
Read Methods
getLoan
number
required
The loan ID to query.
string
Address of the borrower.
string
Contract ID of the pledged collateral token.
bigint
Locked collateral amount.
string
Contract ID of the borrowed stablecoin.
bigint
Borrowed amount in the stablecoin’s precision.
number
The LTV (in basis points) locked in at loan open time. This value does not change if the vault’s global LTV config is updated later.
bigint
Unix timestamp when the loan was opened.
LoanStatus
OPEN (0) · REPAID (1) · LIQUIDATED (2)getBorrowerLoans
borrower is omitted, defaults to the connected signer’s own loans.
string
Optional wallet address to query. Defaults to the connected signer.
currentLtvBps
loan.ltvBps — it recalculates using the latest oracle price, so it changes as the collateral token’s value moves.
number
required
The open loan ID.
isLiquidatable
true if the loan’s live LTV has crossed the liquidation threshold and can be liquidated.
getBorrowedToken
getOracle
getLtvBps
6000 = 60%).
getLiquidationThresholdBps
currentLtvBps exceeds this value, anyone can call liquidate.
isPaused
true if the vault has been administratively paused. Paused vaults reject new loan opens, repayments, and liquidations.
Admin Methods
These methods require the vault’s admin/manager role.setLtvBps
number
required
New maximum LTV in basis points, e.g.
5000 for 50%.setLiquidationThresholdBps
number
required
New liquidation threshold in basis points. Should be higher than
ltvBps to give borrowers a buffer.setOracle
string
required
Soroban contract ID of the new oracle.