-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start planning proposal Status refactor
- Loading branch information
Jake Hartnell
committed
Aug 30, 2023
1 parent
3347840
commit 55512f8
Showing
3 changed files
with
28 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
use cosmwasm_schema::cw_serde; | ||
use cosmwasm_std::Timestamp; | ||
|
||
// TODO add more timestamps for consistency? | ||
// TODO review these if we are going to go through the pain of changing them | ||
#[cw_serde] | ||
#[derive(Copy)] | ||
pub enum Status { | ||
/// The proposal is open for voting. | ||
Open, | ||
/// The proposal has been rejected. | ||
Rejected, | ||
Rejected { at_time: Timestamp }, | ||
/// The proposal has been passed but has not been executed. | ||
Passed { at_time: Timestamp }, | ||
/// The proposal has been passed and executed. | ||
Executed, | ||
Executed { tx_hash: String }, | ||
/// The proposal has failed or expired and has been closed. A | ||
/// proposal deposit refund has been issued if applicable. | ||
Closed, | ||
Closed { at_time: Timestamp }, | ||
/// The proposal's execution failed. | ||
ExecutionFailed, | ||
ExecutionFailed { err: String }, | ||
/// The proposal has been vetoed. | ||
Vetoed, | ||
Vetoed { rational: Option<String> }, | ||
} | ||
|
||
impl std::fmt::Display for Status { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
Status::Open => write!(f, "open"), | ||
Status::Rejected => write!(f, "rejected"), | ||
Status::Rejected { at_time } => write!(f, "rejected {:?}", at_time), | ||
Status::Passed { at_time } => write!(f, "passed {:?}", at_time), | ||
Status::Executed => write!(f, "executed"), | ||
Status::Closed => write!(f, "closed"), | ||
Status::ExecutionFailed => write!(f, "execution_failed"), | ||
Status::Vetoed => write!(f, "vetoed"), | ||
Status::Executed { tx_hash } => write!(f, "executed {:?}", tx_hash), | ||
Status::Closed { at_time } => write!(f, "closed {:?}", at_time), | ||
Status::ExecutionFailed { err } => write!(f, "execution_failed {:?}", err), | ||
Status::Vetoed { rational } => write!(f, "vetoed {:?}", rational), | ||
} | ||
} | ||
} |