Thank you for your interest in contributing to PetChain! This guide will help you get started.
- Rust (latest stable)
- Stellar CLI:
cargo install --locked stellar-cli --features opt
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/PetChain-Contracts.git - Navigate to project:
cd PetChain-Contracts - Build contracts:
cd stellar-contracts && cargo build --target wasm32-unknown-unknown --release - Run tests:
cargo test
- Use
cargo fmtbefore committing - Follow Rust naming conventions (snake_case for functions, PascalCase for types)
- Add documentation comments for public functions
- Keep functions focused and small
- Use meaningful variable names
- Always require authentication for state-changing functions
- Use proper error handling with
panic!for invalid states - Emit events for important state changes
- Validate inputs at function entry
- Use storage efficiently
- Pick an Issue: Comment on an issue to express interest
- Create Branch:
git checkout -b feature/issue-number-description - Implement: Follow the issue requirements and acceptance criteria
- Test: Ensure all tests pass and add new tests for your code
- Document: Update documentation if needed
- Submit PR: Reference the issue number in your PR description
- All tests must pass
- Code coverage should not decrease
- Include tests for new functionality
- Update documentation if needed
- Follow the code style guidelines
cd stellar-contracts
cargo test- Unit tests for all public functions
- Test both success and failure cases
- Use descriptive test names
- Aim for >90% code coverage
#[test]
fn test_function_name_success_case() {
// Setup
let env = Env::default();
// ... test implementation
// Assert
assert_eq!(result, expected);
}Look for issues labeled good-first-issue:
- Issue #5: Emergency Contact System
- Issue #9: Multi-Pet Owner Support
- Issue #10: Event Emission System
- Read the issue description and requirements carefully
- Ask questions in the issue comments if anything is unclear
- Check if someone else is already working on it
- Correct implementation of requirements
- Proper error handling
- Adequate test coverage
- Clear, readable code
- Security considerations
- Gas efficiency
- Automated checks (CI/CD)
- Code review by maintainers
- Testing on testnet
- Approval and merge
- Join our Telegram community
- Ask questions in issue comments
- Check existing documentation and issues
- Be respectful and inclusive
- Help others learn and grow
- Focus on constructive feedback
- Follow GitHub's community guidelines
Thank you for contributing to PetChain!