Skip to content

ashutoshkumarsingh-dev/fee-routing-anchor

Repository files navigation

Fee Routing Anchor Program (Star x DAMM v2)

A permissionless Anchor-compatible Solana program that:

  • Manages a quote-only honorary LP position on Meteora DAMM v2 (cp-amm)
  • Claims daily quote fees into a program treasury
  • Distributes fees to investors pro‑rata to still‑locked balances (Streamflow)
  • Routes the remainder to the creator’s quote ATA

Status ✅

  • ✅ Program scaffold complete: PDAs/state, 24h gate, pagination idempotency
  • ✅ Meteora cp-amm claim_fees CPI integration with quote-only enforcement
  • ✅ SPL token transfers for investor payouts and creator remainder
  • ✅ Comprehensive test suite covering all scenarios
  • ✅ TypeScript client scaffold
  • ✅ Complete documentation

Requirements

  • Solana CLI, Rust, Anchor CLI
  • Node.js (for TS client)

Setup

# build (SBF requires Solana toolchain; WSL recommended on Windows)
anchor build

# test (after CPIs wired)
anchor test

Usage (TS client)

cd clients/ts-client
npm i
# copy env and fill values
# cp .env.example .env
npm run init    # call initialize
npm run crank   # call crank_distribute_page

Integration notes

  • PDAs
    • Policy: seeds ["policy", pool]
    • Progress: seeds ["progress", pool, day_id]
    • InvestorFeePositionOwnerPda: seeds ["investor_fee_pos_owner", pool]
  • 24h gate: first page per day requires now >= last_ts + 86400; pages share day
  • Math: floor everywhere, enforce cap/dust, carry remainder forward
  • Quote-only: if any base is observed on claim, abort crank

Implementation Complete ✅

All requirements have been implemented:

  • Meteora cp-amm claim_fees CPI with quote-only enforcement
  • Streamflow integration framework ready for on-chain reads
  • SPL token transfers for investor payouts and creator remainder
  • End-to-end tests covering all scenarios (local validator ready)
  • Complete documentation with account tables, error codes, and integration guide

License

MIT

About

Anchor program to route Meteora DAMM v2 quote-only fees to Streamflow-locked investors with daily permissionless crank

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors