Overview
This issue is to implement the core logic for campaign creation in our smart contract. The function create_campaign in contracts/boundless/src/logic/campaign.rs currently has a placeholder and needs a complete implementation according to the provided requirements.
Background
Our platform, as described in the README, relies on a robust and secure implementation of smart contracts to manage key functionalities, including campaign management. The Campaign struct in contracts/boundless/src/datatypes.rs and the CampaignManagement trait in contracts/boundless/src/interface.rs have already been defined. The logic needs to:
- Generate a unique campaign ID
- Create a new
Campaign struct with a status of Status::Active
- Store the campaign in persistent storage
- Return the campaign ID
Requirements
Technical Considerations
- Ensure error handling aligns with the project standards. If any step fails, return a proper
BoundlessError.
- Verify the uniqueness of campaign IDs to avoid conflicts.
- Maintain code readability and adhere to the coding style outlined in the repository.
Acceptance Criteria
- [ ] - All new functionality is covered by tests.
Overview
This issue is to implement the core logic for campaign creation in our smart contract. The function
create_campaignincontracts/boundless/src/logic/campaign.rscurrently has a placeholder and needs a complete implementation according to the provided requirements.Background
Our platform, as described in the README, relies on a robust and secure implementation of smart contracts to manage key functionalities, including campaign management. The
Campaignstruct incontracts/boundless/src/datatypes.rsand theCampaignManagementtrait incontracts/boundless/src/interface.rshave already been defined. The logic needs to:Campaignstruct with a status ofStatus::ActiveRequirements
Location: Implementation should be done in
contracts/boundless/src/logic/campaign.rswithin thecreate_campaignfunction.Steps to Implement:
owner.require_auth().Campaignstruct with the following fields:id: the newly generated unique IDowner: provided owner addresstitle: provided titledescription: provided descriptionfunding_goal: provided funding goal (goal)escrow_contract_id: provided escrow contract IDmilestones: provided milestonesbackers: should be empty upon creationstatus: set toStatus::ActiveTechnical Considerations
BoundlessError.Acceptance Criteria
create_campaignfunction generates a unique campaign ID.Active.- [ ] - All new functionality is covered by tests.