Skip to content

Conversation

@JayWebtech
Copy link
Contributor

Add Organization Removal Functionality

Description

This PR adds the ability to remove organizations from the BudgetChain contract. The implementation includes a new function remove_organization that allows admins to deactivate organizations by setting their is_active status to false.

Changes

  • Added remove_organization function to the Budget contract
  • Implemented proper storage handling for organization state updates
  • Added comprehensive test coverage for the new functionality

Key Features

  • Only admin can remove organizations
  • Organizations are deactivated rather than deleted (soft delete pattern)
  • Event emission for organization removal
  • Proper storage state management

Testing

Added three test cases to verify the functionality:

  1. test_remove_organization_success: Verifies successful organization removal by admin
  2. test_remove_organization_not_admin: Ensures only admin can remove organizations
  3. test_remove_organization_event_emission: Validates correct event emission

Technical Details

  • Fixed mutable storage handling in remove_organization function
  • Implemented proper storage read/write pattern for organization state updates
  • Added event emission for tracking organization removals

Security Considerations

  • Admin-only access control
  • Soft delete pattern to maintain historical data
  • Event emission for audit trail

Related Issues

Closes #52

Checklist

  • Code follows the project's coding standards
  • Tests are added and passing
  • No breaking changes to existing functionality

@anonfedora
Copy link
Contributor

Some conflicts please, @JayWebtech

@JayWebtech
Copy link
Contributor Author

@anonfedora conflicts resolved

@anonfedora
Copy link
Contributor

Thank you for your contribution ser

@anonfedora anonfedora merged commit 323903b into BudgetChain:main Apr 30, 2025
1 check 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.

[SC]: Implement remove_organization Function & Tests in Budget Contract

2 participants