-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
Description
📚 Overview
Develop a standalone FundRequest smart contract in budgetchain-app/onchain directory in Cairo to manage fund requests tied to project milestones. The contract will support request creation, approval, rejection, status tracking, and update project budgets accordingly. It is crucial that only completed milestones can have fund requests and that proper validations and access controls are in place.
🛠️ Requirements & Tasks
-
Data Structures & Storage
- Define a
FundRequeststruct with the following fields:project_id: u64milestone_id: u64amount: u128requester: ContractAddressstatus: FundRequestStatus(enum with valuesPending,Approved,Rejected)
- Define events:
FundsRequestedwith fieldsproject_id,request_id,milestone_idFundsReleasedwith fieldsproject_id,request_id,milestone_id,amountFundsReturnedwith fieldsproject_id,amount,project_owner
- Set up storage for fund requests and counters.
- Define a
-
Function Implementation
create_fund_request: Allow project owners to create a fund request only for completedd milestones.approve_fund_request: Allow authorized organizations/admins to approve a fund request and release funds.reject_fund_request: Allow authorized organizations/admins to reject a fund request.- Ensure that upon fund approval, the project budgets are updated accordingly.
-
Validation & Access Control
- Verify that only completed milestones can have fund requests.
- Implement proper validations for request statuses and access control for request lifecycle functions.
-
Event Emission
- Emit
FundsRequestedwhen a fund request is created. - Emit
FundsReleasedwhen funds are successfully released. - Emit
FundsReturnedif funds need to be returned.
- Emit
❗ Technical Considerations
- Ensure the functions are secure and only callable by authorized roles.
- The implementation should handle edge cases such as invalid amounts or unauthorized accesses.
- Follow best practices regarding state management and event handling in smart contracts.
Let's ensure this contract adds robust and secure fund request handling to the project!
Reactions are currently unavailable