penumbra_sdk_community_pool/component/action_handler/
community_pool_deposit.rs

1use anyhow::Result;
2use async_trait::async_trait;
3use cnidarium::StateWrite;
4use cnidarium_component::ActionHandler;
5
6use crate::{component::StateWriteExt as _, CommunityPoolDeposit};
7
8#[async_trait]
9impl ActionHandler for CommunityPoolDeposit {
10    type CheckStatelessContext = ();
11    async fn check_stateless(&self, _context: ()) -> Result<()> {
12        // Any deposit into the Community Pool is valid.
13        Ok(())
14    }
15
16    async fn check_and_execute<S: StateWrite>(&self, mut state: S) -> Result<()> {
17        Ok(state.community_pool_deposit(self.value).await)
18    }
19}