CommitLabs contracts implement commitment lifecycle management, NFT representation, attestation tracking, and allocation strategies on Stellar Soroban. The workspace includes four contracts plus a shared utility library that standardizes validation, access control, arithmetic safety, and rate limiting.
| Component | Responsibility | Storage pattern |
|---|---|---|
| commitment_core | Create commitments, transfer assets, mint NFTs, settle and early exit, track TVL | Instance storage for commitments, owner lists, admin, counters, and reentrancy guard |
| commitment_nft | Store NFT metadata, ownership, and active status | Persistent storage for NFTs/ownership, instance storage for admin and counters |
| attestation_engine | Record attestations, track health metrics, and analytics | Persistent storage for attestations and metrics, instance storage for admin and analytics |
| allocation_logic | Register pools, allocate and rebalance amounts | Persistent storage for pools/allocations, instance storage for admin and registry |
| shared_utils | Cross-cutting helpers (validation, access control, rate limiting, math) | Library only |
commitment_core::create_commitmentvalidates inputs, stores a commitment, transfers assets to the contract, and callscommitment_nft::mint.commitment_nft::mintpersists metadata and ownership data for the NFT.commitment_core::settleupdates core state, returns assets, and callscommitment_nft::settle.commitment_core::early_exitupdates core state, applies the penalty, returns the remaining assets, and callscommitment_nft::mark_inactive.
attestation_engine::attestvalidates caller authorization and commitment existence.- It stores attestation data and updates health metrics for the commitment.
attestation_engine::get_health_metricsreads commitment data fromcommitment_coreand combines it with attestations.
allocation_logic::allocateselects pools based on strategy and stores allocation records.allocation_logic::rebalancerecomputes allocations for an existing commitment id.- Allocation logic currently does not validate commitment ownership against
commitment_core(see Known Limitations).
commitment_corestores commitments and owner lists in instance storage.commitment_nftstores token data and ownership in persistent storage.attestation_enginestores attestations and health metrics in persistent storage, with analytics counters in instance storage.allocation_logicstores pool registry in instance storage and pools/allocations in persistent storage.
flowchart LR
User[Commitment owner] -->|create_commitment| Core[commitment_core]
Core -->|token transfer| Token[Token contract]
Core -->|mint/settle| NFT[commitment_nft]
Attestation[attestation_engine] -->|get_commitment| Core
Allocation[allocation_logic] -->|commitment_id| Core
Core --> Shared[shared_utils]
NFT --> Shared
Attestation --> Shared
Allocation --> Shared
- Deployment order: commitment_nft -> commitment_core -> attestation_engine.
- allocation_logic is deployed independently.
- Contract IDs are stored in
deployments/*.jsonand referenced by downstream systems.
- End-to-end threat review for
commitment_core <-> commitment_nft <-> attestation_engine:docs/CORE_NFT_ATTESTATION_THREAT_REVIEW.md