Skip to content

Develop Anchor Smart Contract for Proposals on Solana #3

Description

@sanaderi

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

  1. 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.
  2. Update Proposal

    • Allow updating title, description, start_date, and end_date.
    • Ensure only the creator of the proposal can update it.
  3. Delete Proposal

    • Allow the creator to delete their proposal.
    • Ensure that only valid, existing proposals can be deleted.
  4. 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.
  5. 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.
  6. 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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions