diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2032ec8..8e0b71b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,3 +180,59 @@ jobs: with: name: contract-abi-${{ github.sha }} path: .abi/ + + docs: + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + steps: + - uses: actions/checkout@v5 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + + - name: Generate Documentation + run: | + cargo doc --no-deps --all + # Create redirect index.html + cat << 'EOF' > target/doc/index.html + + +
+ +Redirecting to Project Registry documentation...
+You can also view the Investment Vault documentation.
+ + + EOF + + - name: Upload Documentation Artifact + uses: actions/upload-artifact@v4 + with: + name: contracts-documentation-${{ github.sha }} + path: target/doc/ + retention-days: 14 + + - name: Setup Pages + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + uses: actions/configure-pages@v5 + + - name: Upload Pages Artifact + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + uses: actions/upload-pages-artifact@v3 + with: + path: target/doc + + - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + id: deployment + uses: actions/deploy-pages@v4 + diff --git a/README.md b/README.md index ac88ea4..e792c21 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,11 @@ When impact scores change (via `update_impact_score` or `update_credit_quality_s For details, see [`docs/NOTIFICATIONS.md`](./docs/NOTIFICATIONS.md). +### API & Rust Crate Documentation + +Rust docs are automatically generated and published via CI: +* Deployed reference: [https://BuildersWCT.github.io/contracts/](https://BuildersWCT.github.io/contracts/) + ### ProjectRegistry **Constructor** diff --git a/project_registry/src/lib.rs b/project_registry/src/lib.rs index 330d3fa..241b74d 100644 --- a/project_registry/src/lib.rs +++ b/project_registry/src/lib.rs @@ -24,7 +24,10 @@ mod types; mod storage; mod logic; -pub use types::{ArchiveSummary, CertificationStatus, DataKey, ProjectData, Proposal, RegistryError}; +pub use types::{ArchiveSummary, CertificationStatus, DataKey, ProjectData, Proposal, RegistryError, ScoreHistoryEntry}; + +/// Maximum entries in the score history ring buffer (#123). +const MAX_SCORE_HISTORY: u32 = 50; /// Minimum voting period in seconds (~1 day at 5s/ledger, ≈ 17280 ledgers) (#134). const MIN_VOTING_PERIOD: u64 = 86_400; diff --git a/project_registry/src/types.rs b/project_registry/src/types.rs index 793555f..f0f76a0 100644 --- a/project_registry/src/types.rs +++ b/project_registry/src/types.rs @@ -84,6 +84,8 @@ pub enum RegistryError { UpdateTooFrequent = 33, /// Project must be archived before it can be compacted. ProjectNotArchived = 34, + /// Contract operations are paused. + Paused = 35, } /// Certification state for a green project (#130).