Skip to content

[SC-14] Implement on-chain voting - create proposal and cast vote #654

@yusuftomilola

Description

@yusuftomilola

Overview

Implement the on-chain voting system for tokenized asset governance proposals inside contracts/contrib/.

Location

All work must be inside contracts/contrib/src/voting.rs.

Acceptance Criteria

  • Proposal struct: proposal_id: u64, asset_id: BytesN<32>, proposal_type: String, yes_votes: i128, no_votes: i128, deadline: u64, min_threshold: i128, status: ProposalStatus (Active, Passed, Rejected, Executed)
  • create_proposal(env, asset_id, proposal_type, min_threshold, deadline) -> u64 — returns proposal ID
  • cast_vote(env, asset_id, proposal_id, voter, support: bool) — requires auth from voter; voter balance must meet min_threshold; prevents double voting; adds voter balance as vote weight
  • Vote weights stored per voter per proposal

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions