penumbra_sdk_community_pool/
params.rs1use penumbra_sdk_proto::core::component::community_pool::v1 as pb;
2use penumbra_sdk_proto::DomainType;
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
6#[serde(
7 try_from = "pb::CommunityPoolParameters",
8 into = "pb::CommunityPoolParameters"
9)]
10pub struct CommunityPoolParameters {
11 pub community_pool_spend_proposals_enabled: bool,
13}
14
15impl DomainType for CommunityPoolParameters {
16 type Proto = pb::CommunityPoolParameters;
17}
18
19impl TryFrom<pb::CommunityPoolParameters> for CommunityPoolParameters {
20 type Error = anyhow::Error;
21
22 fn try_from(msg: pb::CommunityPoolParameters) -> anyhow::Result<Self> {
23 Ok(CommunityPoolParameters {
24 community_pool_spend_proposals_enabled: msg.community_pool_spend_proposals_enabled,
25 })
26 }
27}
28
29impl From<CommunityPoolParameters> for pb::CommunityPoolParameters {
30 fn from(params: CommunityPoolParameters) -> Self {
31 pb::CommunityPoolParameters {
32 community_pool_spend_proposals_enabled: params.community_pool_spend_proposals_enabled,
33 }
34 }
35}
36
37impl Default for CommunityPoolParameters {
38 fn default() -> Self {
39 Self {
40 community_pool_spend_proposals_enabled: true,
41 }
42 }
43}