Skip to main content

Deposit Collateral

Deposit assets as collateral to enable borrowing.
1

Add Dependencies

klend-interface is a lightweight Rust instruction builder that creates Vec<Instruction> with required refresh instructions prepended automatically.
2

Set Up RPC Client

3

Build Obligation Context

Derive the obligation PDA, fetch its account data along with all associated reserves, and build an ObligationContext.
ObligationContext is the recommended approach for obligation-based operations. It fetches the obligation and its associated reserves, then provides convenient .deposit(), .borrow(), .repay(), and .withdraw() methods.
4

Derive Token Accounts

5

Build Instructions

6

Build and Send Transaction

The deposit is complete. Your collateral has been supplied and your borrow position is open.