Store requests in a map

This commit is contained in:
hu55a1n1 2023-11-29 13:37:02 -08:00
parent 595b0e02a8
commit 8603c97534
2 changed files with 28 additions and 1 deletions

View file

@ -6,6 +6,25 @@ pub struct InstantiateMsg;
#[cw_serde]
pub enum ExecuteMsg {}
pub mod execute {
use super::*;
#[cw_serde]
pub struct Nonce([u8; 32]);
#[cw_serde]
pub struct JoinComputeNodeMsg {
compute_node_pub_key: String,
nonce: Nonce,
}
#[cw_serde]
pub struct ShareEpochKeyMsg {
compute_node_pub_key: String,
nonce: Nonce,
}
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {}

View file

@ -1,9 +1,17 @@
use crate::msg::execute::{JoinComputeNodeMsg, Nonce, ShareEpochKeyMsg};
use cosmwasm_schema::cw_serde;
use cw_storage_plus::Item;
use cw_storage_plus::{Item, Map};
#[cw_serde]
pub struct State {
pub owner: String,
}
#[cw_serde]
pub enum Request {
JoinComputeNode(JoinComputeNodeMsg),
ShareEpochKey(ShareEpochKeyMsg),
}
pub const STATE: Item<State> = Item::new("state");
pub const REQUESTS: Map<&Nonce, &Request> = Map::new("requests");