Four Anchor programs.
Open source. Verifiable.
The protocol is four small Anchor programs that move money, defend price, pay stakers, and issue badges. All code is public. All upgrades require multisig. Upgrade authority revoked by month 6.
Smart contracts that do the work. COCKY isn't just a token — it's a system. Four programs run permissionlessly on Solana, doing what they're programmed to do, regardless of whether the team shows up to work tomorrow.
fee_router picks up the trading-fee revenue and splits it five ways. floor_defender buys when price drops. staking pays you for locking. sbt_minter issues the diamond-hand badge.
Anyone can read the source. Anyone can audit it. Once we revoke upgrade authority, even we can't change it.
fee_routerRoutes Token-2022 transfer fees into the waterfall.
floor_defenderReads oracles, conditionally buys + burns when price < floor.
stakingLock-and-earn with cumulative_per_share accumulator. No inflation.
sbt_minterVerifies Merkle proof, mints non-transferable Token-2022 NFT.
Owns the Token-2022 withdraw-withheld authority. Anyone can call harvest_and_route() to crank the system. Splits configured on-chain as basis points; ops cut hard-capped at 10%.
Key instructions
State shape
#[account]
pub struct Config {
pub bump: u8,
pub governance: Pubkey, // 3-of-5 Squads multisig
pub mint: Pubkey, // COCKY mint
pub buyback_bps: u16, // 4000 (40%)
pub lp_bps: u16, // 2000 (20%)
pub floor_bps: u16, // 2000 (20%)
pub staking_bps: u16, // 1500 (15%)
pub ops_bps: u16, // 500 (5%, capped)
pub harvest_threshold: u64, // trigger amount
pub last_harvest_ts: i64,
pub cumulative_buybacks: u64, // ratchets the floor
}Events
#[event]
pub struct WaterfallExecuted {
pub harvested: u64,
pub buyback: u64,
pub lp: u64,
pub floor: u64,
pub staking: u64,
pub ops: u64,
pub timestamp: i64,
}Holds a SOL reserve. On defend() calls (permissionless), reads price from Pyth + pool TWAP and conditionally executes a market buy.
Floor formula
floor_usd = base_floor + (ratchet_coeff * cumulative_buybacks) / 1e6
If pool_price_usd < floor_usd && now - last_trigger > COOLDOWN:
spend_sol = min(reserve_balance, max_per_trigger)
swap_sol_for_cocky(spend_sol) // via Jupiter CPI
burn_cocky(received) // deflationary
last_trigger_ts = now
tokens_defended += receivedKey parameters
Failure modes
- · Reserve empty → returns error, doesn't crash
- · Cooldown not elapsed → returns error
- · Pyth oracle stale > 60s → returns error (no defense on bad data)
- · Price above floor → returns error (no defense needed)
Classic Masterchef-style accumulator. Yield comes from the 15% of fees deposited each harvest — not from inflation.
Math
stake_weight = staked_amount * lock_multiplier * sbt_multiplier
// lock_multiplier: 7d=1.0, 30d=1.5, 90d=2.5, 180d=4.0
// sbt_multiplier: default 1.0, SBT-holder 1.5
// On each fee_router::harvest_and_route, the staking
// program receives a deposit_rewards(amount) CPI:
acc_reward_per_share += (amount * PRECISION) / total_weight
// On user actions (stake / unstake / claim):
pending = position.weight * acc_reward_per_share / PRECISION - position.reward_debt
position.reward_debt = position.weight * acc_reward_per_share / PRECISIONLock tiers
Early withdraw
If now < unlock_ts on unstake: forfeit all pending rewards AND pay a 10% principal penalty back into the reward pool. Existing stakers benefit when someone breaks early.
Token-2022 with NonTransferable extension. Issued by an off-chain indexer that publishes daily Merkle roots committing to (wallet, hold_days, tier).
Flow
- Indexer reads all token holders + their hold history from block-1 (via Helius webhooks).
- Computes daily a Merkle tree of
(wallet, tier, epoch)tuples for every wallet meetingbalance ≥ threshold AND hold_days ≥ tier_days. - Multisig signs
publish_root(new_root). Stored on-chain in the program State. - Eligible wallet calls
claim_sbt(proof, tier)— the program verifies the Merkle proof against the current root and mints a non-transferable Token-2022 NFT with TokenMetadata. - Mint authority is a program PDA. Each wallet can hold at most one SBT per tier.