← ClaudeAtlas

marginfilisted

Complete guide for Marginfi - Solana's decentralized lending protocol for lending, borrowing, leveraged positions(looping) and flash loans. Covers account creation, deposits, borrows, repayments, withdrawals, flash loans, and leveraged positions using the @mrgnlabs/marginfi-client-v2 SDK.
sendaifun/skills · ★ 128 · AI & Automation · score 78
Install: claude install-skill sendaifun/skills
# Marginfi Development Guide Build lending and borrowing applications on Solana with Marginfi - a decentralized, overcollateralized lending protocol offering deposits, borrows, flash loans, and leveraged positions. ## Overview Marginfi provides: - **Lending & Borrowing**: Deposit collateral to earn yield, borrow against your deposits - **Multiple Accounts**: Create multiple accounts per wallet with independent positions - **Risk Management**: Advanced health calculations using asset and liability weights - **Flash Loans**: Atomic, uncollateralized lending within a single transaction - **Looping**: Leverage positions by depositing and borrowing in a single transaction - **Multi-Asset Support**: SOL, USDC, LSTs (JitoSOL, mSOL), and more ## Quick Start ### Installation ```bash # Marginfi client SDK npm install @mrgnlabs/marginfi-client-v2 # Common utilities npm install @mrgnlabs/mrgn-common # Required peer dependencies npm install @solana/web3.js @coral-xyz/anchor ``` ### Environment Setup ```bash # .env file SOLANA_RPC_URL=https://api.mainnet-beta.solana.com WALLET_KEYPAIR_PATH=./keypair.json ``` ## Marginfi SDK (marginfi-client-v2) The SDK enables interaction with Marginfi's lending protocol for deposits, borrows, repayments, withdrawals, and advanced operations. ### Core Classes | Class | Purpose | |-------|---------| | `MarginfiClient` | Main client for loading groups and banks | | `MarginfiAccountWrapper` | User account management and lending operations | | `B