-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Overview
Develop a standalone AccessControl smart contract in budgetchain-app/onchain directory in Cairo to manage roles and permissions across the budget allocation system. This contract will provide secure role-based access control for admins, organizations, and project owners.
Objectives
- Define role constants such as
DEFAULT_ADMIN_ROLE,ADMIN_ROLE, andORGANIZATION_ROLE. - Set up storage for role assignments using an appropriate structure (e.g., a mapping of addresses to booleans).
- Implement core functions:
grant_role: Assign a role to an account.revoke_role: Remove a role from an account.has_role: Check if an account possesses a given role.
- Add internal checks to ensure that only authorized accounts can grant or revoke roles.
- Support role hierarchy as needed.
- Emit events for role changes (e.g.,
RoleGranted,RoleRevoked,AdminAdded). - Integrate the contract with other contracts for permission verifications.
- Write comprehensive unit tests covering role management, access restrictions, and event emissions.
- Provide usage examples and document the contract interface for clarity.
Technical Considerations
- Ensure proper event handling by emitting events whenever roles are granted or revoked.
- Maintain clear and secure internal access control checks to restrict functions to authorized accounts.
- Include detailed documentation and usage examples to facilitate integration with other contracts.
Tasks
- Define role constants and the storage structure for role assignments.
- Implement the functions:
grant_role,revoke_role, andhas_role. - Add internal checks for role-restricted functions to ensure only authorized accounts can make changes.
- Emit role-related events for each role change operation.
- Document the contract interface and provide usage examples.
Additional Resources
- For guidance on coding conventions or integration details, refer to the project's README.
Let's ensure secure and transparent role management for the budget allocation system! 🚀
Reactions are currently unavailable