Soroban contract repository for the NOC IQ system.
This repository is the execution-layer side of the 3-repo architecture:
noc-iq-fe-> frontendnoc-iq-be-> backend and integration layernoc-iq-contracts-> Soroban smart contracts
System flow:
User -> FE -> BE -> Contracts -> BE -> FE
Important rule:
- contracts are not called directly by the frontend
- the backend is responsible for invoking contracts and translating results back to the UI
noc-iq-contracts contains the Soroban-side SLA logic for NOC IQ.
At the current checked-in state, this repository contains one active contract crate:
sla_calculator
This contract is responsible for deterministic SLA calculation and related contract-side state such as configuration, statistics, pause state, and calculation history.
- Rust
- Soroban SDK 21
- Cargo
Main crate manifest:
sla_calculator/Cargo.toml
The active contract is in:
sla_calculator/src/lib.rs
The current implementation includes:
- initialization with admin and operator roles
- severity-based SLA configuration
- admin-controlled config updates
- operator-gated
calculate_sla - read-only
calculate_sla_view - backend-friendly
get_config_snapshot - pause and unpause controls
- cumulative SLA statistics
- history retrieval and pruning
Tests live in:
sla_calculator/src/tests.rs
noc-iq-contracts/
├── docs/
│ ├── CODEX_CONTEXT.md
│ └── PROJECT_CONTEXT.md
├── sla_calculator/
│ ├── Cargo.toml
│ └── src/
│ ├── lib.rs
│ └── tests.rs
├── CONTRIBUTING.md
├── README.md
Only the SLA calculator contract is currently checked in.
That means this repo does not currently contain:
payment_escrowmulti_party_settlement- deployment scripts
- a top-level Cargo workspace
If those are planned, they are future work rather than part of the present repository state.
- Rust toolchain
- Cargo
- optional: Soroban CLI for deployment workflows
Run Tests\n\nbash\ncd sla_calculator\ncargo test\n\n\n### Test Vector Artifacts for Backend Parity\n\nRun cargo test to generate/update canonical SLA test vectors as JSON snapshots:\n\n\nsla_calculator/test_snapshots/tests/*.json\n\n\nKey Vectors:\n- test_backend_parity_threshold_boundary_cases.*.json: SLA met/viol boundaries\n- test_backend_parity_reward_tier_cases.*.json: Reward tiers (top/excel/good)\n- test_stress_1000_calculations_mixed_severities.*.json: Performance aggregates\n- test_config_snapshot_is_deterministic_and_complete.*.json: Full config\n\nBackend Usage:\n1. Consume snapshots for parity tests: Input (severity/mttr) → match contract calculate_sla_view\n2. Use get_config_snapshot() + get_result_schema() for schema validation.\n3. Maintenance: cargo test after SLA changes → snapshots auto-update.\n\nVectors ensure contract/backend parity without manual duplication.\n\n### Build The Contract\n\nbash\ncd sla_calculator\ncargo build\n\n\n### Build WASM\n\nbash\ncd sla_calculator\ncargo build --target wasm32-unknown-unknown --release\n\n\nExpected artifact:\n\n- sla_calculator/target/wasm32-unknown-unknown/release/sla_calculator.wasm\n\n## Deploy-Oriented Workflow
The current repository does not ship deployment scripts, but the existing crate is ready for a manual Soroban deployment flow.
cd sla_calculator
cargo build --target wasm32-unknown-unknown --releaseExample:
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/sla_calculator.wasm \
--source-account <source-account> \
--network <network-name>Save the returned contract ID for later invocation.
The current initialize function accepts:
admin: Addressoperator: Address
Example:
soroban contract invoke \
--id <contract-id> \
--source-account <source-account> \
--network <network-name> \
-- initialize \
--admin <admin-address> \
--operator <operator-address>Useful follow-up calls after deployment:
soroban contract invoke \
--id <contract-id> \
--source-account <source-account> \
--network <network-name> \
-- get_config \
--severity criticalsoroban contract invoke \
--id <contract-id> \
--source-account <source-account> \
--network <network-name> \
-- get_statsFor this repository, the main artifact contributors and operators should expect is:
- release WASM for deployment:
sla_calculator/target/wasm32-unknown-unknown/release/sla_calculator.wasm
Optional local outputs include:
- debug build artifacts under
sla_calculator/target/debug - test binaries under
sla_calculator/target/debug/deps
As of the latest stabilization pass:
cargo testpasses- the crate compiles cleanly
- the checked-in test suite is wired into the crate and runs
The current test suite covers:
- role and authorization behavior
- SLA reward and penalty logic
- pause and unpause behavior
- statistics
- audit-mode calculation parity
- history recording and pruning
The backend repo is expected to invoke this contract and translate contract results into backend API responses.
That dependency matters because:
- SLA logic must stay aligned with backend expectations
- result encoding must remain deterministic
- API consumers in
noc-iq-feonly see whatnoc-iq-bereturns - config reads should prefer explicit snapshot-style contract views where stable ordering matters
This repository is now stable at the crate level, but the overall contract layer is still narrow.
Examples:
- only one contract crate exists right now
- deployment automation is not checked in
- there is not yet a broader contract workspace with escrow or settlement modules
- cross-repo contract invocation is still a backend integration concern, not something managed here directly
noc-iq-fe-> frontend applicationnoc-iq-be-> backend and contract bridge