Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for SPL Governance Voting Operations #188

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Rudrakc
Copy link

@Rudrakc Rudrakc commented Jan 11, 2025

This PR introduces support for SPL Governance program voting operations in the Solana Agent Kit, enabling programmatic management of DAO governance activities.

Features Added:

1. Cast Votes on Active Proposals:

  • Added castProposalVote function for submitting votes on governance proposals.
  • Supports "yes" and "no" vote types.

2. Track Voting Power:

  • Added trackVotingPower function to fetch the voting power of a specific token owner in a realm.
  • Returns the governing token deposit amount.

3. Manage Vote Delegation:

  • Added manageVoteDelegation function to assign or update governance delegates for token owners in a realm.

4. Monitor Voting Outcomes:

  • Added monitorVotingOutcomes function to track the current state of a governance proposal.
  • Provides real-time updates on proposal outcomes.

How It Works:

1. Cast Votes:

  • Submits a transaction using SPL Governance’s withCastVote helper.
  • Confirms the transaction with sendAndConfirmTransaction.

2. Track Voting Power:

  • Retrieves the governing token deposit amount from the TokenOwnerRecord.

3. Manage Vote Delegation:

  • Sets or updates the governance delegate using SPL Governance’s withSetGovernanceDelegate helper.
  • Executes the delegation transaction with sendAndConfirmTransaction.

4. Monitor Voting Outcomes:

  • Fetches the proposal's state using SPL Governance’s getProposal helper.
  • Returns a human-readable state (e.g., Voting, Succeeded, Defeated).

Linked Issues:

Closes #165

This pull request was created for https://app.gib.work/bounties/5acb3e1e-b316-4c14-a9d5-c6d6a87496fa in an attempt to solve a bounty #165 . Payment for the bounty is immediately sent to the contributor after merge.

@abrzezinski94
Copy link

Hi please upload screenshots from testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Voting Operations | SPL Governance Integration for Solana Agent Kit | realms.today
2 participants