Skip to content

baseddataengineer/blender-tech

Repository files navigation

Blender

https://x.com/blendercoinfun

Gemini_Generated_Image_lb8ctxlb8ctxlb8c

Blender is a deterministic reward distributor on Solana. Creator rewards flow into a program-owned Intake Vault, are blended into a Reward Pool, and are paid out to BLENDER holders via a reward-per-token index. No privacy or mixing features are implemented or intended.

What Blender Is and Is Not

  • Blender collects creator rewards, blends them into a single reward pool, and lets holders claim their share at any time.
  • Blender is not a mixer and does not provide anonymity or obfuscation.
  • Fixed-supply stake token (BLENDER); no minting after deployment, no blacklist, no freezes.

How Rewards Work

  1. Collect: Creator rewards (one SPL mint, e.g., USDC) are deposited into the Intake Vault (program-owned token account). Deposits emit CreatorRewardsDeposited.
  2. Blend: A keeper calls blend_to_pool to move funds from Intake Vault to Reward Pool. This emits BlendedToPool.
  3. Index update: update_rewards recomputes the global reward index based on Reward Pool growth; emits RewardsIndexUpdated.
  4. Claim: Holders call claim_rewards and receive their proportional share directly from the Reward Pool; emits RewardsClaimed.

Reward-per-token math

  • Scale constant: $S = 1{,}000{,}000{,}000$.
  • When the pool grows by $\Delta$, the reward index increments by $\Delta \times S / \text{total_stake}$.
  • A holder with balance $b$ and last index $I_u$ at global index $I_g$ can claim: $$\text{claimable} = b \times (I_g - I_u) / S.$$
  • No snapshots are required; accounting is deterministic from balances and the index.

On-chain Program (Anchor)

Path: programs/blender/src/lib.rs

Accounts

  • Config: reward mint, stake mint, blend authority, config authority, thresholds, cooldown.
  • GlobalRewards: reward index, total distributed, last updated slot, pool snapshot, total stake, vault bumps.
  • IntakeVault: program-owned SPL account for incoming rewards.
  • RewardPoolVault: program-owned SPL account for distributable rewards.
  • UserRewards: user checkpoint (owner, last reward index, accrued, init flag).

Instructions

  • initialize: set config, PDAs, vaults; assert stake mint authorities are revoked.
  • deposit_creator_rewards(amount): deposit reward mint into Intake Vault; emits CreatorRewardsDeposited.
  • blend_to_pool(amount): keeper-only move from Intake Vault to Reward Pool; updates index; emits BlendedToPool.
  • update_rewards(): refresh index from Reward Pool growth; emits RewardsIndexUpdated.
  • claim_rewards(): update index, compute user pending, transfer from Reward Pool; emits RewardsClaimed.
  • update_config(...): rate-limited parameter updates by config authority; emits ConfigUpdated.

Safety constraints

  • No withdrawal path except claim_rewards.
  • Reward mint is fixed in Config and enforced on vaults.
  • Stake mint must have mint_authority and freeze_authority removed before initialization.
  • Config changes are signer-gated and slot-cooled-down.
  • Checked arithmetic throughout to avoid overflows.

Off-chain Worker / Keeper (Node + TS)

Path: apps/worker

  • Watches Intake Vault for deposits.
  • Triggers blend_to_pool when intake balance exceeds threshold or on schedule.
  • Calls update_rewards after blends or periodically.
  • Persists blend cycles and reward updates to Postgres via Prisma; no custody of funds.

Web Dashboard (Next.js)

Path: apps/web

  • Overview of reward pool, total distributed, and index.
  • How it works flow and transparency page with PDAs and verification checklist.
  • Rewards page for wallet connection and claiming (UI scaffold; on-chain wiring to be added).
  • No APR or guaranteed return messaging.

Repository Structure

  • apps/web: Next.js dashboard (Tailwind, shadcn-style UI primitives).
  • apps/worker: Keeper/indexer (Node/TypeScript).
  • programs/blender: Anchor program.
  • packages/shared: Shared types/constants/reward math utilities.
  • packages/db: Prisma schema and client for Postgres.
  • docs: Specs, tokenomics, threat model.
  • scripts: Deploy and verification scripts.
  • tests: Anchor/TS tests.
  • infra: docker-compose and env examples.

Verify Vaults and Events On-Chain

  • Derive PDAs with seeds: config, global_rewards, intake, reward_pool, user_rewards.
  • Both Intake and Reward Pool token accounts must be owned by the program PDA and use Config.reward_mint.
  • Stake mint must show no mint or freeze authority.
  • Observe events: CreatorRewardsDeposited, BlendedToPool, RewardsIndexUpdated, RewardsClaimed, ConfigUpdated.

Local Development Quickstart

Prereqs: pnpm, Rust toolchain, Anchor, Solana CLI, Docker.

pnpm install

# Start Postgres
docker compose -f infra/docker-compose.yml up -d

# Generate Prisma client
cd packages/db && pnpm generate && cd ../..

# Build Anchor program
anchor build

# Run tests
pnpm test

# Run web (in another shell)
cd apps/web && pnpm dev

# Run worker (scaffold loop)
cd apps/worker && pnpm dev

Deployment (devnet outline)

  1. Set Anchor.toml provider cluster to devnet and configure ~/.config/solana/id.json with funds.
  2. Build and deploy program: anchor build && anchor deploy --program-name blender.
  3. Record the program ID and update PROGRAM_ID in env files and shared constants if needed.
  4. Initialize config with reward mint, stake mint (authorities revoked), blend authority, thresholds, and cooldown slots.
  5. Fund Intake Vault with the reward mint and let the keeper run.

Tests

  • Rust unit tests for reward math (tests/src/lib.rs).
  • TypeScript tests for worker threshold logic and dashboard claimable math (tests/ts/*).

Documentation

  • docs/spec.md: protocol specification and instruction behaviors.
  • docs/tokenomics.md: fixed-supply tokenomics and constraints.
  • docs/threat-model.md: risks, mitigations, and assumptions.

Optional Extensions (documented only)

  • Buyback module directing a portion of intake to purchase BLENDER before blending.
  • Burn module for purchased BLENDER.
  • Multi-asset reward routing via indexed pools.

About

Blender. Collects creator rewards, blends them into a reward pool and automatically distributes rewards to token holders based on transparent

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors