penumbra_sdk_community_pool/
component.rs1pub mod state_key;
5
6pub mod rpc;
7
8mod action_handler;
9mod view;
10
11use std::sync::Arc;
12
13use async_trait::async_trait;
14use cnidarium::StateWrite;
15use cnidarium_component::Component;
16use tendermint::v0_37::abci;
17use tracing::instrument;
18pub use view::{StateReadExt, StateWriteExt};
19
20use crate::genesis;
21
22pub struct CommunityPool {}
23
24#[async_trait]
25impl Component for CommunityPool {
26 type AppState = genesis::Content;
27
28 #[instrument(name = "community_pool", skip(state, app_state))]
29 async fn init_chain<S: StateWrite>(mut state: S, app_state: Option<&Self::AppState>) {
30 match app_state {
31 Some(genesis) => {
32 state.put_community_pool_params(genesis.community_pool_params.clone());
33 state.community_pool_deposit(genesis.initial_balance).await;
34 }
35 None => {}
36 }
37 }
38
39 #[instrument(name = "community_pool", skip(_state, _begin_block))]
40 async fn begin_block<S: StateWrite + 'static>(
41 _state: &mut Arc<S>,
42 _begin_block: &abci::request::BeginBlock,
43 ) {
44 }
45
46 #[instrument(name = "community_pool", skip(_state, _end_block))]
47 async fn end_block<S: StateWrite + 'static>(
48 _state: &mut Arc<S>,
49 _end_block: &abci::request::EndBlock,
50 ) {
51 }
52
53 #[instrument(name = "community_pool", skip(_state))]
54 async fn end_epoch<S: StateWrite + 'static>(_state: &mut Arc<S>) -> anyhow::Result<()> {
55 Ok(())
56 }
57}