📚 Overview
Implement the fund release logic for campaigns as part of the milestone-based funding system. This feature will allow the platform to release funds when a milestone is met, updating the milestone status and emitting a release event.
🛠️ Task Requirements
- File to update:
contracts/boundless/src/logic/campaign.rs
- Interface: Update the
release_funds function defined in the CampaignManagement trait located in contracts/boundless/src/interface.rs.
Steps to Implement:
-
Retrieve Campaign & Milestone Information:
- Get the campaign using the provided
campaign_id.
- Retrieve the milestone details using
milestone_id.
-
**Validate Milestone Eligibility:
- Check that the milestone is in a state that allows release (e.g., status is
Approved).
-
**Update Milestone Status:
- Change the milestone status to
Released.
-
**Emit a Release Event:
- Trigger an event that logs the release of funds with relevant details.
-
**Error Handling:
- Return a detailed error if any validation fails or if any step in the process encounters an issue.
⚙️ Technical Considerations
- Follow the structure and error handling patterns in the existing contract code.
- Use the enums and datatypes defined in
contracts/boundless/src/datatypes.rs for consistency.
- Ensure the implementation is compliant with the smart contract's logic for security and transparency.
🎯 Acceptance Criteria
- The
release_funds function correctly retrieves and validates the campaign and milestone.
- Milestone status updates to
Released once conditions are met.
- A release event is emitted successfully.
- Adequate error handling throughout the process.
- All new functionality is covered by tests.
📚 Overview
Implement the fund release logic for campaigns as part of the milestone-based funding system. This feature will allow the platform to release funds when a milestone is met, updating the milestone status and emitting a release event.
🛠️ Task Requirements
contracts/boundless/src/logic/campaign.rsrelease_fundsfunction defined in theCampaignManagementtrait located incontracts/boundless/src/interface.rs.Steps to Implement:
Retrieve Campaign & Milestone Information:
campaign_id.milestone_id.**Validate Milestone Eligibility:
Approved).**Update Milestone Status:
Released.**Emit a Release Event:
**Error Handling:
⚙️ Technical Considerations
contracts/boundless/src/datatypes.rsfor consistency.🎯 Acceptance Criteria
release_fundsfunction correctly retrieves and validates the campaign and milestone.Releasedonce conditions are met.- All new functionality is covered by tests.