Description
Develop a smart contract using the Anchor framework to manage proposals on the Solana blockchain. The contract should include functionality to create, update, and delete proposals, as well as implement a voting system for the proposals.
Requirements
-
Create Proposal
- Accept input:
title, description, start_date, end_date, and creator (public key).
- Generate a unique identifier for each proposal.
- Store proposal data on-chain.
-
Update Proposal
- Allow updating
title, description, start_date, and end_date.
- Ensure only the
creator of the proposal can update it.
-
Delete Proposal
- Allow the
creator to delete their proposal.
- Ensure that only valid, existing proposals can be deleted.
-
Vote on Proposal
- Define vote types:
For, Against, and Abstain.
- Track votes within the proposal structure.
- Ensure each wallet can vote only once per proposal.
- Add logic to calculate vote totals dynamically when a new vote is cast.
- Use Solana's program-derived addresses (PDAs) to securely manage vote data.
-
Access Control
- Use Solana's program-derived addresses (PDAs) for secure and permissioned access.
- Implement checks to validate the
creator's identity for sensitive operations.
-
Unit Tests
- Write comprehensive tests using Mocha or Anchor's built-in testing framework.
- Test all operations: create, update, delete, vote, and edge cases (e.g., invalid data, unauthorized access).
Additional Context
- Use Rust with the Anchor framework.
- Follow Solana best practices for state management and security.
- Document all instructions, accounts, and data structures in the code for easier integration.
Acceptance Criteria
- Fully functional smart contract deployed to a testnet.
- All required features implemented and tested.
- Well-documented code with clear instructions for integration.
Labels
solana, anchor, smart-contract, proposal, voting, enhancement, help wanted
Description
Develop a smart contract using the Anchor framework to manage proposals on the Solana blockchain. The contract should include functionality to create, update, and delete proposals, as well as implement a voting system for the proposals.
Requirements
Create Proposal
title,description,start_date,end_date, andcreator(public key).Update Proposal
title,description,start_date, andend_date.creatorof the proposal can update it.Delete Proposal
creatorto delete their proposal.Vote on Proposal
For,Against, andAbstain.Access Control
creator's identity for sensitive operations.Unit Tests
Additional Context
Acceptance Criteria
Labels
solana,anchor,smart-contract,proposal,voting,enhancement,help wanted