You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR: docs — rustdoc on checkpoint public entrypoints (Closes #667)
Overview
Introduces the Callora Checkpoint contract — a new Soroban smart contract that records immutable, append-only balance snapshots for audit and compliance purposes. Every public entrypoint carries comprehensive ///-style rustdoc following the project's NatSpec conventions.
Closes: #667 ("Add rustdoc on checkpoint public entrypoints (buffer #22)")
Contract Summary
The Checkpoint contract enables the Callora admin to create cryptographically-verifiable balance snapshots at any point in time. Each checkpoint is:
Immutable — once written, never updated
Append-only — new checkpoints receive sequential IDs starting at 1
Persistent — stored with 6-month TTL (auto-extended on write)
Evented — every operation emits a typed event for off-chain indexing
Auditable — any address can query historical checkpoints by ID or paginated range
Records immutable balance snapshots for audit trails
An operator periodically calls create_checkpoint (or batch_create_checkpoints) to snapshot developer balances from the Settlement contract. These records form an immutable audit trail suitable for compliance reporting, financial reconciliation, and dispute resolution.
Files Changed
New Files (5 files, ~1,400 LOC)
File
Lines
Purpose
contracts/checkpoint/Cargo.toml
15
Package manifest — soroban-sdk 22, cdylib + rlib
contracts/checkpoint/src/lib.rs
651
Contract logic with 14 pub fns, all fully documented
The contract includes a rustdoc_tests module that parses lib.rs source at compile time and asserts that every pub fn is preceded by a /// doc comment. This test must pass for CI to succeed — it prevents undocumented functions from being merged.
Conventions & Consistency
The checkpoint contract follows the exact conventions established by the existing contracts (vault, settlement, revenue pool):
✅ #![no_std] with #[cfg(test)] extern crate std
✅ #[contracterror] enum with #[repr(u32)] stable codes
✅ Event symbols in a dedicated events.rs module with snapshot tests
// Admin snapshots developer balances at month-end closelet items = vec![(developer_a, usdc_token, a_balance,Symbol::new(&env,"monthly_close")),(developer_b, usdc_token, b_balance,Symbol::new(&env,"monthly_close")),// ... up to 50 per batch];let ids = checkpoint_client.batch_create_checkpoints(&admin,&items);// ids contains sequential checkpoint IDs for each snapshot
Query Example: Reconstructing Historical Balances
// Get the first page of checkpointslet page = checkpoint_client.get_checkpoints_range(&1u64,&50u32);// Get total count for paginationlet total = checkpoint_client.get_checkpoint_count();// Point-lookup a specific checkpointlet record = checkpoint_client.get_checkpoint(&42);
Checklist
///-style rustdoc on all 14 pub fns (verified by self-test)
require_auth on all 7 state-changing entrypoints
Overflow-safe checked_add arithmetic throughout
No raw .unwrap() in production paths
Typed #[contracterror] enum with 9 stable numeric codes