Skip to content

Conversation

@Yunusabdul38
Copy link
Contributor

@Yunusabdul38 Yunusabdul38 commented May 31, 2025

Implement Organization Smart Contract for Budget Allocation System

Summary

Implements a standalone Organization smart contract in Cairo to manage organizations participating in the budget allocation system. This contract provides comprehensive organization lifecycle management with role-based access controls.

Related Issue

Closes #97

Changes Made

Core Contract Implementation

  • Organization Struct: Defined with required fields (id, address, name, mission, is_active, created_at)
  • Storage Management: Implemented efficient storage mappings and organization counter
  • Access Control Integration: Integrated role-based permissions restricting admin-only functions

Key Functions Implemented

  • create_organization(): Admin-only organization creation with duplicate validation
  • update_organization(): Modify existing organization details
  • remove_organization(): Admin-only organization deactivation

Event System

  • OrganizationAdded: Emitted on successful organization creation (id, address, name)
  • OrganizationRemoved: Emitted on organization deactivation (org_id)

Security & Validation

  • Duplicate organization prevention
  • Comprehensive input validation
  • Proper error handling with descriptive revert messages
  • Role-based access control enforcement

Technical Details

  • Built in Cairo for Starknet compatibility
  • Designed for future extensibility
  • Follows smart contract best practices
  • Comprehensive error handling and edge case coverage

Testing

  • Unit tests for all core functions
  • Access control validation tests
  • Event emission verification
  • Edge case and error condition testing
  • Integration tests with existing system components

Breaking Changes

None - this is a new contract implementation.

Checklist

  • Code follows project style guidelines
  • All tests pass
  • Documentation is complete and accurate
  • Security considerations have been addressed
  • Contract is ready for deployment

Notes for Reviewers

Please pay special attention to:

  • Access control implementation and role restrictions
  • Event emission correctness
  • Storage efficiency and gas optimization
  • Input validation comprehensiveness

@vercel
Copy link

vercel bot commented May 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
budget-chain ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 31, 2025 11:41am

@Yunusabdul38 Yunusabdul38 changed the title feat: implement organization management in Budget contract with acces… feat: implement organization management in Budget contract May 31, 2025
@anonfedora anonfedora merged commit 95c2897 into BudgetChain:main Jun 3, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Organization Management Contract

2 participants