-
Notifications
You must be signed in to change notification settings - Fork 356
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
Add optional executor restriction to cw3-flex #741
Changes from 3 commits
c154dc3
57c11d6
467c472
ad6a889
1e1f6e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use cosmwasm_std::Addr; | ||
use cw4::Cw4Contract; | ||
use cw_storage_plus::Item; | ||
use cw_utils::{Duration, Threshold}; | ||
|
||
/// Defines who is able to execute proposals once passed | ||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] | ||
pub enum Executor { | ||
ueco-jb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// Any member of the voting group, even with 0 points | ||
Member, | ||
/// Only the given address | ||
Only(Addr), | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] | ||
pub struct Config { | ||
pub threshold: Threshold, | ||
pub max_voting_period: Duration, | ||
// Total weight and voters are queried from this contract | ||
pub group_addr: Cw4Contract, | ||
// who is able to execute passed proposals | ||
// None means that anyone can execute | ||
pub executor: Option<Executor>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disregard the above comment. This is great as it is drop-in state compatible with previous version, not requiring an explicit migration (we should have some placeholder migrate function, but no state change needed). No need to make breaking changes for some aesthetic opinion of mine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I considered that but as you pointed out - this way it's completely backward compatible. |
||
} | ||
|
||
// unique items | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that could be pulled out to a method on Executor?
Already thinking of reusing it for who can make proposals. (but default is Member)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it under
Config
struct. I think it's more versatile this way.What do you think?