Welcome to the Solarmy Staking Program! 🌟 This is the heart of our staking ecosystem - the smart contracts that power the entire Solarmy staking experience. Whether you're a developer looking to understand our architecture or a user curious about how your staking works, you're in the right place!
The Solarmy Staking Program is a collection of Solana smart contracts that enable secure, efficient, and transparent staking of Solarmy NFTs. Built with the Anchor framework and written in Rust, these contracts handle everything from staking and unstaking to reward distribution and governance.
- 🔒 Secure Staking: Robust smart contracts for safe NFT staking
- 💰 Reward Distribution: Automated reward calculation and distribution
- ⚡ High Performance: Optimized for Solana's fast blockchain
- 🎯 Flexible Parameters: Configurable staking periods and reward rates
- 📊 Transparent Operations: All actions visible on-chain
- 🔄 Easy Integration: Clean APIs for frontend integration
Built with the best tools for Solana development:
- Blockchain: Solana for speed and low costs
- Framework: Anchor for simplified Solana development
- Language: Rust for performance and safety
- Testing: TypeScript for comprehensive test coverage
- Deployment: Automated deployment scripts
Ready to dive into the Solarmy staking contracts? Let's get you set up!
Before you begin, make sure you have:
- Node.js and yarn installed
- ts-node installed globally (
npm install -g ts-node
) - Solana CLI tools installed
- A Solana wallet with some SOL for deployment
- Your Solana wallet keypair ready (default:
/home/---/.config/solana/id.json
)
-
Install Dependencies
yarn install
-
Configure Your Environment
- Set up your
ANCHOR_WALLET
environment variable inpackage.json
- Ensure your Solana wallet is properly configured
- Set up your
-
Build the Program
anchor build
Ready to deploy your own staking program? Here's the step-by-step process:
anchor build
You'll see output like:
To deploy this program:
$ solana program deploy /home/.../staking/target/deploy/staking.so
The program address will default to this keypair (override with --program-id):
/home/.../staking/target/deploy/staking-keypair.json
solana-keygen pubkey /home/.../staking/target/deploy/staking-keypair.json
This will give you a public key like: 5N...x6k
Update lib.rs
(line 17):
declare_id!("5N...x6k");
Update Anchor.toml
(line 4):
staking = "5N...x6k"
Update types.ts
(line 6):
export const STAKING_PROGRAM_ID = new PublicKey("5N...x6k");
anchor build
solana program deploy /home/.../staking/target/deploy/staking.so
Once deployed, your staking program is ready to use!
├── programs/ # Solana smart contract programs
├── cli/ # Command-line interface and scripts
├── migrations/ # Deployment scripts
├── tests/ # Test files and examples
└── target/ # Build outputs and artifacts
/cli/script.ts
: Main functionality and staking operations/cli/types.ts
: Program account type definitions/cli/staking.ts
: IDL for JavaScript bindings
- Modify Commands: Update the main functions in
script.ts
to test different features - Verify Configuration: Ensure your
ANCHOR_WALLET
environment variable is set correctly - Run Tests: Execute
yarn ts-node
to test your staking functions
- Stake NFTs: Lock NFTs for rewards
- Unstake: Release NFTs when ready
- Claim Rewards: Collect earned tokens
- View Status: Check staking positions
- Access Control: Only authorized users can perform actions
- Input Validation: All inputs are validated for safety
- Error Handling: Comprehensive error handling and recovery
- Audit Trail: All actions are logged on-chain
We love community contributions! Here's how you can help:
- 🐛 Report Bugs: Help us identify and fix issues
- 💡 Suggest Features: Have ideas for new staking features?
- 🔧 Code Improvements: Help optimize the smart contracts
- 📝 Documentation: Enhance our guides and examples
- 🧪 Testing: Help test new features and edge cases
Need help or want to connect with other developers?
- Discord: Join our community server
- Twitter: Follow for updates and announcements
- GitHub: Report issues and contribute code
- Documentation: Check our detailed guides
We're constantly improving the staking program:
- Enhanced Rewards: More sophisticated reward algorithms
- Governance: On-chain governance for parameter updates
- Cross-chain: Support for multiple blockchains
- Advanced Analytics: Detailed staking statistics
- Mobile Integration: Native mobile app support
Your security is our priority:
- Audited Contracts: All smart contracts are professionally reviewed
- Open Source: Transparent code for community verification
- Regular Updates: Continuous security improvements
- Best Practices: Following Solana development standards
This project is licensed under the MIT License. See the LICENSE file for details.
Special thanks to:
- The Solana community for building amazing tools
- The Anchor team for the excellent framework
- Our contributors and testers
- All developers who make this ecosystem possible
Ready to build the future of staking? Let's create something amazing! ⚡✨
Built with ❤️ by the Solarmy team