CoalesceFi Documentation
Welcome to the CoalesceFi Protocol documentation. CoalesceFi is an institutional-grade DeFi lending protocol built on Solana, featuring credit lines, fixed-rate pools, and advanced access control.
Quick Start
For Developers
- SDK Installation - Get started in 5 minutes
- Quickstart Guide - Build your first CoalesceFi app
- Complete Operations Guide Legacy Solend operations plus CoalesceFi admin/access flows
For Product Managers
- System Overview - High-level architecture and features
- Comparison with Solend - What makes CoalesceFi different
Complete Integration Examples
** Recommended starting point** - End-to-end workflows with complete, executable code:
| Guide | Description | Lines of Code |
|---|---|---|
| Whitelist & Blacklist Workflow | Whitelist, blacklist, and access mode changes | |
| Complete Borrow Flow | Collateralized lending from pool creation to repayment | |
| Credit Line Workflow | Undercollateralized lending with inline credit limits |
Each guide includes:
- Complete, copy-paste ready TypeScript code
- All required imports and setup
- Step-by-step explanations
- Error handling examples
- PDA structures and sizes
- Common patterns and best practices
Core Features
Access Control
- Whitelist System - Mandatory access control (September 2024 update)
- Blacklist System - Block malicious actors instantly
- Pool Ownership - Owner-exclusive pool access
Lending Options
- Credit Lines - Undercollateralized lending with token-specific limits
- Fixed-Rate Pools - Predictable interest rates
- Fixed-Term Pools - Structured debt with maturity dates
Platform Management
- Admin Transfer - Transfer platform authority
- Platform Pause - Emergency controls
SDK Documentation
Essential Guides
| Doc | Purpose | When to Use |
|---|---|---|
| Installation | Setup SDK in your project | First time setup |
| Quickstart | Basic concepts and patterns | Learning the SDK |
| Complete Operations Guide | All 22 operations with examples | Primary reference |
| Pool Operations | Advanced pool management | Multi-pool setups |
| Error Handling | Error codes and recovery | Production apps |
| API Reference | Complete API documentation | Looking up functions |
SDK Capabilities
Solend Legacy Operations (14 operations)
- Market initialization, reserve management
- Deposits, withdrawals, collateral management
- Borrowing, repayment, liquidations
- Flash loans
CoalesceFi Extensions (actively implemented)
- Platform initialization and configuration (
InitPlatformConfig,UpdatePlatformConfig) - Access control and credit limits (
ModifyUserAccess) - Admin management (
TransferAdmin)
Other discriminants (e.g., exclusive pools, remove token limit) remain reserved for future releases.
User Flows
Quick Flows
Complete Flows (Recommended)
Architecture
System Design
- System Architecture - Technical overview
- Comparison with Solend - Key differences
Technical Reference
- Instructions Reference - All 22 instructions
- Constants - Access modes, limits, error codes
Common Use Cases
1. Institutional Credit Line
Goal: Set up undercollateralized lending for institutions
// See: Complete Credit Line Flow
- Whitelist institution β
- Set TOKEN_SPECIFIC mode β
- Grant $1M USDC credit limit β
- Institution borrows without collateral βGuide: Complete Credit Line Flow
2. Fixed-Rate Lending Pool
Goal: Create a pool with guaranteed 8% APR
// See: Create Fixed-Rate Pool
- Create pool with 8% fixed rate β
- Lenders deposit and lock in 8% returns β
- Borrowers get predictable interest βGuide: Create Fixed-Rate Pool
3. 90-Day Term Loan
Goal: Structured debt with maturity and penalties
// See: Fixed-Term Pool Creation
- Create 90-day term pool β
- Set early/late penalties β
- Automatic expiry enforcement βGuide: Create Fixed-Term Pool
4. Whitelist Management
Goal: Control who can access your pools
// See: Complete Whitelist Flow
- Batch whitelist approved users β
- Set pool-specific access β
- Blacklist bad actors βGuide: Complete Whitelist Flow
Key Concepts
Access Modes
| Mode | Value | Description | Use Case |
|---|---|---|---|
| NO_ACCESS | 0 | No borrowing | Disabled users |
| UNLIMITED | 1 | Collateral-based | Standard DeFi |
| TOKEN_SPECIFIC | 2 | Credit limits per token | Institutional credit |
Pool Types
| Type | Rate | Duration | Use Case |
|---|---|---|---|
| Variable | Utilization-based | Perpetual | DeFi lending |
| Fixed | Constant | Perpetual or term | Predictable rates |
| Fixed-Term | Fixed | Fixed duration | Structured debt |
Account Sizes
| Account | Size | Purpose |
|---|---|---|
| UserState | 81 bytes | Access control + credit limits |
| AccessControl | 82 bytes | Pool-specific access |
| PoolOwnership | 106 bytes | Pool ownership info |
| PoolRateConfig | 57 bytes | Rate and term config |
π§ Development Tools
Package Information
- Package:
@coalescefi/sdk - Version: 1.0.0
- Location:
/packages/sdk/ - Language: TypeScript
- Dependencies:
@solana/web3.js,borsh
Installation
npm install @coalescefi/sdk
# or
yarn add @coalescefi/sdk
# or
pnpm add @coalescefi/sdkBasic Usage
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
import { CoalesceFiSDK } from '@coalescefi/sdk';
import { buildPoolTransactions } from '@coalescefi/shared-core/sdk-adapter/flows/pool';
import { depositReserveLiquidity } from '@coalescefi/shared-core/sdk-adapter/flows/deposit';
import BN from 'bn.js';
// Initialize SDK client
const connection = new Connection('https://api.devnet.solana.com', 'confirmed');
const programId = new PublicKey('YOUR_PROGRAM_ID');
const sdk = new CoalesceFiSDK(connection, programId, 'devnet');
// Use flow functions for operations
const poolResult = await buildPoolTransactions({
client: { connection, programId, sdk, cluster: 'devnet' },
lendingMarket,
liquidityMint,
owner: creator.publicKey,
poolType: 'credit-only',
borrowRate: 8.5,
// ... other config
});
// See Complete Operations Guide for full examplesSupport & Resources
Documentation
- This README - Start here
- Complete Operations Guide - Primary reference
- Complete Flows - End-to-end examples
Code Examples
All examples in this documentation are:
- Complete - No placeholders, ready to run
- Tested - Based on actual SDK exports
- Current - Updated for latest SDK version
- Commented - Explanations included
Getting Help
- Check the docs - Start with Complete Operations Guide
- Review examples - See Complete Flows
- API Reference - Full API Documentation
- Error Codes - Error Handling Guide
πΊοΈ Documentation Map
docs/
βββ README.md (You are here)
βββ SUMMARY.md (Table of contents)
β
βββ sdk/ # SDK Documentation
β βββ README.md # SDK overview
β βββ installation.md # Setup guide
β βββ quickstart.md # Quick start
β βββ complete-operations-guide.md # ALL operations
β βββ pool-operations.md # Advanced pools
β βββ error-handling.md # Errors & recovery
β βββ reference.md # API reference
β
βββ user-flows/ # Integration Examples
β βββ complete-whitelist-flow.md
β βββ complete-borrow-flow.md
β βββ complete-credit-line-flow.md
β βββ fixed-rate/create-pool.md
β βββ fixed-term/create-pool.md
β
βββ features/ # Feature Documentation
β βββ credit-lines.md
β βββ whitelist.md
β βββ blacklist.md
β βββ fixed-interest-rate.md
β βββ fixed-term-pools.md
β βββ pool-ownership.md
β
βββ introduction/ # Overview
β βββ overview.md
β βββ architecture.md
β βββ comparison-with-solend.md
β
βββ reference/ # Technical Reference
βββ instructions-reference.md
βββ constants.mdRecommended Reading Path
New to CoalesceFi?
Building an Integration?
Implementing Credit Lines?
Creating Pools?
Ready to build? β SDK Installation | Complete Operations Guide
Need help? β Error Handling | API Reference