-
Notifications
You must be signed in to change notification settings - Fork 7
Open
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 logic for completing a campaign in the Boundless smart contract. This feature will mark a campaign as completed by changing its status and emitting an event to notify listeners. 🚀
Background
The function to be implemented is defined in contracts/boundless/src/logic/campaign.rs under the CampaignManagement trait. The goal is to update the campaign status to Completed in storage, after performing necessary checks such as verifying the admin's authorization.
Requirements
-
Admin Authorization
- Verify that the provided
adminaddress is authorized to complete the campaign.
- Verify that the provided
-
Campaign Retrieval
- Retrieve the campaign from storage using the provided
campaign_id. - Handle cases where the campaign does not exist or is in an unexpected state.
- Retrieve the campaign from storage using the provided
-
Status Update
- Update the campaign's status to
Completedas defined by theStatusenum indatatypes.rs. - Save the updated campaign back to storage.
- Update the campaign's status to
-
Event Emission
- Emit an event to signal that the campaign has been successfully completed.
-
Error Handling
- Use appropriate error handling by returning a
BoundlessErrorif any of the checks fail or other issues are encountered.
- Use appropriate error handling by returning a
Technical Considerations
- Ensure that the logic respects the integrity of data stored in
Campaignand related data types. - Maintain consistency with the existing contract coding style and error handling as observed in other functions.
- Double-check that the event emission methodology aligns with other events defined in the project for uniformity.
Acceptance Criteria
- The
complete_campaignfunction verifies admin authorization correctly. - The campaign is successfully retrieved and its status updated to
Completed. - The updated campaign is stored in the blockchain storage.
- A campaign completion event is emitted after successfully updating the campaign.
- All error cases (e.g., unauthorized admin, missing campaign) are handled gracefully.
- All new functionality is covered by tests.
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