Skip to main content

Repaying debt on a multiply position reduces your outstanding debt balance, lowers your LTV (Loan-to-Value) ratio, and improves position health. This example shows how to repay USDC debt on a TSLAx multiply position using the Klend SDK.

Multiply Repay with xStocks

Repay debt on a TSLAx multiply position to reduce leverage and improve position health.
1

Import Dependencies

2

Load Market and Initialize RPC

3

Load the Multiply Obligation

A Multiply position is its own obligation, addressed by the collateral and debt mints.
4

Build Repay Instructions

Repay USDC debt on the Multiply position from the USDC in the wallet.
To repay all the debt, pass new BN(U64_MAX) as the amount (U64_MAX is exported by the SDK); the wallet needs the full debt in USDC. To repay by selling collateral instead, use Repay with Collateral.
5

Build the Transaction

6

Sign and Send

The USDC debt is reduced, lowering the position’s LTV and leverage.

Borrow and Multiply SDK Methods

Multiply operations use MultiplyObligation. Vanilla operations use VanillaObligation. The obligation type determines which PDA is derived for your position.