Thank you for your interest in contributing to AjoChain! This guide will help you get started.
- Rust (latest stable via rustup)
- WASM target:
rustup target add wasm32-unknown-unknown - Stellar CLI (optional):
cargo install --locked stellar-cli
# Clone the repository
git clone https://github.com/BigJohn-dev/AjoChain.git
cd AjoChain
# Build all contracts
make build
# Run all tests
make testgit checkout -b feature/your-feature-name- Follow the existing code style and module patterns
- Add unit tests for any new functionality
- Update relevant documentation in
docs/
# Run all checks
make check
# Run tests
make test
# Format code
make fmtgit commit -m "feat: add amazing feature"
git push origin feature/your-feature-nameThen open a Pull Request against the develop branch.
- Use
#![no_std]on all contract crates - Use
panic_with_error!instead ofpanic! - All arithmetic must use checked operations (
checked_add, etc.) - All public functions must call
ttl::extend_instance_ttl(&env) - All persistent storage writes must be followed by
ttl::extend_persistent_ttl - Error codes must be unique within their range (see
docs/architecture.md)
Follow Conventional Commits:
feat:— New featuresfix:— Bug fixesdocs:— Documentation changestest:— Test additions/changesrefactor:— Code refactoringchore:— Maintenance tasks
- Every public contract function must have at least one test
- Tests should cover both success and failure paths
- Use
env.mock_all_auths()for test environments - Test helper functions should be in the same test module
- Never use unbounded loops — always use
max_membersor pagination limits - Always validate inputs against protocol constants from
ajo_types::constants - All state-mutating functions must call
require_auth() - Storage keys must use the correct storage type (Instance/Persistent/Temporary)
Each contract follows this module pattern:
contracts/<name>/src/
├── lib.rs # Contract entry-point with #[contractimpl]
├── storage.rs # Data types and storage keys
├── errors.rs # Error enum with unique u32 codes
├── events.rs # Event emission helpers
├── test.rs # Unit tests
└── <modules>.rs # Additional business logic modules
Open an issue or reach out to the maintainers. We're happy to help!