Skip to content

Implement Treasury Allocation Contract #158

@CMI-James

Description

@CMI-James

Objective

Implement Treasury Allocation Contract

Where to Implement

  • Primary contract: contracts/treasury-allocation/src/lib.rs
  • Cargo manifest: contracts/treasury-allocation/Cargo.toml
  • Contract docs: contracts/treasury-allocation/README.md
  • Shared types/helpers (if needed): contracts/shared/src/lib.rs
  • Tests: contracts/treasury-allocation/src/lib.rs (#[cfg(test)]) or contracts/treasury-allocation/tests/

Responsibilities

  • Implement deterministic Soroban contract logic for the specified domain.
  • Define storage model, events, and method-level authorization guards.
  • Enforce safe state transitions and invariant checks.
  • Keep interfaces composable with existing contracts and backend services.

Required Public Interface / Deliverables

  • init(admin, treasury_contract)\n- create_budget(bucket_id, limit, period)\n- request_allocation(bucket_id, amount, reason)\n- approve_allocation(request_id)\n- budget_state(bucket_id)

Security and Validation

  • Enforce role-based auth on privileged methods.
  • Validate all input bounds and identifier uniqueness constraints.
  • Prevent replay/duplicate processing where applicable.
  • Use safe arithmetic and explicit error handling.

Testing Requirements

  • Unit tests for happy-path behavior.
  • Failure-path tests for unauthorized calls and invalid states.
  • Event emission validation for key transitions.
  • Integration tests for dependent contract interactions when applicable.

Acceptance Criteria

  • Contract compiles and tests pass with cargo test.
  • README documents methods, events, storage, and invariants.
  • Integration assumptions and dependency contracts are documented.

Flow / Dependencies

Depends on treasury contract and governance/access controls for approvals.

Metadata

Metadata

Assignees

Labels

ContractSmart contract workHighHigh complexitySorobanSoroban-specific workStellar WaveStellar Wave initiative

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions