Overview

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

  1. SDK Installation - Get started in 5 minutes
  2. Quickstart Guide - Build your first CoalesceFi app
  3. Complete Operations Guide Legacy Solend operations plus CoalesceFi admin/access flows

For Product Managers

Complete Integration Examples

** Recommended starting point** - End-to-end workflows with complete, executable code:

GuideDescriptionLines of Code
Whitelist & Blacklist WorkflowWhitelist, blacklist, and access mode changes
Complete Borrow FlowCollateralized lending from pool creation to repayment
Credit Line WorkflowUndercollateralized 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

Lending Options

Platform Management

SDK Documentation

Essential Guides

DocPurposeWhen to Use
InstallationSetup SDK in your projectFirst time setup
QuickstartBasic concepts and patternsLearning the SDK
Complete Operations GuideAll 22 operations with examplesPrimary reference
Pool OperationsAdvanced pool managementMulti-pool setups
Error HandlingError codes and recoveryProduction apps
API ReferenceComplete API documentationLooking 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

Architecture

System Design

Technical Reference

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

ModeValueDescriptionUse Case
NO_ACCESS0No borrowingDisabled users
UNLIMITED1Collateral-basedStandard DeFi
TOKEN_SPECIFIC2Credit limits per tokenInstitutional credit

Pool Types

TypeRateDurationUse Case
VariableUtilization-basedPerpetualDeFi lending
FixedConstantPerpetual or termPredictable rates
Fixed-TermFixedFixed durationStructured debt

Account Sizes

AccountSizePurpose
UserState81 bytesAccess control + credit limits
AccessControl82 bytesPool-specific access
PoolOwnership106 bytesPool ownership info
PoolRateConfig57 bytesRate 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/sdk

Basic 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 examples

Support & Resources

Documentation

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

  1. Check the docs - Start with Complete Operations Guide
  2. Review examples - See Complete Flows
  3. API Reference - Full API Documentation
  4. 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.md

New to CoalesceFi?

  1. System Overview
  2. SDK Installation
  3. Quickstart Guide
  4. Complete Whitelist Flow

Building an Integration?

  1. Complete Operations Guide
  2. Complete Borrow Flow
  3. Error Handling
  4. API Reference

Implementing Credit Lines?

  1. Credit Lines Feature
  2. Complete Credit Line Flow
  3. Whitelist System

Creating Pools?

  1. Fixed-Rate Pools
  2. Fixed-Term Pools
  3. Pool Operations Guide

Ready to build? β†’ SDK Installation | Complete Operations Guide

Need help? β†’ Error Handling | API Reference