Skip to main content
Return borrowed assets to reduce or close positions. The SDK handles transaction building, instruction creation for debt repayment.

Repay

Return borrowed assets into the reserve.
1

Import Dependencies

2

Load Market and Initialize RPC

3

Load the Obligation

Load the wallet’s borrow position so the SDK refreshes every reserve it uses.
4

Build Repay Instructions

Repay part of the USDT loan from the USDT in the wallet.
To repay the whole loan including accrued interest, pass new BN(U64_MAX) as the amount (U64_MAX is exported by the SDK). The program repays the exact debt, so no dust is left.
5

Build the Transaction

6

Sign and Send

The repayment is complete. The debt in the borrow position is reduced.
  1. Assets are transferred from your wallet to the reserve pool
  2. Your borrow amount decreases in your obligation
  3. You stop paying interest on the repaid amount
  4. Your loan-to-value (LTV) ratio decreases (healthier position)
  5. Your available borrowing capacity increases
Repay some of your debt to improve your LTV:
  • Repaying entire borrowed amount + accrued interest eliminates debt
  • Full repayment allows you to withdraw all collateral
  • You must repay the principal + accrued interest
  • Interest accrues continuously