Skip to main content

Deposit Collateral

Deposit assets as collateral to enable borrowing.
1

Import Dependencies

2

Load Market and Initialize RPC

3

Build Deposit Instructions

Deposit USDC as collateral into the wallet’s borrow position.
A market can hold several reserves for the same token: one variable-rate reserve plus fixed-rate reserves. Actions take a reserve address, and getExistingFloatRateReserveByMint() returns the variable-rate one. skipLutCreation: true keeps a first deposit, including user account setup, in one transaction; without it the deposit fails with 0x17a3.
4

Build the Transaction

5

Sign and Send

The collateral is deposited and the borrow position is ready.

Borrow Assets

Borrow assets against your deposited collateral.
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 Borrow Instructions

Borrow USDT from its variable-rate reserve against the collateral.
The borrow must keep the position under its borrow limit, or the program rejects it.
5

Build the Transaction

6

Sign and Send

The USDT is in the wallet and the debt is recorded in the borrow position.