Struct MultipleChoiceProposal

Source
pub struct MultipleChoiceProposal {
Show 13 fields pub title: String, pub description: String, pub proposer: Addr, pub start_height: u64, pub min_voting_period: Option<Expiration>, pub expiration: Expiration, pub choices: Vec<CheckedMultipleChoiceOption>, pub status: Status, pub voting_strategy: VotingStrategy, pub total_power: Uint128, pub votes: MultipleChoiceVotes, pub allow_revoting: bool, pub veto: Option<VetoConfig>,
}

Fields§

§title: String

The title of the proposal

§description: String

The main body of the proposal text

§proposer: Addr

The address that created this proposal.

§start_height: u64

The block height at which this proposal was created. Voting power queries should query for voting power at this block height.

§min_voting_period: Option<Expiration>

The minimum amount of time this proposal must remain open for voting. The proposal may not pass unless this is expired or None.

§expiration: Expiration

The the time at which this proposal will expire and close for additional votes.

§choices: Vec<CheckedMultipleChoiceOption>

The options to be chosen from in the vote.

§status: Status

The proposal status

§voting_strategy: VotingStrategy

Voting settings (threshold, quorum, etc.)

§total_power: Uint128

The total power when the proposal started (used to calculate percentages)

§votes: MultipleChoiceVotes

The vote tally.

§allow_revoting: bool

Whether DAO members are allowed to change their votes. When disabled, proposals can be executed as soon as they pass. When enabled, proposals can only be executed after the voting perid has ended and the proposal passed.

§veto: Option<VetoConfig>

Optional veto configuration. If set to None, veto option is disabled. Otherwise contains the configuration for veto flow.

Implementations§

Source§

impl MultipleChoiceProposal

Source

pub fn into_response( self, block: &BlockInfo, id: u64, ) -> StdResult<ProposalResponse>

Consumes the proposal and returns a version which may be used in a query response. The difference being that proposal statuses are only updated on vote, execute, and close events. It is possible though that since a vote has occured the proposal expiring has changed its status. This method recomputes the status so that queries get accurate information.

Source

pub fn current_status(&self, block: &BlockInfo) -> StdResult<Status>

Gets the current status of the proposal.

Source

pub fn update_status(&mut self, block: &BlockInfo) -> StdResult<()>

Sets a proposals status to its current status.

Source

pub fn is_passed(&self, block: &BlockInfo) -> StdResult<bool>

Returns true iff this proposal is sure to pass (even before expiration if no future sequence of possible votes can cause it to fail). Passing in the case of multiple choice proposals means that quorum has been met, one of the options that is not “None of the above” has won the most votes, and there is no tie.

Source

pub fn is_rejected(&self, block: &BlockInfo) -> StdResult<bool>

Source

pub fn calculate_vote_result(&self) -> StdResult<VoteResult>

Find the option with the highest vote weight, and note if there is a tie.

Trait Implementations§

Source§

impl Clone for MultipleChoiceProposal

Source§

fn clone(&self) -> MultipleChoiceProposal

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MultipleChoiceProposal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MultipleChoiceProposal

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for MultipleChoiceProposal

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for MultipleChoiceProposal

Source§

fn eq(&self, other: &MultipleChoiceProposal) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MultipleChoiceProposal

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MultipleChoiceProposal

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,