A Solana Anchor program for staking, unstaking, and reward emissions with per-user throttling, epoch-based claiming, and configurable emission parameters.
- Staking & Unstaking: Move tokens into and out of a program vault.
- Configurable Emission State:
- Cap total supply
- Base rate per day
- Annual decay
- Throttle target per user
- Min/Max clamp rates
- Epoch-based Reward Claiming:
- One claim per epoch (day)
- Emission supply cap enforcement
- Per-User State Tracking:
- Device count
- Last claim epoch
- Created at timestamp
stride-emission/
├── programs/
│ └── stride-emission/ # Anchor program code (lib.rs)
├── scripts/ # Client-side scripts to interact with program
├── tests/ # Anchor Mocha tests
├── migrations/ # Anchor deploy scripts
└── test-ledger/ # Local test ledger data
- Rust
- Anchor CLI
- Solana CLI
- Node.js & npm (or yarn)
npm installanchor buildsolana-test-validatoranchor deployExample: Initialize emission state
npx ts-node scripts/init.tsStake tokens:
npx ts-node scripts/stake_with_transfer.tsClaim rewards:
npx ts-node scripts/claim.ts| Instruction | Description |
|---|---|
initialize_emission_state |
Sets up global emission parameters |
configure_emission_state |
Updates emission settings |
stake_device_init |
Initializes user staking account |
stake_device |
Transfers tokens into the vault |
unstake_device |
Transfers tokens back to the user |
claim_rewards |
Mints rewards for the current epoch |
Run the Anchor tests:
anchor testTo deploy on devnet:
solana config set --url devnet
anchor deployMIT License © 2025 Will Nweke
| Date | Update |
|---|---|
| 2025-08-13 | Initial working version of program & scripts committed to GitHub |
| 2025-08-13 | Added README with setup, usage, and progress tracking |
| YYYY-MM-DD | Add more entries as you make updates |
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.