Modify ExecuteMsg
Let's create messages for the two tasks of Creating a Poll and Voting on a Poll.
- So let's open
src/msg.rs
and take a look atExecuteMsg
. It should look pretty empty:
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
CustomMsg { val: String },
}
- Create Poll - Let's add the following:
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
CreatePoll {
poll_id: String,
question: String,
options: Vec<String>,
}
}
- Voting on a Poll
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
CreatePoll {
poll_id: String,
question: String,
options: Vec<String>,
},
Vote {
poll_id: String,
vote: String,
},
}