Skip to content

Commit

Permalink
Governance: Create Proposals and Sign Off workflow (#1767)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Cinque <[email protected]>
  • Loading branch information
SebastianBor and joncinque authored May 26, 2021
1 parent ecc25f7 commit 94350d0
Show file tree
Hide file tree
Showing 41 changed files with 2,571 additions and 746 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions governance/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ thiserror = "1.0"

[dev-dependencies]
assert_matches = "1.5.0"
proptest = "0.10"
solana-program-test = "1.6.7"
solana-sdk = "1.6.7"

Expand Down
56 changes: 50 additions & 6 deletions governance/program/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,66 @@ pub enum GovernanceError {
#[error("Governing Token Owner must sign transaction")]
GoverningTokenOwnerMustSign,

/// Governing Token Owner or Vote Authority must sign transaction
#[error("Governing Token Owner or Vote Authority must sign transaction")]
GoverningTokenOwnerOrVoteAuthrotiyMustSign,
/// Governing Token Owner or Delegate must sign transaction
#[error("Governing Token Owner or Delegate must sign transaction")]
GoverningTokenOwnerOrDelegateMustSign,

/// All active votes must be relinquished to withdraw governing tokens
#[error("All active votes must be relinquished to withdraw governing tokens")]
CannotWithdrawGoverningTokensWhenActiveVotesExist,

/// Invalid Voter account address
#[error("Invalid Voter account address")]
InvalidVoterAccountAddress,
/// Invalid Token Owner Record account address
#[error("Invalid Token Owner Record account address")]
InvalidTokenOwnerRecordAccountAddress,

/// Invalid Token Owner Record Governing mint
#[error("Invalid Token Owner Record Governing mint")]
InvalidTokenOwnerRecordGoverningMint,

/// Invalid Token Owner Record Realm
#[error("Invalid Token Owner Record Realm")]
InvalidTokenOwnerRecordRealm,

/// Invalid Signatory account address
#[error("Invalid Signatory account address")]
InvalidSignatoryAddress,

/// Signatory already signed off
#[error("Signatory already signed off")]
SignatoryAlreadySignedOff,

/// Signatory must sign
#[error("Signatory must sign")]
SignatoryMustSign,

/// Invalid Proposal Owner
#[error("Invalid Proposal Owner")]
InvalidProposalOwnerAccount,

/// Invalid Governance config
#[error("Invalid Governance config")]
InvalidGovernanceConfig,

/// Proposal for the given Governance, Governing Token Mint and index already exists
#[error("Proposal for the given Governance, Governing Token Mint and index already exists")]
ProposalAlreadyExists,

/// Owner doesn't have enough governing tokens to create Proposal
#[error("Owner doesn't have enough governing tokens to create Proposal")]
NotEnoughTokensToCreateProposal,

/// Invalid State: Can't edit Signatories
#[error("Invalid State: Can't edit Signatories")]
InvalidStateCannotEditSignatories,

/// Invalid State: Can't sign off
#[error("Invalid State: Can't sign off")]
InvalidStateCannotSignOff,

/// Invalid Signatory Mint
#[error("Invalid Signatory Mint")]
InvalidSignatoryMint,

/// ---- Account Tools Errors ----
/// Invalid account owner
Expand Down
Loading

0 comments on commit 94350d0

Please sign in to comment.