@@ -14,6 +14,14 @@ pub enum Error {
1414 InvalidDelegate ,
1515 ZeroAmount ,
1616 ReentrantCall ,
17+ NoVotingPower ,
18+ ProposalNotFound ,
19+ ProposalClosed ,
20+ AlreadyVoted ,
21+ VotingActive ,
22+ VotingEnded ,
23+ QuorumNotReached ,
24+ TooManyProposals ,
1725}
1826
1927impl core:: fmt:: Display for Error {
@@ -30,6 +38,14 @@ impl core::fmt::Display for Error {
3038 Error :: InvalidDelegate => write ! ( f, "Invalid delegation target" ) ,
3139 Error :: ZeroAmount => write ! ( f, "Amount must be greater than zero" ) ,
3240 Error :: ReentrantCall => write ! ( f, "Reentrant call detected" ) ,
41+ Error :: NoVotingPower => write ! ( f, "Caller has no voting power" ) ,
42+ Error :: ProposalNotFound => write ! ( f, "Proposal not found" ) ,
43+ Error :: ProposalClosed => write ! ( f, "Proposal is no longer active" ) ,
44+ Error :: AlreadyVoted => write ! ( f, "Caller already voted on this proposal" ) ,
45+ Error :: VotingActive => write ! ( f, "Voting period is still active" ) ,
46+ Error :: VotingEnded => write ! ( f, "Voting period has ended" ) ,
47+ Error :: QuorumNotReached => write ! ( f, "Quorum not reached" ) ,
48+ Error :: TooManyProposals => write ! ( f, "Too many active proposals" ) ,
3349 }
3450 }
3551}
@@ -48,6 +64,14 @@ impl ContractError for Error {
4864 Error :: InvalidDelegate => staking_codes:: STAKING_INVALID_DELEGATE ,
4965 Error :: ZeroAmount => staking_codes:: STAKING_ZERO_AMOUNT ,
5066 Error :: ReentrantCall => 9999 ,
67+ Error :: NoVotingPower => staking_codes:: STAKING_NO_VOTING_POWER ,
68+ Error :: ProposalNotFound => staking_codes:: STAKING_PROPOSAL_NOT_FOUND ,
69+ Error :: ProposalClosed => staking_codes:: STAKING_PROPOSAL_CLOSED ,
70+ Error :: AlreadyVoted => staking_codes:: STAKING_ALREADY_VOTED ,
71+ Error :: VotingActive => staking_codes:: STAKING_VOTING_ACTIVE ,
72+ Error :: VotingEnded => staking_codes:: STAKING_VOTING_ENDED ,
73+ Error :: QuorumNotReached => staking_codes:: STAKING_QUORUM_NOT_REACHED ,
74+ Error :: TooManyProposals => staking_codes:: STAKING_TOO_MANY_PROPOSALS ,
5175 }
5276 }
5377
@@ -64,6 +88,14 @@ impl ContractError for Error {
6488 Error :: InvalidDelegate => "Cannot delegate governance to this address" ,
6589 Error :: ZeroAmount => "The amount must be greater than zero" ,
6690 Error :: ReentrantCall => "Reentrant call detected" ,
91+ Error :: NoVotingPower => "Caller has zero governance power and cannot vote or propose" ,
92+ Error :: ProposalNotFound => "No parameter proposal exists with this id" ,
93+ Error :: ProposalClosed => "The proposal has already been finalised" ,
94+ Error :: AlreadyVoted => "This account already voted on the proposal" ,
95+ Error :: VotingActive => "Cannot execute while the voting window is still open" ,
96+ Error :: VotingEnded => "Cannot vote after the voting window has closed" ,
97+ Error :: QuorumNotReached => "Total turnout did not meet the quorum threshold" ,
98+ Error :: TooManyProposals => "Active proposal limit reached" ,
6799 }
68100 }
69101
0 commit comments