-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
contractgood first issueGood for newcomersGood for newcomersonlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week
Description
Overview
Implement the cancel_campaign function in the CampaignManagement trait for the BoundlessContract. This new functionality will handle the cancellation of a campaign by updating its status and ensuring proper event emission.
Background
The cancel_campaign method is defined in the CampaignManagement trait in contracts/boundless/src/interface.rs. The campaign information is structured according to the definitions in contracts/boundless/src/datatypes.rs, where each campaign has a status that needs to be updated upon cancellation. The cancellation should reflect as a Failed status and emit an appropriate event to notify the system.
Requirements
-
Admin Authorization:
- Verify that the provided admin address is authorized to cancel the campaign.
-
Campaign Retrieval:
- Retrieve the campaign using the given
campaign_idfrom storage.
- Retrieve the campaign using the given
-
Status Update:
- Update the campaign's status to
Failed.
- Update the campaign's status to
-
Storage Update:
- Save the updated campaign back to storage.
-
Event Emission:
- Emit a cancellation event after successfully updating the campaign status.
-
Error Handling:
- Ensure proper error handling for scenarios such as unauthorized admin or non-existent campaign.
Technical Considerations
- Use the provided
Statusenum for setting the campaign status toFailed. - Follow existing patterns in the Boundless codebase for error handling, as defined by
BoundlessError. - Be mindful of security checks, especially when validating admin privileges.
Acceptance Criteria
- The
cancel_campaignfunction is fully implemented as outlined. - The campaign status reliably updates to
Failedwhen cancelled. - A cancellation event is emitted after the campaign is cancelled.
- All new functionality is covered by tests.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
contractgood first issueGood for newcomersGood for newcomersonlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week