Skip to content

[CONTRACT] Implement Branch Contract #248

@truthixify

Description

@truthixify

Description:
Create a Soroban contract (branch.rs) to manage branches and their associated assets.

Tasks:

  • Create src/branch.rs with:
    • DataKey enum (e.g., Branch(BytesN<32>), AssetList(BytesN<32>)).
    • Branch struct: id, name, location, admin.
    • Functions:
      • create_branch(id, name, location, admin): Registers a new branch.
      • add_asset_to_branch(branch_id, asset_id): Links an asset to a branch.
      • get_branch_assets(branch_id): Retrieves asset IDs for a branch.
  • Use errors.rs for errors (e.g., BranchAlreadyExists).
  • Enforce admin-only access for branch creation.
  • Write tests for branch creation and asset linking.
  • Update lib.rs to include branch.rs.

Acceptance Criteria:

  • Branches can be created and stored on the Stellar ledger.
  • Assets can be linked to branches and retrieved.
  • Only the admin can create branches.
  • Tests pass for all functions.
  • Module compiles and integrates with errors.rs.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions