Thank you for your interest in contributing to Scavenger — a Rust/Soroban smart contract system with a React/TypeScript frontend built on the Stellar blockchain. This document is the single authoritative reference for code style, the PR workflow, testing expectations, commit conventions, community standards, and environment setup.
- Getting Started / Setup
- Pre-commit Hooks
- Code Style Guidelines
- Pull Request Process
- Testing Requirements
- Commit Message Conventions
- Code of Conduct
- Rust toolchain — stable channel. Install via rustup:
rustup toolchain install stable rustup default stable
No pinned version is currently specified in
rust-toolchain.toml; the stable channel is the expected toolchain. - Soroban CLI — install the latest release:
cargo install --locked soroban-cli
- Node.js — LTS version recommended. Download from nodejs.org or use a version manager such as
nvm. - pnpm — enable via Corepack, which ships with Node.js:
corepack enable
pnpm-only policy: This repository uses pnpm exclusively. Install and run Node.js dependencies and scripts from the repository root. Do not use
npm installornpm ci, and do not commitpackage-lock.jsonfiles.
# 1. Fork the repository on GitHub, then clone your fork
git clone https://github.com/<your-username>/Scavenger.git
cd Scavenger
# 2. Install Smart Contract dependencies
cargo build
# 3. Install Node.js dependencies (all workspaces)
pnpm installThis repository uses pre-commit to enforce formatting and linting automatically before every commit. The hooks cover the languages used in the project: Rust and TypeScript/JavaScript.
# 1. Install pre-commit itself
pip install pre-commit
# 2. Install the hooks into your local clone
pre-commit installrustfmt must be available for the cargo-fmt hook:
rustup component add rustfmtprettier and eslint are resolved via pnpm exec — ensure you have run pnpm install first.
gitleaks must be installed separately (see gitleaks releases).
| Hook | Languages | What it does |
|---|---|---|
cargo-fmt |
Rust (.rs) |
Runs cargo fmt --all and blocks commits that aren't formatted |
prettier |
TS, JS, JSON, CSS, MD | Reformats files to the project's Prettier config |
eslint |
TS, JS | Runs ESLint with --fix; blocks commits with unfixable lint errors |
gitleaks |
All tracked files | Scans staged changes for secrets using .gitleaks.toml config |
terraform_fmt / terraform_validate |
Terraform | Formats and validates Terraform configs |
trailing-whitespace / end-of-file-fixer |
All | Generic file hygiene |
# Run all hooks against all files
pre-commit run --all-files
# Run a specific hook
pre-commit run cargo-fmt --all-files
pre-commit run prettier --all-filesConsistent style keeps the codebase readable and review cycles short. Run all formatters and linters before pushing.
- Formatting — run
cargo fmtbefore every commit:cargo fmt
- Linting — run
cargo clippyand resolve all warnings before submitting:PRs with outstanding Clippy warnings will not be merged.cargo clippy -- -D warnings
- Naming conventions — use
snake_casefor functions, variables, structs, and module names. - Function length — keep functions focused on a single responsibility. Avoid functions exceeding 50 lines where practical; extract helpers when a function grows beyond that threshold.
- Formatting —
prettiermust pass with no diff:pnpm exec prettier --check .
- Linting —
eslintmust pass with no errors or warnings:pnpm exec eslint .
- Naming conventions — use
PascalCasefor React components and TypeScript types/interfaces; usecamelCasefor variables and functions. These conventions are enforced by CI lint checks and regression tests (see__tests__/cleanup/). - Script naming — use
kebab-casefor all shell script filenames (e.g.build-wasm.sh, notbuild_wasm.sh). Enforced by__tests__/cleanup/scripts.test.ts. - Function design — keep functions focused on a single responsibility. Avoid large multi-purpose functions; prefer small, composable units.
Fork the repository on GitHub and create a dedicated branch for your change before opening a PR. Never commit directly to main.
git checkout -b feature/my-new-featureUse one of the following prefixes followed by a short kebab-case description:
| Prefix | When to use |
|---|---|
feature/<short-description> |
New functionality |
fix/<short-description> |
Bug fixes |
docs/<short-description> |
Documentation-only changes |
Examples: feature/add-token-transfer, fix/null-pointer-crash, docs/update-setup-guide
Every PR must include a description that covers:
- What changed — a clear summary of the modifications made.
- Why it changed — the motivation or problem being solved.
- Related issues — reference any relevant GitHub issue numbers (e.g.,
Closes #42).
The repository provides a PR template (.github/PULL_REQUEST_TEMPLATE.md) that
pre-fills this structure when you open a PR on GitHub. Fill in every section;
do not delete sections you leave blank — use the checkboxes to show what applies.
Ensure your PR targets the correct base branch (typically main). Check the repository's branch strategy before opening your PR and update the base if needed.
- At least one maintainer approval is required before a PR can be merged.
- All CI checks must pass — do not merge a PR with failing checks.
- The PR Title Convention Check CI job (
pr-title-check.yml) validates that the PR title follows the Conventional Commits format. The title is used as the squash-merge commit message, so it must pass before the PR can be merged.
Address one concern per PR. Large, multi-purpose PRs are harder to review and more likely to introduce regressions. If your change spans multiple concerns, split it into separate PRs.
- All Smart Contract changes must include or update unit tests using the Soroban test framework.
- Run the full Smart Contract test suite with:
cargo test
- All Frontend changes must include or update unit tests.
- Run the frontend test suite with:
pnpm test
- PRs must not reduce overall test coverage for the modified modules.
- If a PR introduces a new public function or component, at least one test covering the primary behavior must be included.
This project follows the Conventional Commits v1.0.0 specification.
A .gitmessage file at the repository root pre-fills the subject and footer
format. Configure it once in your local clone:
git config commit.template .gitmessageAfter that, running git commit (without -m) will open your editor with the
template, prompting for type, scope, summary, body, and issue reference.
<type>(<scope>): <short summary>
<body>
Closes #<issue-number>
| Type | When to use |
|---|---|
feat |
A new feature |
fix |
A bug fix |
docs |
Documentation changes only |
chore |
Build process, tooling, or dependency updates |
refactor |
Code restructuring without behavior change |
test |
Adding or updating tests |
style |
Formatting, whitespace, or style-only changes |
| Scope | Area of the codebase |
|---|---|
contract |
Rust / Soroban smart contract code |
frontend |
React / TypeScript frontend |
scripts |
Build scripts, CI configuration, tooling |
docs |
Documentation files |
- Written in the imperative mood (e.g., "add feature", not "added feature" or "adds feature").
- Lowercase — do not capitalize the first letter.
- 72 characters or fewer — keep it concise.
- Separate the body from the subject line with a blank line.
- Use the body to explain the motivation for the change and any context a reviewer needs.
If a commit or PR closes a GitHub issue, include the following in the commit body or PR description:
Closes #<issue-number>
feat(contract): add token transfer function
Implements the transfer entrypoint as specified in the token interface.
Validates sender balance before executing the transfer.
Closes #17
fix(frontend): resolve null pointer on wallet disconnect
The wallet context was not guarded against undefined on disconnect,
causing a crash in the header component.
Closes #23
This project is committed to providing a welcoming and inclusive environment for everyone. We welcome contributors regardless of experience level, background, or identity.
We follow the Contributor Covenant as our Code of Conduct. All contributors and maintainers are expected to uphold these standards in all project spaces — including GitHub issues, pull requests, discussions, and any other communication channels.
If you experience or witness behavior that violates the Code of Conduct, please report it by emailing:
Replace this placeholder with the actual contact email before publishing.
All reports will be reviewed promptly and handled with discretion.
Violations of the Code of Conduct may result in temporary or permanent exclusion from the project, at the discretion of the maintainers.
- Be respectful and considerate in all interactions.
- Welcome newcomers and those with different levels of experience.
- Accept constructive feedback gracefully.
- Focus on what is best for the community and the project.
For the full text of the Contributor Covenant, visit https://www.contributor-covenant.org/version/2/1/code_of_conduct/.