Skip to content

Implement Release Funds Logic for Campaign Milestones #10

@0xdevcollins

Description

@0xdevcollins

📚 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:

  1. Retrieve Campaign & Milestone Information:

    • Get the campaign using the provided campaign_id.
    • Retrieve the milestone details using milestone_id.
  2. **Validate Milestone Eligibility:

    • Check that the milestone is in a state that allows release (e.g., status is Approved).
  3. **Update Milestone Status:

    • Change the milestone status to Released.
  4. **Emit a Release Event:

    • Trigger an event that logs the release of funds with relevant details.
  5. **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.

Metadata

Metadata

Assignees

Labels

contractgood first issueGood for newcomersonlydust-waveContribute to awesome OSS repos during OnlyDust's open source week

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions