npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pollum-io/vitalfi-programs

v0.1.4

Published

VitalFi Vault Solana Program IDL and TypeScript types for on-chain medical receivables financing

Downloads

12

Readme

VitalFi Vault - Solana Program

A Solana smart contract implementing a multi-vault crowdfunding system for financing medical receivables in Brazil.

🏗️ Architecture

Core Mechanics

Users deposit during the Funding phase up to the vault's capacity. After the funding period ends or when capacity is reached, the vault is finalized:

  • Success: If total_deposited ≥ ceil(2/3 * cap) → Vault becomes Active, all funds withdrawn by authority
  • Failure: If total_deposited < ceil(2/3 * cap) → Vault becomes Canceled, users can claim refunds

For successful vaults, the authority deploys funds off-chain to finance medical receivables. At maturity, the authority returns principal + yield to the vault and calls mature_vault(). Users can then claim their proportional payout.

Flow

┌─────────────────────────────────────────────────────────────────────┐
│ 1. INITIALIZATION                                                   │
│    Authority creates vault with:                                    │
│    • cap (max capacity)                                             │
│    • target_apy_bps (display only)                                  │
│    • funding_end_ts                                                 │
│    • maturity_ts                                                    │
│    • min_deposit                                                    │
│    • asset_mint (SPL token)                                         │
└─────────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────────┐
│ 2. FUNDING PHASE (Status: Funding)                                  │
│    Users deposit SPL tokens:                                        │
│    • deposit(amount) → Creates/updates Position PDA                 │
│    • Validates: time < funding_end_ts, amount ≥ min_deposit         │
│    • Enforces: total ≤ cap                                          │
└─────────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────────┐
│ 3. FINALIZATION (After funding_end_ts OR cap reached)               │
│    Authority calls finalize_funding():                              │
│                                                                     │
│    two_thirds = (cap * 2 + 2) / 3  // Safe ceiling                  │
│                                                                     │
│    if total_deposited < two_thirds:                                 │
│        └─> Status = Canceled                                        │
│            └─> Users claim full refunds                             │
│    else:                                                            │
│        └─> Status = Active                                          │
│            └─> ALL funds transferred to authority                   │
│                └─> Deploys off-chain to finance receivables         │
└─────────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────────┐
│ 4. MATURITY (Status: Active → Matured)                              │
│    Authority returns principal + yield to vault, calls:             │
│    • mature_vault()                                                 │
│    • Calculates payout factor:                                      │
│      payout_num = vault_token_account.amount (returned)             │
│      payout_den = total_deposited                                   │
└─────────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────────┐
│ 5. CLAIMS (Status: Matured OR Canceled)                             │
│    Users call claim():                                              │
│                                                                     │
│    If Matured:                                                      │
│      entitled = floor(deposited * payout_num / payout_den)          │
│    If Canceled:                                                     │
│      entitled = deposited  // Full refund                           │
│                                                                     │
│    to_pay = entitled - already_claimed                              │
│    • Supports multiple partial claims                               │
│    • Uses u128 math for precision                                   │
└─────────────────────────────────────────────────────────────────────┘

State Accounts

Vault PDA: ["vault", authority, vault_id_bytes]

  • Stores all vault parameters and state
  • 210 bytes

Position PDA: ["position", vault, user]

  • Tracks user's deposits and claims
  • 89 bytes

Vault Token Account: ["vault_token", vault]

  • SPL token account holding deposits/returns
  • Owned by Vault PDA

Instructions

  1. initialize_vault - Create new vault
  2. deposit - User deposits during funding
  3. finalize_funding - Check threshold, activate or cancel
  4. mature_vault - Calculate payout factor after returns
  5. claim - User claims refund or payout
  6. close_vault - Close empty vault, reclaim rent

🚀 Installation

Prerequisites

Setup

# Clone repository
git clone <repository-url>
cd vitalfi-programs

# Install dependencies
yarn install

# Build program
anchor build

🧪 Tests

Run All Tests

anchor test

🚢 Deployment

Devnet

anchor deploy --provider.cluster devnet

Mainnet

anchor deploy --provider.cluster mainnet

Program ID

146hbPFqGb9a3v3t1BtkmftNeSNqXzoydzVPk95YtJNj

Configured in Anchor.toml and lib.rs.

📄 License

MIT


Built with 💜 for healthcare finance on Solana