Skip to content

Add a vote casting endpoint that submits the cast_vote contract call and records the vote in the database #834

Description

@Chucks1093

Summary

There is no server endpoint for holders to cast governance votes through the client. A POST /keys/:keyId/proposals/:proposalId/vote endpoint that validates the holder's eligibility, submits the contract call, and persists the vote should be added.

Scope

  • Add POST /keys/:keyId/proposals/:proposalId/vote requiring a valid JWT
  • Accept optionIndex in the request body and validate it is within the proposal's option range
  • Check that the caller has not already voted on the proposal and return 409 if they have
  • Submit the cast_vote contract call and write the vote record to proposal_votes
  • Return 404 if the proposal does not exist or is already closed

Acceptance Criteria

  • Valid vote submitted to contract and persisted
  • Duplicate vote returns 409
  • optionIndex out of range returns 422
  • Vote on a closed proposal returns 404
  • Non-holder JWT with zero balance returns 403

ETA: 12 hours


Coordinate on Telegram

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions